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/SkiaShader.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/SkiaShader.cpp')
| -rw-r--r-- | libs/hwui/SkiaShader.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/hwui/SkiaShader.cpp b/libs/hwui/SkiaShader.cpp index ffdb348..42c0621 100644 --- a/libs/hwui/SkiaShader.cpp +++ b/libs/hwui/SkiaShader.cpp @@ -75,11 +75,13 @@ void SkiaShader::bindTexture(GLuint texture, GLenum wrapS, GLenum wrapT, GLuint SkiaBitmapShader::SkiaBitmapShader(SkBitmap* bitmap, SkShader* key, SkShader::TileMode tileX, SkShader::TileMode tileY, SkMatrix* matrix, bool blend): - SkiaShader(kBitmap, key, tileX, tileY, matrix, blend), mBitmap(bitmap) { + SkiaShader(kBitmap, key, tileX, tileY, matrix, blend), mBitmap(bitmap), mTexture(NULL) { } void SkiaBitmapShader::describe(ProgramDescription& description, const Extensions& extensions) { const Texture* texture = mTextureCache->get(mBitmap); + if (!texture) return; + mTexture = texture; const float width = texture->width; const float height = texture->height; @@ -98,7 +100,11 @@ void SkiaBitmapShader::setupProgram(Program* program, const mat4& modelView, const Snapshot& snapshot, GLuint* textureUnit) { GLuint textureSlot = (*textureUnit)++; glActiveTexture(gTextureUnitsMap[textureSlot]); - const Texture* texture = mTextureCache->get(mBitmap); + + const Texture* texture = mTexture; + mTexture = NULL; + if (!texture) return; + const AutoTexture autoCleanup(texture); const float width = texture->width; const float height = texture->height; |
