From 115c24d9051cf4e476c8b48b4449971f0ccce29b Mon Sep 17 00:00:00 2001 From: lhkzh Date: Wed, 9 Sep 2020 20:17:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=BE=99=E9=AA=A8=E5=8A=A8?= =?UTF-8?q?=E7=94=BB=E4=BB=8E=E5=9B=BE=E9=9B=86=E4=B8=AD=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 可以打包多个小的龙骨动画的资源图为图集,在某些场景减少drawcall和加快加载速度 --- .../src/dragonBones/egret/EgretTextureAtlasData.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Egret/4.x/src/dragonBones/egret/EgretTextureAtlasData.ts b/Egret/4.x/src/dragonBones/egret/EgretTextureAtlasData.ts index bd2232f0..e36a671c 100644 --- a/Egret/4.x/src/dragonBones/egret/EgretTextureAtlasData.ts +++ b/Egret/4.x/src/dragonBones/egret/EgretTextureAtlasData.ts @@ -81,8 +81,10 @@ namespace dragonBones { if (this._renderTexture !== null) { const bitmapData = this._renderTexture.bitmapData; - const textureAtlasWidth = this.width > 0.0 ? this.width : bitmapData.width; - const textureAtlasHeight = this.height > 0.0 ? this.height : bitmapData.height; + const textureAtlasWidth = bitmapData.width; + const textureAtlasHeight = bitmapData.height; + const textureOffsetX = this._renderTexture.$bitmapX; + const textureOffsetY = this._renderTexture.$bitmapY; for (let k in this.textures) { const scale = egret.$TextureScaleFactor; @@ -98,7 +100,7 @@ namespace dragonBones { if (textureData.rotated) { textureData.renderTexture.$initData( - textureData.region.x * scale, textureData.region.y * scale, + textureOffsetX + textureData.region.x * scale, textureOffsetY + textureData.region.y * scale, subTextureHeight * scale, subTextureWidth * scale, 0, 0, subTextureHeight * scale, subTextureWidth * scale, @@ -108,7 +110,7 @@ namespace dragonBones { } else { textureData.renderTexture.$initData( - textureData.region.x * scale, textureData.region.y * scale, + textureOffsetX + textureData.region.x * scale, textureOffsetY + textureData.region.y * scale, subTextureWidth * scale, subTextureHeight * scale, 0, 0, subTextureWidth * scale, subTextureHeight * scale, @@ -146,4 +148,4 @@ namespace dragonBones { this.renderTexture = null; } } -} \ No newline at end of file +}