From 0aa87bbfc41e8b5f52de701ac17b4e66a7a7b609 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Fri, 20 Jul 2012 11:14:32 -0700 Subject: [PATCH] Fix crash with new LookupGammaFontRenderer Bug #6853934 Change-Id: I15e6ca73bfe00eff1a37c4b9d2f7f709ee018eb6 --- libs/hwui/FontRenderer.cpp | 3 +-- libs/hwui/FontRenderer.h | 5 ++--- libs/hwui/GammaFontRenderer.h | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp index 3b3691c637d16..eeb37cbe08c1c 100644 --- a/libs/hwui/FontRenderer.cpp +++ b/libs/hwui/FontRenderer.cpp @@ -697,8 +697,7 @@ void FontRenderer::cacheBitmap(const SkGlyph& glyph, CachedGlyphInfo* cachedGlyp } CacheTexture* FontRenderer::createCacheTexture(int width, int height, bool allocate) { - uint8_t* textureMemory = NULL; - CacheTexture* cacheTexture = new CacheTexture(textureMemory, width, height); + CacheTexture* cacheTexture = new CacheTexture(width, height); if (allocate) { allocateTextureMemory(cacheTexture); diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h index 2ab680e0e3794..b7b4ec9683f9f 100644 --- a/libs/hwui/FontRenderer.h +++ b/libs/hwui/FontRenderer.h @@ -61,9 +61,8 @@ class FontRenderer; class CacheTexture { public: - CacheTexture() { } - CacheTexture(uint8_t* texture, uint16_t width, uint16_t height) : - mTexture(texture), mTextureId(0), mWidth(width), mHeight(height), + CacheTexture(uint16_t width, uint16_t height) : + mTexture(NULL), mTextureId(0), mWidth(width), mHeight(height), mLinearFiltering(false) { } ~CacheTexture() { if (mTexture) { diff --git a/libs/hwui/GammaFontRenderer.h b/libs/hwui/GammaFontRenderer.h index 9180778e9aa9b..c4a50bed3ad2a 100644 --- a/libs/hwui/GammaFontRenderer.h +++ b/libs/hwui/GammaFontRenderer.h @@ -59,6 +59,7 @@ public: void clear() { delete mRenderer; + mRenderer = NULL; } void flush() {