cocos-enhance-kit/patches/v1.0.0/0015-Bitmap-uuid.patch

56 lines
2.5 KiB
Diff
Raw Normal View History

From a4decd86188d65dbabd49aeeaaccc8713968d51a Mon Sep 17 00:00:00 2001
From: SmallMain <smallmain@outlook.com>
Date: Tue, 21 Jun 2022 22:37:35 +0800
Subject: [PATCH 15/15] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Bitmap=20=E7=BC=93?=
=?UTF-8?q?=E5=AD=98=E6=A8=A1=E5=BC=8F=E5=A4=8D=E7=94=A8=E5=90=8E=E5=87=BA?=
=?UTF-8?q?=E7=8E=B0=E7=9A=84=E5=90=8C=20uuid=20=E5=AF=BC=E8=87=B4?=
=?UTF-8?q?=E6=AD=A3=E5=9C=A8=E4=BD=BF=E7=94=A8=E7=9A=84=E5=8A=A8=E6=80=81?=
=?UTF-8?q?=E5=9B=BE=E9=9B=86=E5=8C=BA=E5=9F=9F=E8=A2=AB=E9=94=80=E6=AF=81?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
engine/cocos2d/core/components/CCLabel.js | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/engine/cocos2d/core/components/CCLabel.js b/engine/cocos2d/core/components/CCLabel.js
index 6cbfe1b..9d22219 100644
--- a/engine/cocos2d/core/components/CCLabel.js
+++ b/engine/cocos2d/core/components/CCLabel.js
@@ -478,7 +478,7 @@ let Label = cc.Class({
if (this.cacheMode === oldValue) return;
if (oldValue === CacheMode.BITMAP && !(this.font instanceof cc.BitmapFont)) {
- this._frame && this._frame._resetDynamicAtlasFrame();
+ deleteFromDynamicAtlas(this, this._frame);
}
if (oldValue === CacheMode.CHAR) {
@@ -665,9 +665,12 @@ let Label = cc.Class({
this._assemblerData = null;
this._letterTexture = null;
if (this._ttfTexture) {
+ // HACK 由于会出现多个 uuid 一样的情况,销毁时会将动态图集中的区域直接销毁,导致其它使用该区域的 Label 显示错误,所以先将 packable = false不走销毁逻辑在下方走 frame 的回收逻辑
+ this._ttfTexture._packable = false;
this._ttfTexture.destroy();
this._ttfTexture = null;
}
+ this._resetFrame();
this._super();
},
@@ -784,7 +787,7 @@ let Label = cc.Class({
}
if (this.cacheMode !== CacheMode.CHAR) {
- this._frame._resetDynamicAtlasFrame();
+ deleteFromDynamicAtlas(this, this._frame);
this._frame._refreshTexture(this._ttfTexture);
if (this._srcBlendFactor === cc.macro.BlendFactor.ONE && !CC_NATIVERENDERER) {
this._ttfTexture.setPremultiplyAlpha(true);
--
2.32.0 (Apple Git-132)