From 8904950c7027ea7a61ba75a65edd9e0f92a091d9 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 8 Nov 2024 12:36:49 +0800 Subject: [PATCH] [v3.8.5] Fix that bytedance platform adapter code hacked cc.ImageAsset.data. (#17825) --- cocos/asset/assets/image-asset.ts | 4 ++-- .../platforms/bytedance/wrapper/engine/ImageAsset.js | 7 ------- .../minigame/platforms/bytedance/wrapper/engine/index.js | 1 - 3 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 platforms/minigame/platforms/bytedance/wrapper/engine/ImageAsset.js diff --git a/cocos/asset/assets/image-asset.ts b/cocos/asset/assets/image-asset.ts index f20151cda14..f708938c465 100644 --- a/cocos/asset/assets/image-asset.ts +++ b/cocos/asset/assets/image-asset.ts @@ -24,7 +24,7 @@ // @ts-check import { ccclass, override } from 'cc.decorator'; -import { EDITOR, ALIPAY, XIAOMI, JSB, TEST, BAIDU, TAOBAO, TAOBAO_MINIGAME, WECHAT_MINI_PROGRAM } from 'internal:constants'; +import { EDITOR, ALIPAY, XIAOMI, JSB, TEST, BAIDU, TAOBAO, TAOBAO_MINIGAME, WECHAT_MINI_PROGRAM, BYTEDANCE } from 'internal:constants'; import { Device, Format, FormatFeatureBit, deviceManager } from '../../gfx'; import { Asset } from './asset'; import { PixelFormat } from './asset-enum'; @@ -163,7 +163,7 @@ function fetchImageSource (imageSource: ImageSource): HTMLCanvasElement | HTMLIm // 返回该图像源是否是平台提供的图像对象。 function isNativeImage (imageSource: ImageSource): imageSource is (HTMLImageElement | HTMLCanvasElement | ImageBitmap) { - if (ALIPAY || TAOBAO || TAOBAO_MINIGAME || XIAOMI || BAIDU || WECHAT_MINI_PROGRAM) { + if (ALIPAY || TAOBAO || TAOBAO_MINIGAME || XIAOMI || BAIDU || WECHAT_MINI_PROGRAM || BYTEDANCE) { // We're unable to grab the constructors of Alipay native image or canvas object. return !('_data' in imageSource); } diff --git a/platforms/minigame/platforms/bytedance/wrapper/engine/ImageAsset.js b/platforms/minigame/platforms/bytedance/wrapper/engine/ImageAsset.js deleted file mode 100644 index 78efdb19729..00000000000 --- a/platforms/minigame/platforms/bytedance/wrapper/engine/ImageAsset.js +++ /dev/null @@ -1,7 +0,0 @@ -if (cc.ImageAsset) { - Object.defineProperty(cc.ImageAsset.prototype, 'data', { - get () { - return (this._nativeData && this._nativeData._data) || this._nativeData; - }, - }); -} \ No newline at end of file diff --git a/platforms/minigame/platforms/bytedance/wrapper/engine/index.js b/platforms/minigame/platforms/bytedance/wrapper/engine/index.js index 26624d377e0..df2d40fbc2b 100644 --- a/platforms/minigame/platforms/bytedance/wrapper/engine/index.js +++ b/platforms/minigame/platforms/bytedance/wrapper/engine/index.js @@ -2,4 +2,3 @@ require('../fs-utils'); require('../../../../common/engine/index'); require('./VideoPlayer'); require('./Label'); -require('./ImageAsset');