summaryrefslogtreecommitdiff
path: root/libs/hwui/TextDropShadowCache.cpp
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2016-02-05 15:59:29 -0800
committerChris Craik <ccraik@google.com>2016-02-05 17:38:22 -0800
commit48a8f431fa52ae2ee25ffba9d20676f03bb710ff (patch)
tree2c8e1e8684320f2cd85d058aaa0f6789a4016105 /libs/hwui/TextDropShadowCache.cpp
parent37fd29f2842c4b92ba3ddbba2f9a5024ce103783 (diff)
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
Diffstat (limited to 'libs/hwui/TextDropShadowCache.cpp')
-rw-r--r--libs/hwui/TextDropShadowCache.cpp38
1 files changed, 8 insertions, 30 deletions
diff --git a/libs/hwui/TextDropShadowCache.cpp b/libs/hwui/TextDropShadowCache.cpp
index 1707468f169d..fe4b3d7507b2 100644
--- a/libs/hwui/TextDropShadowCache.cpp
+++ b/libs/hwui/TextDropShadowCache.cpp
@@ -93,36 +93,21 @@ int ShadowText::compare(const ShadowText& lhs, const ShadowText& rhs) {
// Constructors/destructor
///////////////////////////////////////////////////////////////////////////////
-TextDropShadowCache::TextDropShadowCache():
- mCache(LruCache<ShadowText, ShadowTexture*>::kUnlimitedCapacity),
- mSize(0), mMaxSize(MB(DEFAULT_DROP_SHADOW_CACHE_SIZE)) {
- char property[PROPERTY_VALUE_MAX];
- if (property_get(PROPERTY_DROP_SHADOW_CACHE_SIZE, property, nullptr) > 0) {
- INIT_LOGD(" Setting drop shadow cache size to %sMB", property);
- setMaxSize(MB(atof(property)));
- } else {
- INIT_LOGD(" Using default drop shadow cache size of %.2fMB",
- DEFAULT_DROP_SHADOW_CACHE_SIZE);
- }
-
- init();
-}
+TextDropShadowCache::TextDropShadowCache()
+ : TextDropShadowCache(Properties::textDropShadowCacheSize) {}
-TextDropShadowCache::TextDropShadowCache(uint32_t maxByteSize):
- mCache(LruCache<ShadowText, ShadowTexture*>::kUnlimitedCapacity),
- mSize(0), mMaxSize(maxByteSize) {
- init();
+TextDropShadowCache::TextDropShadowCache(uint32_t maxByteSize)
+ : mCache(LruCache<ShadowText, ShadowTexture*>::kUnlimitedCapacity)
+ , mSize(0)
+ , mMaxSize(maxByteSize) {
+ mCache.setOnEntryRemovedListener(this);
+ mDebugEnabled = Properties::debugLevel & kDebugMoreCaches;
}
TextDropShadowCache::~TextDropShadowCache() {
mCache.clear();
}
-void TextDropShadowCache::init() {
- mCache.setOnEntryRemovedListener(this);
- mDebugEnabled = Properties::debugLevel & kDebugMoreCaches;
-}
-
///////////////////////////////////////////////////////////////////////////////
// Size management
///////////////////////////////////////////////////////////////////////////////
@@ -135,13 +120,6 @@ uint32_t TextDropShadowCache::getMaxSize() {
return mMaxSize;
}
-void TextDropShadowCache::setMaxSize(uint32_t maxSize) {
- mMaxSize = maxSize;
- while (mSize > mMaxSize) {
- mCache.removeOldest();
- }
-}
-
///////////////////////////////////////////////////////////////////////////////
// Callbacks
///////////////////////////////////////////////////////////////////////////////