diff options
author | 2017-11-14 12:31:11 -0800 | |
---|---|---|
committer | 2017-11-14 12:31:11 -0800 | |
commit | 220871a697290529278ed16db508eda8e12f3fc7 (patch) | |
tree | bc13101b63c6fe39a9d92706ecb7ded7f98f5a9c /libs/hwui/FontRenderer.cpp | |
parent | 802f191b2b84a1b1b82c7f6f3268846084b35dfb (diff) | |
parent | 98e12851336b7db16e583f9afac63ecc97465980 (diff) |
Merge commit '98e12851336b7db16e583f9afac63ecc97465980' from
oc-mr1-dev-plus-aosp-without-vendor into stage-aosp-master.
Change-Id: Ia7b8da4a00d215160e4a4fa40f6044208d1297b7
Merged-In: I19846d2a3ee27aecbae2367a74ee49082eea154d
Diffstat (limited to 'libs/hwui/FontRenderer.cpp')
-rw-r--r-- | libs/hwui/FontRenderer.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp index ee99018fb652..8b0346867cbc 100644 --- a/libs/hwui/FontRenderer.cpp +++ b/libs/hwui/FontRenderer.cpp @@ -32,7 +32,6 @@ #include "utils/Timing.h" #include <algorithm> -#include <cutils/properties.h> #include <RenderScript.h> #include <SkGlyph.h> #include <SkUtils.h> @@ -99,22 +98,23 @@ FontRenderer::FontRenderer(const uint8_t* gammaTable) INIT_LOGD("Creating FontRenderer"); } - mSmallCacheWidth = property_get_int32(PROPERTY_TEXT_SMALL_CACHE_WIDTH, - DEFAULT_TEXT_SMALL_CACHE_WIDTH); - mSmallCacheHeight = property_get_int32(PROPERTY_TEXT_SMALL_CACHE_HEIGHT, - DEFAULT_TEXT_SMALL_CACHE_HEIGHT); + auto deviceInfo = DeviceInfo::get(); + auto displayInfo = deviceInfo->displayInfo(); + int maxTextureSize = deviceInfo->maxTextureSize(); - mLargeCacheWidth = property_get_int32(PROPERTY_TEXT_LARGE_CACHE_WIDTH, - DEFAULT_TEXT_LARGE_CACHE_WIDTH); - mLargeCacheHeight = property_get_int32(PROPERTY_TEXT_LARGE_CACHE_HEIGHT, - DEFAULT_TEXT_LARGE_CACHE_HEIGHT); + // Adjust cache size based on Pixel's desnsity. + constexpr float PIXEL_DENSITY = 2.6; + const float densityRatio = displayInfo.density / PIXEL_DENSITY; - uint32_t maxTextureSize = (uint32_t) Caches::getInstance().maxTextureSize; - - mSmallCacheWidth = std::min(mSmallCacheWidth, maxTextureSize); - mSmallCacheHeight = std::min(mSmallCacheHeight, maxTextureSize); - mLargeCacheWidth = std::min(mLargeCacheWidth, maxTextureSize); - mLargeCacheHeight = std::min(mLargeCacheHeight, maxTextureSize); + // TODO: Most devices are hardcoded with this configuration, does it need to be dynamic? + mSmallCacheWidth = + OffscreenBuffer::computeIdealDimension(std::min(1024, maxTextureSize) * densityRatio); + mSmallCacheHeight = + OffscreenBuffer::computeIdealDimension(std::min(1024, maxTextureSize) * densityRatio); + mLargeCacheWidth = + OffscreenBuffer::computeIdealDimension(std::min(2048, maxTextureSize) * densityRatio); + mLargeCacheHeight = + OffscreenBuffer::computeIdealDimension(std::min(1024, maxTextureSize) * densityRatio); if (sLogFontRendererCreate) { INIT_LOGD(" Text cache sizes, in pixels: %i x %i, %i x %i, %i x %i, %i x %i", |