diff options
author | Xin Li <delphij@google.com> | 2017-11-14 12:31:11 -0800 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2017-11-14 12:31:11 -0800 |
commit | 220871a697290529278ed16db508eda8e12f3fc7 (patch) | |
tree | bc13101b63c6fe39a9d92706ecb7ded7f98f5a9c /libs/hwui/PathCache.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/PathCache.cpp')
-rw-r--r-- | libs/hwui/PathCache.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp index cc96de71df82..8d4ae1b6622a 100644 --- a/libs/hwui/PathCache.cpp +++ b/libs/hwui/PathCache.cpp @@ -38,6 +38,8 @@ namespace android { namespace uirenderer { +static constexpr size_t PATH_CACHE_COUNT_LIMIT = 256; + template <class T> static bool compareWidthHeight(const T& lhs, const T& rhs) { return (lhs.mWidth == rhs.mWidth) && (lhs.mHeight == rhs.mHeight); @@ -179,13 +181,9 @@ static sk_sp<Bitmap> drawPath(const SkPath* path, const SkPaint* paint, PathText PathCache::PathCache() : mCache(LruCache<PathDescription, PathTexture*>::kUnlimitedCapacity) , mSize(0) - , mMaxSize(Properties::pathCacheSize) { + , mMaxSize(DeviceInfo::multiplyByResolution(4)) { mCache.setOnEntryRemovedListener(this); - - GLint maxTextureSize; - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); - mMaxTextureSize = maxTextureSize; - + mMaxTextureSize = DeviceInfo::get()->maxTextureSize(); mDebugEnabled = Properties::debugLevel & kDebugCaches; } @@ -259,12 +257,7 @@ void PathCache::purgeCache(uint32_t width, uint32_t height) { } void PathCache::trim() { - // 25 is just an arbitrary lower bound to ensure we aren't in weird edge cases - // of things like a cap of 0 or 1 as that's going to break things. - // It does not represent a reasonable minimum value - static_assert(DEFAULT_PATH_TEXTURE_CAP > 25, "Path cache texture cap is too small"); - - while (mSize > mMaxSize || mCache.size() > DEFAULT_PATH_TEXTURE_CAP) { + while (mSize > mMaxSize || mCache.size() > PATH_CACHE_COUNT_LIMIT) { LOG_ALWAYS_FATAL_IF(!mCache.size(), "Inconsistent mSize! Ran out of items to remove!" " mSize = %u, mMaxSize = %u", mSize, mMaxSize); mCache.removeOldest(); |