diff options
| author | Chet Haase <chet@google.com> | 2012-08-31 15:57:27 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-08-31 15:57:28 -0700 |
| commit | ce20a45e03c2748e79daea187f7d21c33bdfe643 (patch) | |
| tree | cb8e29005a6764e8cd829c77426b1d3423073848 | |
| parent | f83ec838915c13158ddfda0cf4da5865b260b9c6 (diff) | |
| parent | eb32a499194119b3783b86c925172df02e5d2685 (diff) | |
| download | frameworks_base-ce20a45e03c2748e79daea187f7d21c33bdfe643.zip frameworks_base-ce20a45e03c2748e79daea187f7d21c33bdfe643.tar.gz frameworks_base-ce20a45e03c2748e79daea187f7d21c33bdfe643.tar.bz2 | |
Merge "Paramaterize and adjust the glyph cache sizes" into jb-mr1-dev
| -rw-r--r-- | libs/hwui/FontRenderer.cpp | 66 | ||||
| -rw-r--r-- | libs/hwui/FontRenderer.h | 2 | ||||
| -rw-r--r-- | libs/hwui/Properties.h | 6 |
3 files changed, 37 insertions, 37 deletions
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp index 6b08e7f..95ccdfc 100644 --- a/libs/hwui/FontRenderer.cpp +++ b/libs/hwui/FontRenderer.cpp @@ -34,9 +34,10 @@ namespace uirenderer { // Defines /////////////////////////////////////////////////////////////////////////////// -#define DEFAULT_TEXT_CACHE_WIDTH 1024 -#define DEFAULT_TEXT_CACHE_HEIGHT 256 -#define MAX_TEXT_CACHE_WIDTH 2048 +#define DEFAULT_TEXT_SMALL_CACHE_WIDTH 1024 +#define DEFAULT_TEXT_SMALL_CACHE_HEIGHT 256 +#define DEFAULT_TEXT_LARGE_CACHE_WIDTH 2048 +#define DEFAULT_TEXT_LARGE_CACHE_HEIGHT 512 #define CACHE_BLOCK_ROUNDING_SIZE 4 #define AUTO_KERN(prev, next) (((next) - (prev) + 32) >> 6 << 16) @@ -626,30 +627,35 @@ FontRenderer::FontRenderer() { mIndexBufferID = 0; - mSmallCacheWidth = DEFAULT_TEXT_CACHE_WIDTH; - mSmallCacheHeight = DEFAULT_TEXT_CACHE_HEIGHT; + mSmallCacheWidth = DEFAULT_TEXT_SMALL_CACHE_WIDTH; + mSmallCacheHeight = DEFAULT_TEXT_SMALL_CACHE_HEIGHT; + mLargeCacheWidth = DEFAULT_TEXT_LARGE_CACHE_WIDTH; + mLargeCacheHeight = DEFAULT_TEXT_LARGE_CACHE_HEIGHT; char property[PROPERTY_VALUE_MAX]; - if (property_get(PROPERTY_TEXT_CACHE_WIDTH, property, NULL) > 0) { - if (sLogFontRendererCreate) { - INIT_LOGD(" Setting text cache width to %s pixels", property); - } + if (property_get(PROPERTY_TEXT_SMALL_CACHE_WIDTH, property, NULL) > 0) { mSmallCacheWidth = atoi(property); - } else { - if (sLogFontRendererCreate) { - INIT_LOGD(" Using default text cache width of %i pixels", mSmallCacheWidth); - } } - - if (property_get(PROPERTY_TEXT_CACHE_HEIGHT, property, NULL) > 0) { - if (sLogFontRendererCreate) { - INIT_LOGD(" Setting text cache width to %s pixels", property); - } + if (property_get(PROPERTY_TEXT_SMALL_CACHE_HEIGHT, property, NULL) > 0) { mSmallCacheHeight = atoi(property); - } else { - if (sLogFontRendererCreate) { - INIT_LOGD(" Using default text cache height of %i pixels", mSmallCacheHeight); - } + } + if (property_get(PROPERTY_TEXT_LARGE_CACHE_WIDTH, property, NULL) > 0) { + mLargeCacheWidth = atoi(property); + } + if (property_get(PROPERTY_TEXT_LARGE_CACHE_HEIGHT, property, NULL) > 0) { + mLargeCacheHeight = atoi(property); + } + GLint maxTextureSize = Caches::getInstance().maxTextureSize; + mSmallCacheWidth = (mSmallCacheWidth > maxTextureSize) ? maxTextureSize : mSmallCacheWidth; + mSmallCacheHeight = (mSmallCacheHeight > maxTextureSize) ? maxTextureSize : mSmallCacheHeight; + mLargeCacheWidth = (mLargeCacheWidth > maxTextureSize) ? maxTextureSize : mLargeCacheWidth; + mLargeCacheHeight = (mLargeCacheHeight > maxTextureSize) ? maxTextureSize : mLargeCacheHeight; + if (sLogFontRendererCreate) { + INIT_LOGD(" Text cache sizes, in pixels: %i x %i, %i x %i, %i x %i, %i x %i", + mSmallCacheWidth, mSmallCacheHeight, + mLargeCacheWidth, mLargeCacheHeight >> 1, + mLargeCacheWidth, mLargeCacheHeight >> 1, + mLargeCacheWidth, mLargeCacheHeight); } sLogFontRendererCreate = false; @@ -861,21 +867,11 @@ void FontRenderer::initTextTexture() { } mCacheTextures.clear(); - // Next, use other, separate caches for large glyphs. - uint16_t maxWidth = 0; - if (Caches::hasInstance()) { - maxWidth = Caches::getInstance().maxTextureSize; - } - - if (maxWidth > MAX_TEXT_CACHE_WIDTH || maxWidth == 0) { - maxWidth = MAX_TEXT_CACHE_WIDTH; - } - mUploadTexture = false; mCacheTextures.push(createCacheTexture(mSmallCacheWidth, mSmallCacheHeight, true)); - mCacheTextures.push(createCacheTexture(maxWidth, 256, false)); - mCacheTextures.push(createCacheTexture(maxWidth, 256, false)); - mCacheTextures.push(createCacheTexture(maxWidth, 512, false)); + mCacheTextures.push(createCacheTexture(mLargeCacheWidth, mLargeCacheHeight >> 1, false)); + mCacheTextures.push(createCacheTexture(mLargeCacheWidth, mLargeCacheHeight >> 1, false)); + mCacheTextures.push(createCacheTexture(mLargeCacheWidth, mLargeCacheHeight, false)); mCurrentCacheTexture = mCacheTextures[0]; } diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h index 8d0d21d..241b73e 100644 --- a/libs/hwui/FontRenderer.h +++ b/libs/hwui/FontRenderer.h @@ -391,6 +391,8 @@ protected: uint32_t mSmallCacheWidth; uint32_t mSmallCacheHeight; + uint32_t mLargeCacheWidth; + uint32_t mLargeCacheHeight; Vector<CacheTexture*> mCacheTextures; diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h index 6b6dc9e..0e3268e 100644 --- a/libs/hwui/Properties.h +++ b/libs/hwui/Properties.h @@ -74,8 +74,10 @@ enum DebugLevel { #define PROPERTY_TEXTURE_CACHE_FLUSH_RATE "ro.hwui.texture_cache_flush_rate" // These properties are defined in pixels -#define PROPERTY_TEXT_CACHE_WIDTH "ro.hwui.text_cache_width" -#define PROPERTY_TEXT_CACHE_HEIGHT "ro.hwui.text_cache_height" +#define PROPERTY_TEXT_SMALL_CACHE_WIDTH "ro.hwui.text_small_cache_width" +#define PROPERTY_TEXT_SMALL_CACHE_HEIGHT "ro.hwui.text_small_cache_height" +#define PROPERTY_TEXT_LARGE_CACHE_WIDTH "ro.hwui.text_large_cache_width" +#define PROPERTY_TEXT_LARGE_CACHE_HEIGHT "ro.hwui.text_large_cache_height" // Indicates whether gamma correction should be applied in the shaders // or in lookup tables. Accepted values: |
