mirror of https://github.com/axmolengine/axmol.git
Remove unnecessary DeleteLocalRef (?) and clean up checking code
This commit is contained in:
parent
210cf68cab
commit
f3141826b2
|
@ -17,28 +17,31 @@ namespace CocosDenshion {
|
|||
#define METHOD_NAME "getDeviceModel"
|
||||
|
||||
bool is_buggy_device(void) {
|
||||
bool buggydevice = false;
|
||||
|
||||
JniMethodInfo methodInfo;
|
||||
jstring jstr;
|
||||
if (JniHelper::getStaticMethodInfo(methodInfo, CLASS_NAME, METHOD_NAME, "()Ljava/lang/String;"))
|
||||
{
|
||||
jstr = (jstring)methodInfo.env->CallStaticObjectMethod(methodInfo.classID, methodInfo.methodID);
|
||||
}
|
||||
methodInfo.env->DeleteLocalRef(methodInfo.classID);
|
||||
|
||||
const char* deviceModel = methodInfo.env->GetStringUTFChars(jstr, NULL);
|
||||
LOGD("%s", deviceModel);
|
||||
|
||||
if (strcmp(I9100_MODEL, deviceModel) == 0) {
|
||||
LOGD("i9100 model\nSwitch to OpenSLES");
|
||||
buggydevice = true;
|
||||
if (JniHelper::getStaticMethodInfo(methodInfo,
|
||||
CLASS_NAME,
|
||||
METHOD_NAME,
|
||||
"()Ljava/lang/String;")) {
|
||||
jstr = (jstring)methodInfo.env->CallStaticObjectMethod(methodInfo.classID,
|
||||
methodInfo.methodID);
|
||||
}
|
||||
|
||||
const char* deviceModel = methodInfo.env->GetStringUTFChars(jstr, NULL);
|
||||
if (NULL == deviceModel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LOGD("deviceModel = %s", deviceModel);
|
||||
methodInfo.env->ReleaseStringUTFChars(jstr, deviceModel);
|
||||
methodInfo.env->DeleteLocalRef(jstr);
|
||||
|
||||
return buggydevice;
|
||||
if (strcmp(I9100_MODEL, deviceModel) == 0) {
|
||||
LOGD("i9100 model\nSwitch to OpenSLES");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string getFullPathWithoutAssetsPrefix(const char* pszFilename) {
|
||||
|
|
Loading…
Reference in New Issue