diff options
author | Chet Haase <chet@google.com> | 2011-12-16 15:44:59 -0800 |
---|---|---|
committer | Chet Haase <chet@google.com> | 2011-12-16 15:44:59 -0800 |
commit | 9a8245629d69d81e0b62e52970feaf9c02580e75 (patch) | |
tree | 3aa17c76e6a1b2d4abde5bfe75640c2dcc08d5d9 /libs/hwui/FontRenderer.h | |
parent | 6a6da2c9719c6942246d50833e04ee48f9fb2b03 (diff) | |
download | frameworks_base-9a8245629d69d81e0b62e52970feaf9c02580e75.zip frameworks_base-9a8245629d69d81e0b62e52970feaf9c02580e75.tar.gz frameworks_base-9a8245629d69d81e0b62e52970feaf9c02580e75.tar.bz2 |
De-allocate caches for large glyphs when trimming memory
Currently, font renderers eliminate some texture caches when
memory is trimmed. This change makes it go further by eliminating the
large-glyph caches for all font renderers. These caches are
only allocated as needed, but continue to consume large amounts of
memory (CPU and GPU) after that allocation. De-allocating this memory
on a trim operation should prevent background apps from holding onto
this memory in the possible case that they have allocated it by drawing
large glyphs.
Change-Id: Id7a3ab49b244e036b442d87252fb40aeca8fdb26
Diffstat (limited to 'libs/hwui/FontRenderer.h')
-rw-r--r-- | libs/hwui/FontRenderer.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h index 9f32747..005cdde 100644 --- a/libs/hwui/FontRenderer.h +++ b/libs/hwui/FontRenderer.h @@ -180,7 +180,7 @@ protected: // Cache of glyphs DefaultKeyedVector<glyph_t, CachedGlyphInfo*> mCachedGlyphs; - void invalidateTextureCache(); + void invalidateTextureCache(CacheTextureLine *cacheLine = NULL); CachedGlyphInfo* cacheGlyph(SkPaint* paint, glyph_t glyph); void updateGlyphCache(SkPaint* paint, const SkGlyph& skiaGlyph, CachedGlyphInfo *glyph); @@ -219,6 +219,7 @@ public: void init(); void deinit(); + void flushLargeCaches(); void setGammaTable(const uint8_t* gammaTable) { mGammaTable = gammaTable; @@ -286,6 +287,7 @@ protected: const uint8_t* mGammaTable; void allocateTextureMemory(CacheTexture* cacheTexture); + void deallocateTextureMemory(CacheTexture* cacheTexture); void initTextTexture(); CacheTexture *createCacheTexture(int width, int height, bool allocate); void cacheBitmap(const SkGlyph& glyph, CachedGlyphInfo* cachedGlyph, |