diff options
author | Romain Guy <romainguy@google.com> | 2010-08-23 21:05:08 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2010-08-24 17:18:14 -0700 |
commit | fb8b763f762ae21923c58d64caa729b012f40e05 (patch) | |
tree | 013792d41f32bff4dd35e6d53eebac711c513729 /libs/hwui/GradientCache.cpp | |
parent | a1f1174b396cda7bdff469a2e974a737600c5eb0 (diff) |
Use only one GL context per process, share chaches.
Change-Id: Ieabaa25338d2f4b8d4fd90e7401ad6e7452eae11
Diffstat (limited to 'libs/hwui/GradientCache.cpp')
-rw-r--r-- | libs/hwui/GradientCache.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libs/hwui/GradientCache.cpp b/libs/hwui/GradientCache.cpp index 59fa0a7badcd..58920bd6f96d 100644 --- a/libs/hwui/GradientCache.cpp +++ b/libs/hwui/GradientCache.cpp @@ -22,6 +22,7 @@ #include <SkGradientShader.h> #include "GradientCache.h" +#include "Properties.h" namespace android { namespace uirenderer { @@ -30,6 +31,20 @@ namespace uirenderer { // Constructors/destructor /////////////////////////////////////////////////////////////////////////////// +GradientCache::GradientCache(): + mCache(GenerationCache<SkShader*, Texture*>::kUnlimitedCapacity), + mSize(0), mMaxSize(MB(DEFAULT_GRADIENT_CACHE_SIZE)) { + char property[PROPERTY_VALUE_MAX]; + if (property_get(PROPERTY_GRADIENT_CACHE_SIZE, property, NULL) > 0) { + LOGD(" Setting gradient cache size to %sMB", property); + setMaxSize(MB(atof(property))); + } else { + LOGD(" Using default gradient cache size of %.2fMB", DEFAULT_GRADIENT_CACHE_SIZE); + } + + mCache.setOnEntryRemovedListener(this); +} + GradientCache::GradientCache(uint32_t maxByteSize): mCache(GenerationCache<SkShader*, Texture*>::kUnlimitedCapacity), mSize(0), mMaxSize(maxByteSize) { |