mirror of https://github.com/axmolengine/axmol.git
Resolve local reference leak and function order
This commit is contained in:
parent
6b59dc24c7
commit
c96bd9a4df
|
@ -100,6 +100,21 @@ public:
|
|||
UNKNOWN
|
||||
};
|
||||
|
||||
/**
|
||||
* Enables or disables premultiplied alpha for PNG files.
|
||||
*
|
||||
* @param enabled (default: true)
|
||||
*/
|
||||
static void setPNGPremultipliedAlphaEnabled(bool enabled) { PNG_PREMULTIPLIED_ALPHA_ENABLED = enabled; }
|
||||
|
||||
/** treats (or not) PVR files as if they have alpha premultiplied.
|
||||
Since it is impossible to know at runtime if the PVR images have the alpha channel premultiplied, it is
|
||||
possible load them as if they have (or not) the alpha channel premultiplied.
|
||||
|
||||
By default it is disabled.
|
||||
*/
|
||||
static void setPVRImagesHavePremultipliedAlpha(bool haveAlphaPremultiplied);
|
||||
|
||||
/**
|
||||
@brief Load the image from the specified path.
|
||||
@param path the absolute file path.
|
||||
|
@ -145,21 +160,6 @@ public:
|
|||
*/
|
||||
bool saveToFile(const std::string &filename, bool isToRGB = true);
|
||||
|
||||
/**
|
||||
* Enables or disables premultiplied alpha for PNG files.
|
||||
*
|
||||
* @param enabled (default: true)
|
||||
*/
|
||||
static void setPNGPremultipliedAlphaEnabled(bool enabled) { PNG_PREMULTIPLIED_ALPHA_ENABLED = enabled; }
|
||||
|
||||
/** treats (or not) PVR files as if they have alpha premultiplied.
|
||||
Since it is impossible to know at runtime if the PVR images have the alpha channel premultiplied, it is
|
||||
possible load them as if they have (or not) the alpha channel premultiplied.
|
||||
|
||||
By default it is disabled.
|
||||
*/
|
||||
static void setPVRImagesHavePremultipliedAlpha(bool haveAlphaPremultiplied);
|
||||
|
||||
protected:
|
||||
#if defined(CC_USE_WIC)
|
||||
bool encodeWithWIC(const std::string& filePath, bool isToRGB, GUID containerFormat);
|
||||
|
|
|
@ -96,13 +96,19 @@ bool localStorageGetItem( const std::string& key, std::string *outItem )
|
|||
jstring jret = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID, jkey);
|
||||
if (jret == nullptr)
|
||||
{
|
||||
t.env->DeleteLocalRef(jret);
|
||||
t.env->DeleteLocalRef(jkey);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
return false;
|
||||
}
|
||||
outItem->assign(JniHelper::jstring2string(jret));
|
||||
t.env->DeleteLocalRef(jret);
|
||||
t.env->DeleteLocalRef(jkey);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
return true;
|
||||
else
|
||||
{
|
||||
outItem->assign(JniHelper::jstring2string(jret));
|
||||
t.env->DeleteLocalRef(jret);
|
||||
t.env->DeleteLocalRef(jkey);
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue