diff --git a/adapter/khdf/liteos/model/usb/device/BUILD.gn b/adapter/khdf/liteos/model/usb/device/BUILD.gn index 2d33eaa99c32762924d00ab463fecf3824331125..de235556bbea04f7f8b962982294212d5bf3986d 100644 --- a/adapter/khdf/liteos/model/usb/device/BUILD.gn +++ b/adapter/khdf/liteos/model/usb/device/BUILD.gn @@ -78,5 +78,6 @@ hdf_driver(module_name) { "$FRAMEWORKS_USB_DDK_DEVICE/include", "$FRAMEWORKS_USB_DRIVERS/include", "$LITEOSTOPDIR/../../device/soc/hisilicon/common/hal/usb/hi3516dv300/include", + "$HDF_PERIPHERAL_PATH/usb/utils/include", ] } diff --git a/adapter/khdf/liteos/model/usb/device/Makefile b/adapter/khdf/liteos/model/usb/device/Makefile index e0462127fc2fa623e46ef54d58b70530e6bab67f..4b196267e89b08ff840372b797efdd4cc9e12871 100644 --- a/adapter/khdf/liteos/model/usb/device/Makefile +++ b/adapter/khdf/liteos/model/usb/device/Makefile @@ -39,6 +39,7 @@ LOCAL_INCLUDE := $(USB_DEVICE_ROOT) \ $(USB_DEVICE_ROOT)/gadget/fconfig/include \ $(FRAMEWORKS_USB_DDK_DEVICE)/../../interfaces/ddk/common \ $(FRAMEWORKS_USB_DDK_DEVICE)/../../interfaces/ddk/device \ + $(FRAMEWORKS_USB_DDK_DEVICE)/../../utils/include \ $(FRAMEWORKS_USB_DDK_DEVICE)/include LOCAL_SRCS += $(FRAMEWORKS_USB_DDK_DEVICE)/src/adapter_if_liteos.c \ diff --git a/adapter/khdf/liteos/model/usb/host/BUILD.gn b/adapter/khdf/liteos/model/usb/host/BUILD.gn index 8782d4fae597855c72566cd411009ee2bd7143ce..51a5519e5a09fc863cb673469f35dc13811306cb 100644 --- a/adapter/khdf/liteos/model/usb/host/BUILD.gn +++ b/adapter/khdf/liteos/model/usb/host/BUILD.gn @@ -40,7 +40,7 @@ hdf_driver(module_name) { "$PERIPHERAL_USB_DDK_HOST/src/usb_raw_api.c", "$PERIPHERAL_USB_DDK_HOST/src/usb_raw_api_library.c", ] - include_dirs = [] + include_dirs = [ "$HDF_PERIPHERAL_PATH/usb/utils/include" ] if (defined(LOSCFG_DRIVERS_HDF_USB_PNP_NOTIFY)) { USB_PNP_NOTIFY_SHARED_ROOT = "$HDF_FRAMEWORKS_PATH/core/shared" FRAMEWORKS_USB_DDK_HOST = "$HDF_FRAMEWORKS_PATH/model/usb" @@ -58,6 +58,7 @@ hdf_driver(module_name) { "$HDF_INTERFACE_PATH/inner_api/osal/shared", "$HDF_INTERFACE_PATH/inner_api/host/shared", "$FRAMEWORKS_USB_DDK_HOST/include", + "$HDF_PERIPHERAL_PATH/usb/utils/include", ] public_configs = [ ":public" ] } @@ -81,6 +82,7 @@ hdf_driver(module_name) { "$FRAMEWORKS_USB_SERIAL_DEMO_ROOT/include", "$FRAMEWORKS_USB_NET_DEMO_ROOT/include", "$FRAMEWORKS_USB_DDK_SPEED_TEST_ROOT/include", + "$HDF_PERIPHERAL_PATH/usb/utils/include", ] } @@ -88,6 +90,7 @@ hdf_driver(module_name) { "$PERIPHERAL_USB_DDK_HOST/../../interfaces/ddk/common", "$PERIPHERAL_USB_DDK_HOST/../../interfaces/ddk/host", "$PERIPHERAL_USB_DDK_HOST/include", + "$HDF_PERIPHERAL_PATH/usb/utils/include", ] } @@ -95,5 +98,6 @@ config("public") { include_dirs = [ "include", "$HDF_FRAMEWORKS_PATH/model/usb/include", + "$HDF_PERIPHERAL_PATH/usb/utils/include", ] } diff --git a/adapter/khdf/liteos/model/usb/host/Makefile b/adapter/khdf/liteos/model/usb/host/Makefile index 01b1f56a701464f216a440a0b1e7cdf26565bcea..5fe8dd41745b358fe9ded5f58ef1f51f15c718bb 100644 --- a/adapter/khdf/liteos/model/usb/host/Makefile +++ b/adapter/khdf/liteos/model/usb/host/Makefile @@ -36,7 +36,8 @@ PERIPHERAL_USB_DDK_HOST = $(LITEOSTOPDIR)/../../drivers/peripheral/usb/ddk/host LOCAL_INCLUDE := $(PERIPHERAL_USB_DDK_HOST)/../../interfaces/ddk/common \ $(PERIPHERAL_USB_DDK_HOST)/../../interfaces/ddk/host \ - $(PERIPHERAL_USB_DDK_HOST)/include + $(PERIPHERAL_USB_DDK_HOST)/include \ + $(PERIPHERAL_USB_DDK_HOST)/../../utils/include LOCAL_SRCS += $(PERIPHERAL_USB_DDK_HOST)/src/liteos_adapter.c \ $(PERIPHERAL_USB_DDK_HOST)/src/usb_raw_api.c \ @@ -56,6 +57,7 @@ LOCAL_INCLUDE := $(USB_PNP_NOTIFY_ROOT)/include \ $(LITEOSTOPDIR)/../../drivers/hdf_core/interfaces/inner_api/utils \ $(LITEOSTOPDIR)/../../drivers/hdf_core/interfaces/inner_api/osal/shared \ $(LITEOSTOPDIR)/../../drivers/hdf_core/interfaces/inner_api/host/shared \ + $(LITEOSTOPDIR)/../../drivers/peripheral/usb/utils/include \ $(FRAMEWORKS_USB_DDK_HOST)/include LOCAL_SRCS += $(USB_PNP_NOTIFY_ROOT)/src/usb_pnp_notify.c \ @@ -73,6 +75,7 @@ LOCAL_INCLUDE := $(FRAMEWORKS_USB_SERIAL_DEMO_ROOT)/../gadget/function/include \ $(FRAMEWORKS_USB_SERIAL_DEMO_ROOT)/../interfaces/ddk/common \ $(FRAMEWORKS_USB_SERIAL_DEMO_ROOT)/../interfaces/ddk/host \ $(FRAMEWORKS_USB_SERIAL_DEMO_ROOT)/../ddk/host/include \ + $(FRAMEWORKS_USB_SERIAL_DEMO_ROOT)/../utils/include \ $(FRAMEWORKS_USB_SERIAL_DEMO_ROOT)/include \ $(FRAMEWORKS_USB_NET_DEMO_ROOT)/include \ $(FRAMEWORKS_USB_DDK_SPEED_TEST_ROOT)/include diff --git a/framework/README_zh.md b/framework/README_zh.md index 1b9a80849cf39aec1bab3dafb7563ac27912ba9c..9adac731b4218e79baae52962d71639c865c507a 100644 --- a/framework/README_zh.md +++ b/framework/README_zh.md @@ -136,7 +136,7 @@ Sensor驱动模型主要由以下两部分组成: ### Display框架模型说明 -基于OpenHarmony驱动框架的Display驱动模型,对下屏蔽了芯片平台差异,方便操作系统跨平台迁移;向上抽象了外设驱动公共业务逻辑,通过配置或差异化适配接口,实现了一套驱动模型兼容不同的外设器件,使得三方厂商可以高效、便捷的切入鸿蒙驱动生态。 +基于OpenHarmony驱动框架的Display驱动模型,对下屏蔽了芯片平台差异,方便操作系统跨平台迁移;向上抽象了外设驱动公共业务逻辑,通过配置或差异化适配接口,实现了一套驱动模型兼容不同的外设器件,使得三方厂商可以高效、便捷的切入OpenHarmony驱动生态。 Display驱动模型主要由以下两部分组成: diff --git a/framework/model/sensor/driver/common/include/sensor_config_parser.h b/framework/model/sensor/driver/common/include/sensor_config_parser.h index 3123f701f73824d652301876e4e6aba965636433..1ab2b1ff6d30ffe5a35c0aeea88fbee520d0c1ce 100644 --- a/framework/model/sensor/driver/common/include/sensor_config_parser.h +++ b/framework/model/sensor/driver/common/include/sensor_config_parser.h @@ -20,13 +20,6 @@ #define MAX_SENSOR_INDEX_NUM 48 #define MAX_SENSOR_AXIS_NUM 3 -#define CHECK_PARSER_NAME(ptr, str, cname) do { \ - if (strcpy_s(ptr, SENSOR_INFO_VERSION_MAX_LEN, cname) != EOK) { \ - HDF_LOGE("%s:copy %s failed!", __func__, str); \ - return HDF_FAILURE; \ - } \ -} while (0) - enum SensorRegOpsType { SENSOR_INIT_GROUP = 0, SENSOR_ENABLE_GROUP, diff --git a/framework/model/sensor/driver/common/src/sensor_config_parser.c b/framework/model/sensor/driver/common/src/sensor_config_parser.c index 022346de3d0b4da2a171e8c2d6bd61016c483830..98c89b07c966f777d69e227634222321d8da8f46 100755 --- a/framework/model/sensor/driver/common/src/sensor_config_parser.c +++ b/framework/model/sensor/driver/common/src/sensor_config_parser.c @@ -300,31 +300,48 @@ int32_t DetectSensorDevice(struct SensorCfgData *config) return HDF_SUCCESS; } -static int32_t ParseSensorInfo(struct DeviceResourceIface *parser, const struct DeviceResourceNode *infoNode, +static int32_t ParseSensorString(struct DeviceResourceIface *parser, const struct DeviceResourceNode *infoNode, struct SensorCfgData *config) { - int32_t ret; - uint16_t id; - int32_t value; const char *name = NULL; - ret = parser->GetString(infoNode, "sensorName", &name, NULL); + int32_t ret = parser->GetString(infoNode, "sensorName", &name, NULL); CHECK_PARSER_RESULT_RETURN_VALUE(ret, "sensorName"); - CHECK_PARSER_NAME(config->sensorInfo.sensorName, "sensorName", name); + if (strcpy_s(config->sensorInfo.sensorName, SENSOR_INFO_NAME_MAX_LEN, name) != EOK) { + HDF_LOGE("%s:copy sensorName failed!", __func__); + return HDF_FAILURE; + } ret = parser->GetString(infoNode, "vendorName", &name, NULL); CHECK_PARSER_RESULT_RETURN_VALUE(ret, "vendorName"); - CHECK_PARSER_NAME(config->sensorInfo.vendorName, "vendorName", name); + if (strcpy_s(config->sensorInfo.vendorName, SENSOR_INFO_NAME_MAX_LEN, name) != EOK) { + HDF_LOGE("%s:copy vendorName failed!", __func__); + return HDF_FAILURE; + } ret = parser->GetString(infoNode, "firmwareVersion", &name, NULL); CHECK_PARSER_RESULT_RETURN_VALUE(ret, "firmwareVersion"); - CHECK_PARSER_NAME(config->sensorInfo.firmwareVersion, "firmwareVersion", name); + if (strcpy_s(config->sensorInfo.firmwareVersion, SENSOR_INFO_NAME_MAX_LEN, name) != EOK) { + HDF_LOGE("%s:copy firmwareVersion failed!", __func__); + return HDF_FAILURE; + } ret = parser->GetString(infoNode, "hardwareVersion", &name, NULL); CHECK_PARSER_RESULT_RETURN_VALUE(ret, "hardwareVersion"); - CHECK_PARSER_NAME(config->sensorInfo.hardwareVersion, "hardwareVersion", name); + if (strcpy_s(config->sensorInfo.hardwareVersion, SENSOR_INFO_NAME_MAX_LEN, name) != EOK) { + HDF_LOGE("%s:copy hardwareVersion failed!", __func__); + return HDF_FAILURE; + } + + return ret; +} - ret = parser->GetUint16(infoNode, "sensorTypeId", &id, 0); +static int32_t ParseSensorValue(struct DeviceResourceIface *parser, const struct DeviceResourceNode *infoNode, + struct SensorCfgData *config) +{ + uint16_t id; + int32_t value; + int32_t ret = parser->GetUint16(infoNode, "sensorTypeId", &id, 0); CHECK_PARSER_RESULT_RETURN_VALUE(ret, "sensorTypeId"); config->sensorInfo.sensorTypeId = id; ret = parser->GetUint16(infoNode, "sensorId", &id, 0); @@ -350,6 +367,17 @@ static int32_t ParseSensorInfo(struct DeviceResourceIface *parser, const struct return ret; } +static int32_t ParseSensorInfo(struct DeviceResourceIface *parser, const struct DeviceResourceNode *infoNode, + struct SensorCfgData *config) +{ + int32_t ret = ParseSensorString(parser, infoNode, config); + CHECK_PARSER_RESULT_RETURN_VALUE(ret, "ParseSensorString"); + + ret = ParseSensorValue(parser, infoNode, config); + CHECK_PARSER_RESULT_RETURN_VALUE(ret, "ParseSensorValue"); + return ret; +} + static int32_t ParseSensorSpiBus(struct DeviceResourceIface *parser, const struct DeviceResourceNode *spiBusNode, struct SensorBusCfg *busConfig) { diff --git a/framework/tools/hcs-view/hcsWebView/src/MainEditor.js b/framework/tools/hcs-view/hcsWebView/src/MainEditor.js index 4f398700997d7e22922cf5c7a39639b38369f322..60a9770d0836c367364161abf17868361efee975 100644 --- a/framework/tools/hcs-view/hcsWebView/src/MainEditor.js +++ b/framework/tools/hcs-view/hcsWebView/src/MainEditor.js @@ -43,6 +43,10 @@ const KEY_VALUE_MAX = 30; const ONE_KEY_VALUE_MAX = 29; const TWO_KEY_VALUE_MAX = 28; const THREE_KEY_VALUE_MAX = 27; +const BGPIC_WIDTH = 156; +const BGPIC_HEIGHT = 112; +const DRAWTEXT_OFFSETX = -3; +const DRAWTEXT_OFFSETY = -3; const MouseType = { DOWN: 1, // 按下 @@ -318,19 +322,7 @@ class MainEditor { 32 ); - let bgPic = RightMenu.isDarkBackground_ ? 'pop_background.png' : 'pop_background_light.png'; - let bgPicPath = '../images/' + bgPic; - RightMenu.backgroundImg_ = XTexture.gi().loadTextureFromImage(bgPicPath); - RightMenu.backgroundCut_ = XTexture.gi().makeCut( - RightMenu.backgroundImg_, - 0, - 0, - 156, - 112, - 156, - 112 - ); - this.cutImgDict_['backgroundCut'] = bgPic; + this.reloadBgPic(); RightMenu.popItemFocusImg_ = XTexture.gi().loadTextureFromImage( '../images/pop_item_focus.png' @@ -526,6 +518,13 @@ class MainEditor { } reloadMenuBgPic() { + let bgPic = this.reloadBgPic(); + XMessage.gi().send('reloadMenuBg', { + data: bgPic, + }); + } + + reloadBgPic() { let bgPic = RightMenu.isDarkBackground_ ? 'pop_background.png' : 'pop_background_light.png'; let bgPicPath = '../images/' + bgPic; RightMenu.backgroundImg_ = XTexture.gi().loadTextureFromImage(bgPicPath); @@ -533,15 +532,13 @@ class MainEditor { RightMenu.backgroundImg_, 0, 0, - 156, - 112, - 156, - 112 + BGPIC_WIDTH, + BGPIC_HEIGHT, + BGPIC_WIDTH, + BGPIC_HEIGHT ); - this.cutImgDict_['backgroundCut'] = bgPic; - XMessage.gi().send('reloadMenuBg', { - data: bgPic, - }); + this.cutImgDict_.backgroundCut = bgPic; + return bgPic; } calcPostionY(data, y) { @@ -1223,38 +1220,23 @@ class MainEditor { * @param {} pm2f X2DFast */ drawSelectText(pm2f) { - pm2f.drawText( - '点击选择目标', - MainEditor.NODE_TEXT_SIZE, - this.mousePos_.x, - this.mousePos_.y, - 1, - 1, - 0, - -3, - -3, - MainEditor.NODE_TEXT_COLOR - ); + let drawTextName = '点击选择目标'; + this.callDrawText(pm2f, drawTextName); this.btnCancelSelect_.name_ = '取消选择'; } + callDrawText(pm2f, drawTextName) { + pm2f.drawText(drawTextName, MainEditor.NODE_TEXT_SIZE, this.mousePos_.x, + this.mousePos_.y, 1, 1, 0, DRAWTEXT_OFFSETX, DRAWTEXT_OFFSETY, MainEditor.NODE_TEXT_COLOR); + } + /** * 绘制复制文本 * @param {} pm2f X2DFast */ drawCopyText(pm2f) { - pm2f.drawText( - '已复制' + this.selectNode_.pnode.name_, - MainEditor.NODE_TEXT_SIZE, - this.mousePos_.x, - this.mousePos_.y, - 1, - 1, - 0, - -3, - -3, - MainEditor.NODE_TEXT_COLOR - ); + let drawTextName = '已复制' + this.selectNode_.pnode.name_; + this.callDrawText(pm2f, drawTextName); this.btnCancelSelect_.name_ = '取消复制'; } diff --git a/framework/tools/hcs-view/hcsWebView/src/attr/AttributeArea.js b/framework/tools/hcs-view/hcsWebView/src/attr/AttributeArea.js index c9cfddad7fca1820322143a8cbc1850731c05f55..fe181646baf90887fcc61a8b44721bb99f76b2e0 100644 --- a/framework/tools/hcs-view/hcsWebView/src/attr/AttributeArea.js +++ b/framework/tools/hcs-view/hcsWebView/src/attr/AttributeArea.js @@ -49,6 +49,13 @@ class AttributeArea { '
'; ret += '
'; + this.htmlStr += ret; + } + + addInputFunc(default_, ret, searchId, disable) { if (default_.indexOf('"') >= 0) { ret += ' value=""'; this.freshInputValue_.push([searchId, default_]); @@ -58,36 +65,16 @@ class AttributeArea { if (disable) { ret += ' disabled="disabled"'; } - ret += - ' oninput="document.attrCallback.Event(' + - "'input', " + - "'" + - searchId + - "'" + - ')" />
'; - this.htmlStr += ret; + return ret; } addInput(searchId, label, default_, disable) { let ret = '
'; ret += '= 0) { - ret += ' value=""'; - this.freshInputValue_.push([searchId, default_]); - } else { - ret += ' value="' + default_ + '"'; - } - if (disable) { - ret += ' disabled="disabled"'; - } - ret += - ' oninput="document.attrCallback.Event(' + - "'input', " + - "'" + - searchId + - "'" + - ')" />
'; + ret = this.addInputFunc(default_, ret, searchId, disable); + ret += ' oninput="document.attrCallback.Event(' + "'input', " + "'" + + searchId + "'" + ')" />
'; this.htmlStr += ret; } @@ -101,17 +88,8 @@ class AttributeArea { let validatorId = 'valid_' + searchId; let ret = '
'; ret += '= 0) { - ret += ' value=""'; - this.freshInputValue_.push([searchId, default_]); - } else { - ret += ' value="' + default_ + '"'; - } - if (disable) { - ret += ' disabled="disabled"'; - } + ret += ' class="input_text" maxlength="40" placeholder="' + defaultTxt + '"'; + ret = this.addInputFunc(default_, ret, searchId, disable); ret += ' autofocus="autofocus" onFocus="document.attrCallback.Event(' + "'input', " + @@ -154,56 +132,30 @@ class AttributeArea { } let text = '" class="button_click" type="button" onclick="document.attrCallback.Event('; - this.htmlStr += - '
'; + let htmlString = this.getStrText(searchId, text, label); + this.htmlStr += '
'; + } + addLabelButton(searchId, label, title) { if (label.length > MAX_LABEL_LENGTH) { label = label.substring(0, MAX_LABEL_LENGTH) + '...'; } let text = '" class="label_button_click" type="button" onclick="document.attrCallback.Event('; - this.htmlStr += - '

'; + let htmlString = this.getStrText(searchId, text, label); + this.htmlStr += '

'; + let text = '" class="button_click_delete" type="button" onclick="document.attrCallback.Event('; + this.htmlStr += '
'; } addSelect(searchId, label, selectList, default_, disable) { let ret = '
'; diff --git a/framework/tools/hcs-view/hcsWebView/src/engine/RightMenu.js b/framework/tools/hcs-view/hcsWebView/src/engine/RightMenu.js index 6ae545cfc24206b9ae1360ed915f6b38deaab912..58a66e6e1e9e311eb132b1f6543dd9e627812f1e 100755 --- a/framework/tools/hcs-view/hcsWebView/src/engine/RightMenu.js +++ b/framework/tools/hcs-view/hcsWebView/src/engine/RightMenu.js @@ -28,6 +28,8 @@ const MenuGroupSize = { }; const MOUSETYPE_MOVE = 2; +const DRAWTEXT_OFFSETX = -3; +const DRAWTEXT_OFFSETY = -2; class RightMenu { static backgroundImg_ = -1; @@ -158,37 +160,20 @@ class RightMenu { } } else if (e.type === MenuType.CONTENT) { if (e.open) { - X2DFast.px2f.drawText( - '<', - RightMenu.TEXT_SIZE, - x + w, - OFFY_, - 1, - 1, - 0, - -3, - -2, - textColor - ); + RightMenu.callDrawText('<', x, w, OFFY_, textColor); RightMenu.DrawGroup(e.group, x + w, y); } else { - X2DFast.px2f.drawText( - '>', - RightMenu.TEXT_SIZE, - x + w, - OFFY_, - 1, - 1, - 0, - -3, - -2, - textColor - ); + RightMenu.callDrawText('>', x, w, OFFY_, textColor); } } y += 32; } } + static callDrawText(symbol, x, w, OFFY_, textColor) { + X2DFast.px2f.drawText(symbol, RightMenu.TEXT_SIZE, x + w, OFFY_, 1, 1, 0, + DRAWTEXT_OFFSETX, DRAWTEXT_OFFSETY, textColor); + } + static Touch(msg, x, y) { if (RightMenu.MENU) { if (RightMenu.TouchGroup(RightMenu.MENU.detail, msg, x, y)) { diff --git a/framework/tools/hcs-view/hcsWebView/src/engine/control/XButton.js b/framework/tools/hcs-view/hcsWebView/src/engine/control/XButton.js index 7e2f757bd2f7cfa7d6b5bea49dddcd2f3169960e..e6c751427ea5bb2ba013ff5ad23333569fe7e29a 100644 --- a/framework/tools/hcs-view/hcsWebView/src/engine/control/XButton.js +++ b/framework/tools/hcs-view/hcsWebView/src/engine/control/XButton.js @@ -64,7 +64,7 @@ class XButton { } } - isTouchIn(x, y) { + isTouchInButton(x, y) { if (x < this.posX_) { return false; } @@ -80,7 +80,7 @@ class XButton { return true; } procTouch(msg, x, y) { - let isIn = this.isTouchIn(x, y); + let isIn = this.isTouchInButton(x, y); switch (msg) { case 1: if (isIn) { diff --git a/framework/tools/hcs-view/hcsWebView/src/engine/graphics/XTexture.js b/framework/tools/hcs-view/hcsWebView/src/engine/graphics/XTexture.js index d975455cb02553fe10d3b95a0e8e3b7aaf4d0985..ad46024f7775cbb6128c784d2bc9866fe0ac71c5 100644 --- a/framework/tools/hcs-view/hcsWebView/src/engine/graphics/XTexture.js +++ b/framework/tools/hcs-view/hcsWebView/src/engine/graphics/XTexture.js @@ -115,24 +115,16 @@ export class XTexture { if (h === -1) { h = hh; } - this.allCuts[this.tmpCutid] = { - rid: rid, - x: x, - y: y, - w: w, - h: h, - u0: x / ww, - v0: y / hh, - u1: (x + w) / ww, - v1: y / hh, - u2: (x + w) / ww, - v2: (y + h) / hh, - u3: x / ww, - v3: (y + h) / hh, - }; + this.callAllCuts(this.tmpCutid, rid, x, y, w, h, ww, hh); this.tmpCutid += 1; return this.tmpCutid - 1; } + callAllCuts(param, rid, x, y, w, h, ww, hh) { + this.allCuts[param] = { + rid: rid, x: x, y: y, w: w, h: h, u0: x / ww, v0: y / hh, u1: (x + w) / ww, v1: y / hh, + u2: (x + w) / ww, v2: (y + h) / hh, u3: x / ww, v3: (y + h) / hh, + }; + } makeCut(rid, x = 0, y = 0, w = -1, h = -1, ww = -1, hh = -1) { if (ww === -1) { ww = this.ximages[rid].w; @@ -146,21 +138,7 @@ export class XTexture { if (h === -1) { h = hh; } - this.allCuts[this.aiCutid] = { - rid: rid, - x: x, - y: y, - w: w, - h: h, - u0: x / ww, - v0: y / hh, - u1: (x + w) / ww, - v1: y / hh, - u2: (x + w) / ww, - v2: (y + h) / hh, - u3: x / ww, - v3: (y + h) / hh, - }; + this.callAllCuts(this.aiCutid, rid, x, y, w, h, ww, hh); this.aiCutid += 1; return this.aiCutid - 1; }