From 48a8f431fa52ae2ee25ffba9d20676f03bb710ff Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Fri, 5 Feb 2016 15:59:29 -0800 Subject: Move several property queries to Properties class bug:17478770 This removes a lot of redundant property query code, and puts the queries all in one place, so defining them automatically will be simpler in the future. Change-Id: I0428550e6081f07bc6554ffdf73b22284325abb8 --- libs/hwui/TextureCache.cpp | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) (limited to 'libs/hwui/TextureCache.cpp') diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp index 31bfa3a1ada4..ade8600ab78b 100644 --- a/libs/hwui/TextureCache.cpp +++ b/libs/hwui/TextureCache.cpp @@ -35,26 +35,9 @@ namespace uirenderer { TextureCache::TextureCache() : mCache(LruCache::kUnlimitedCapacity) , mSize(0) - , mMaxSize(MB(DEFAULT_TEXTURE_CACHE_SIZE)) - , mFlushRate(DEFAULT_TEXTURE_CACHE_FLUSH_RATE) + , mMaxSize(Properties::textureCacheSize) + , mFlushRate(Properties::textureCacheFlushRate) , mAssetAtlas(nullptr) { - char property[PROPERTY_VALUE_MAX]; - if (property_get(PROPERTY_TEXTURE_CACHE_SIZE, property, nullptr) > 0) { - INIT_LOGD(" Setting texture cache size to %sMB", property); - setMaxSize(MB(atof(property))); - } else { - INIT_LOGD(" Using default texture cache size of %.2fMB", DEFAULT_TEXTURE_CACHE_SIZE); - } - - if (property_get(PROPERTY_TEXTURE_CACHE_FLUSH_RATE, property, nullptr) > 0) { - float flushRate = atof(property); - INIT_LOGD(" Setting texture cache flush rate to %.2f%%", flushRate * 100.0f); - setFlushRate(flushRate); - } else { - INIT_LOGD(" Using default texture cache flush rate of %.2f%%", - DEFAULT_TEXTURE_CACHE_FLUSH_RATE * 100.0f); - } - mCache.setOnEntryRemovedListener(this); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); @@ -79,17 +62,6 @@ uint32_t TextureCache::getMaxSize() { return mMaxSize; } -void TextureCache::setMaxSize(uint32_t maxSize) { - mMaxSize = maxSize; - while (mSize > mMaxSize) { - mCache.removeOldest(); - } -} - -void TextureCache::setFlushRate(float flushRate) { - mFlushRate = std::max(0.0f, std::min(1.0f, flushRate)); -} - /////////////////////////////////////////////////////////////////////////////// // Callbacks /////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3-59-g8ed1b