mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
fix some bugs (#3581)
This commit is contained in:
@@ -224,10 +224,10 @@ public:
|
||||
if (_bufferWidth < 1.0F || _bufferHeight < 1.0F) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto arr = JniHelper::getEnv()->NewIntArray(imageData.getSize()/ 4);
|
||||
JniHelper::getEnv()->SetIntArrayRegion(arr, 0, imageData.getSize()/4,
|
||||
reinterpret_cast<const jint *>(imageData.getBytes()));
|
||||
|
||||
auto arr = JniHelper::getEnv()->NewIntArray(imageData.getSize() / 4);
|
||||
JniHelper::getEnv()->SetIntArrayRegion(arr, 0, imageData.getSize() / 4,
|
||||
reinterpret_cast<const jint *>(imageData.getBytes()));
|
||||
JniHelper::callObjectVoidMethod(_obj, JCLS_CANVASIMPL, "_fillImageData", arr, imageWidth,
|
||||
imageHeight, offsetX, offsetY);
|
||||
ccDeleteLocalRef(JniHelper::getEnv(), arr);
|
||||
@@ -269,7 +269,9 @@ public:
|
||||
jsize len = JniHelper::getEnv()->GetArrayLength(arr);
|
||||
auto *jbarray = static_cast<jbyte *>(malloc(len * sizeof(jbyte)));
|
||||
JniHelper::getEnv()->GetByteArrayRegion(arr, 0, len, jbarray);
|
||||
#if CC_PLATFORM != CC_PLATFORM_OHOS
|
||||
unMultiplyAlpha(reinterpret_cast<unsigned char *>(jbarray), len);
|
||||
#endif
|
||||
_data.fastSet(reinterpret_cast<unsigned char *>(jbarray), len); //IDEA: DON'T create new jbarray every time.
|
||||
ccDeleteLocalRef(JniHelper::getEnv(), arr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user