summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-05-15 11:30:21 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-15 11:30:21 -0700
commit769bccea292329e16fe6211e10cf54cf38896b1b (patch)
treeb29684f6d128c88d146b6eddc53d28c94322703c /libs
parentf0e5e27bf416e43dd1018a965c271ebb69080e54 (diff)
parentc9ade202ed6a43a4edba6596492aa810530b88b6 (diff)
downloadframeworks_base-769bccea292329e16fe6211e10cf54cf38896b1b.zip
frameworks_base-769bccea292329e16fe6211e10cf54cf38896b1b.tar.gz
frameworks_base-769bccea292329e16fe6211e10cf54cf38896b1b.tar.bz2
am c9ade202: Merge "Forget the name of a texture after freeing Bug #6408362" into jb-dev
* commit 'c9ade202ed6a43a4edba6596492aa810530b88b6': Forget the name of a texture after freeing Bug #6408362
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/FontRenderer.cpp12
-rw-r--r--libs/hwui/FontRenderer.h4
2 files changed, 10 insertions, 6 deletions
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index b7d09db..a0bf8e3 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -555,6 +555,7 @@ void FontRenderer::deallocateTextureMemory(CacheTexture *cacheTexture) {
glDeleteTextures(1, &cacheTexture->mTextureId);
delete[] cacheTexture->mTexture;
cacheTexture->mTexture = NULL;
+ cacheTexture->mTextureId = 0;
}
}
@@ -589,7 +590,13 @@ void FontRenderer::allocateTextureMemory(CacheTexture* cacheTexture) {
int height = cacheTexture->mHeight;
cacheTexture->mTexture = new uint8_t[width * height];
+#if DEBUG_FONT_RENDERER
memset(cacheTexture->mTexture, 0, width * height * sizeof(uint8_t));
+#endif
+
+ if (!cacheTexture->mTextureId) {
+ glGenTextures(1, &cacheTexture->mTextureId);
+ }
glBindTexture(GL_TEXTURE_2D, cacheTexture->mTextureId);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
@@ -680,11 +687,8 @@ void FontRenderer::cacheBitmap(const SkGlyph& glyph, CachedGlyphInfo* cachedGlyp
}
CacheTexture* FontRenderer::createCacheTexture(int width, int height, bool allocate) {
- GLuint textureId;
- glGenTextures(1, &textureId);
-
uint8_t* textureMemory = NULL;
- CacheTexture* cacheTexture = new CacheTexture(textureMemory, textureId, width, height);
+ CacheTexture* cacheTexture = new CacheTexture(textureMemory, width, height);
if (allocate) {
allocateTextureMemory(cacheTexture);
diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h
index 4de4af2..2ab680e 100644
--- a/libs/hwui/FontRenderer.h
+++ b/libs/hwui/FontRenderer.h
@@ -62,8 +62,8 @@ class FontRenderer;
class CacheTexture {
public:
CacheTexture() { }
- CacheTexture(uint8_t* texture, GLuint textureId, uint16_t width, uint16_t height) :
- mTexture(texture), mTextureId(textureId), mWidth(width), mHeight(height),
+ CacheTexture(uint8_t* texture, uint16_t width, uint16_t height) :
+ mTexture(texture), mTextureId(0), mWidth(width), mHeight(height),
mLinearFiltering(false) { }
~CacheTexture() {
if (mTexture) {