small optimisation

This commit is contained in:
Yoshman29
2023-04-17 15:12:07 +02:00
parent 33f0bc70eb
commit 540c52c13a
+5 -4
View File
@@ -172,11 +172,12 @@ class Paths
* @param library (Additional) library to load the frames from.
*/
public static function getFrames(key:String, assetsPath:Bool = false, ?library:String) {
if (tempFramesCache[key] != null) {
if (tempFramesCache[key].parent != null && tempFramesCache[key].parent.bitmap != null && tempFramesCache[key].parent.bitmap.readable)
return tempFramesCache[key];
if (tempFramesCache.exists(key)) {
var frames = tempFramesCache[key];
if (frames.parent != null && frames.parent.bitmap != null && frames.parent.bitmap.readable)
return frames;
else
tempFramesCache[key] = null;
tempFramesCache.remove(key);
}
return tempFramesCache[key] = loadFrames(assetsPath ? key : Paths.image(key, library, true));
}