mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-04 18:42:40 +08:00
Sync branch v2.2.0 to v2.3.0
This commit is contained in:
@@ -47,6 +47,11 @@ extern "C" {
|
||||
JNIEXPORT jint JNICALL JNI_JSJAVABRIDGE(evalString)
|
||||
(JNIEnv *env, jclass cls, jstring value)
|
||||
{
|
||||
if (!se::ScriptEngine::getInstance()->isValid()) {
|
||||
CCLOG("ScriptEngine has not been initialized");
|
||||
return 0;
|
||||
}
|
||||
|
||||
se::AutoHandleScope hs;
|
||||
bool strFlag = false;
|
||||
std::string strValue = cocos2d::StringUtils::getStringUTFCharsJNI(env, value, &strFlag);
|
||||
|
||||
@@ -2509,7 +2509,7 @@ bool Data_to_seval(const cocos2d::Data& v, se::Value* ret)
|
||||
else
|
||||
{
|
||||
se::HandleObject obj(se::Object::createTypedArray(se::Object::TypedArrayType::UINT8, v.getBytes(), v.getSize()));
|
||||
ret->setObject(obj);
|
||||
ret->setObject(obj, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -849,13 +849,12 @@ bool jsb_global_load_image(const std::string& path, const se::Value& callbackVal
|
||||
Application::getInstance()->getScheduler()->performFunctionInCocosThread([=](){
|
||||
se::AutoHandleScope hs;
|
||||
se::ValueArray seArgs;
|
||||
|
||||
se::Value dataVal;
|
||||
if (loadSucceed)
|
||||
{
|
||||
se::HandleObject retObj(se::Object::createPlainObject());
|
||||
Data data;
|
||||
data.copy(imgInfo->data, imgInfo->length);
|
||||
se::Value dataVal;
|
||||
Data_to_seval(data, &dataVal);
|
||||
retObj->setProperty("data", dataVal);
|
||||
retObj->setProperty("width", se::Value(imgInfo->width));
|
||||
|
||||
Reference in New Issue
Block a user