summaryrefslogtreecommitdiff
path: root/libs/hwui/renderstate/RenderState.cpp
diff options
context:
space:
mode:
authorDohyun Lee <leedhyun11@gmail.com>2016-01-21 13:46:21 +0900
committerDohyun Lee <leedhyun11@gmail.com>2016-01-21 13:46:21 +0900
commitc5a3efd28668a62df3e3b364b49624c5af7549b6 (patch)
treefa83fe7b5d8c7afcd120925bfe8c1a22b0ce8fcb /libs/hwui/renderstate/RenderState.cpp
parent168f2e556b7222fd0dab7eadc4ceee2eca13be1a (diff)
libhwui: fix texture memory leak
When there is not enough space and we cannot delete any Texture in TextureCache to secure space, a new Texture is created over and over again for the same SkBitmap and there is the case that it is not deleted. This patch avoids such cases. Change-Id: Ic5353995e6d0716c31fe3bb49c60ec1a71574643 Signed-off-by: Dohyun Lee <leedhyun11@gmail.com>
Diffstat (limited to 'libs/hwui/renderstate/RenderState.cpp')
-rw-r--r--libs/hwui/renderstate/RenderState.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libs/hwui/renderstate/RenderState.cpp b/libs/hwui/renderstate/RenderState.cpp
index 1e39bfa4b583..84b696596d40 100644
--- a/libs/hwui/renderstate/RenderState.cpp
+++ b/libs/hwui/renderstate/RenderState.cpp
@@ -306,6 +306,10 @@ void RenderState::render(const Glop& glop) {
// Shader uniforms
SkiaShader::apply(*mCaches, fill.skiaShaderData);
+ Texture* texture = (fill.skiaShaderData.skiaShaderType & kBitmap_SkiaShaderType) ?
+ fill.skiaShaderData.bitmapData.bitmapTexture : nullptr;
+ const AutoTexture autoCleanup(texture);
+
// ------------------------------------
// ---------- GL state setup ----------
// ------------------------------------