diff options
| author | Romain Guy <romainguy@android.com> | 2010-08-07 23:46:15 -0700 |
|---|---|---|
| committer | Romain Guy <romainguy@android.com> | 2010-08-07 23:48:29 -0700 |
| commit | 9cccc2b9bdd4850a3f9679569aaec3ab98477a5d (patch) | |
| tree | 365c32954d65cf037c948ee92b14ed30243319f5 /libs/hwui/OpenGLRenderer.cpp | |
| parent | de0547c07a65b59d5330588cdd8b1e410a613e9c (diff) | |
| download | frameworks_base-9cccc2b9bdd4850a3f9679569aaec3ab98477a5d.zip frameworks_base-9cccc2b9bdd4850a3f9679569aaec3ab98477a5d.tar.gz frameworks_base-9cccc2b9bdd4850a3f9679569aaec3ab98477a5d.tar.bz2 | |
Enforce maximum texture size.
When an app tries to render a bitmap or path larger than the GPU's maximum
texture size, the drawing command is ignored and a warning is logged. This
change also makes texture drawing more robust by catching potential errors
during texture creation.
This change also fixes a crash in the FontRenderer. The destructor would
sometimes try to free an uninitialized array.
Change-Id: I95ae0939c52192d97b340aa02417bf6d0c962c57
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
| -rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index db8c863..5d30b1a 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -436,6 +436,7 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, float left, float top, const S } const Texture* texture = mTextureCache.get(bitmap); + if (!texture) return; const AutoTexture autoCleanup(texture); drawTextureRect(left, top, right, bottom, texture, paint); @@ -451,6 +452,7 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, const SkMatrix* matrix, const } const Texture* texture = mTextureCache.get(bitmap); + if (!texture) return; const AutoTexture autoCleanup(texture); drawTextureRect(r.left, r.top, r.right, r.bottom, texture, paint); @@ -465,6 +467,7 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap, } const Texture* texture = mTextureCache.get(bitmap); + if (!texture) return; const AutoTexture autoCleanup(texture); const float width = texture->width; @@ -489,6 +492,7 @@ void OpenGLRenderer::drawPatch(SkBitmap* bitmap, Res_png_9patch* patch, } const Texture* texture = mTextureCache.get(bitmap); + if (!texture) return; const AutoTexture autoCleanup(texture); int alpha; @@ -617,6 +621,7 @@ void OpenGLRenderer::drawPath(SkPath* path, SkPaint* paint) { glActiveTexture(gTextureUnits[textureUnit]); const PathTexture* texture = mPathCache.get(path, paint); + if (!texture) return; const AutoTexture autoCleanup(texture); int alpha; |
