summaryrefslogtreecommitdiffstats
path: root/cmds/bootanimation/BootAnimation.cpp
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2014-04-30 17:36:10 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-04-30 17:36:10 +0000
commit52adfdaafd464348628d9257101f24a67d7c8bbb (patch)
tree06e21eb893fdcdee82e81a8de2b8adc88a7e8479 /cmds/bootanimation/BootAnimation.cpp
parent10882ec8d7890c7d5712e6b7f23e007e09bd0062 (diff)
parent516130ccb1841afb6ef154c28269d91594925429 (diff)
downloadframeworks_base-52adfdaafd464348628d9257101f24a67d7c8bbb.zip
frameworks_base-52adfdaafd464348628d9257101f24a67d7c8bbb.tar.gz
frameworks_base-52adfdaafd464348628d9257101f24a67d7c8bbb.tar.bz2
am 516130cc: am dbbf431b: am d0f7f418: Merge "Freeing frame map"
* commit '516130ccb1841afb6ef154c28269d91594925429': Freeing frame map
Diffstat (limited to 'cmds/bootanimation/BootAnimation.cpp')
-rw-r--r--cmds/bootanimation/BootAnimation.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index 1780e03..3dc024e 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -156,12 +156,12 @@ status_t BootAnimation::initTexture(Texture* texture, AssetManager& assets,
return NO_ERROR;
}
-status_t BootAnimation::initTexture(void* buffer, size_t len)
+status_t BootAnimation::initTexture(const Animation::Frame& frame)
{
//StopWatch watch("blah");
SkBitmap bitmap;
- SkMemoryStream stream(buffer, len);
+ SkMemoryStream stream(frame.map->getDataPtr(), frame.map->getDataLength());
SkImageDecoder* codec = SkImageDecoder::Factory(&stream);
if (codec) {
codec->setDitherImage(false);
@@ -171,6 +171,11 @@ status_t BootAnimation::initTexture(void* buffer, size_t len)
delete codec;
}
+ // FileMap memory is never released until application exit.
+ // Release it now as the texture is already loaded and the memory used for
+ // the packed resource can be released.
+ frame.map->release();
+
// ensure we can call getPixels(). No need to call unlock, since the
// bitmap will go out of scope when we return from this method.
bitmap.lockPixels();
@@ -409,6 +414,7 @@ bool BootAnimation::movie()
String8 desString((char const*)descMap->getDataPtr(),
descMap->getDataLength());
+ descMap->release();
char const* s = desString.string();
Animation animation;
@@ -533,9 +539,7 @@ bool BootAnimation::movie()
glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
- initTexture(
- frame.map->getDataPtr(),
- frame.map->getDataLength());
+ initTexture(frame);
}
if (!clearReg.isEmpty()) {