diff options
| author | Romain Guy <romainguy@google.com> | 2010-08-06 11:18:34 -0700 |
|---|---|---|
| committer | Romain Guy <romainguy@google.com> | 2010-08-06 11:18:34 -0700 |
| commit | 22158e139a3d6c6a9787ca0de224e9368f643284 (patch) | |
| tree | fac1da337f6fd11ef0761bd0a776af7f184b0ec7 /libs/hwui/OpenGLRenderer.cpp | |
| parent | ff0f973442d22ba6bb1231fb6e97e5f3051a7f48 (diff) | |
| download | frameworks_base-22158e139a3d6c6a9787ca0de224e9368f643284.zip frameworks_base-22158e139a3d6c6a9787ca0de224e9368f643284.tar.gz frameworks_base-22158e139a3d6c6a9787ca0de224e9368f643284.tar.bz2 | |
Automatically cleanup textures that don't fit in the cache.
Change-Id: I4f29ed96ea11118b391fb957e1e4d1b8fcef1537
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
| -rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index a72045b..db8c863 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -436,6 +436,8 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, float left, float top, const S } const Texture* texture = mTextureCache.get(bitmap); + const AutoTexture autoCleanup(texture); + drawTextureRect(left, top, right, bottom, texture, paint); } @@ -449,6 +451,8 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, const SkMatrix* matrix, const } const Texture* texture = mTextureCache.get(bitmap); + const AutoTexture autoCleanup(texture); + drawTextureRect(r.left, r.top, r.right, r.bottom, texture, paint); } @@ -461,6 +465,7 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, } const Texture* texture = mTextureCache.get(bitmap); + const AutoTexture autoCleanup(texture); const float width = texture->width; const float height = texture->height; @@ -484,6 +489,7 @@ void OpenGLRenderer::drawPatch(SkBitmap* bitmap, Res_png_9patch* patch, } const Texture* texture = mTextureCache.get(bitmap); + const AutoTexture autoCleanup(texture); int alpha; SkXfermode::Mode mode; @@ -610,7 +616,8 @@ void OpenGLRenderer::drawPath(SkPath* path, SkPaint* paint) { GLuint textureUnit = 0; glActiveTexture(gTextureUnits[textureUnit]); - PathTexture* texture = mPathCache.get(path, paint); + const PathTexture* texture = mPathCache.get(path, paint); + const AutoTexture autoCleanup(texture); int alpha; SkXfermode::Mode mode; |
