diff options
author | 2010-08-23 21:05:08 -0700 | |
---|---|---|
committer | 2010-08-24 17:18:14 -0700 | |
commit | fb8b763f762ae21923c58d64caa729b012f40e05 (patch) | |
tree | 013792d41f32bff4dd35e6d53eebac711c513729 /libs/hwui/PathCache.cpp | |
parent | a1f1174b396cda7bdff469a2e974a737600c5eb0 (diff) |
Use only one GL context per process, share chaches.
Change-Id: Ieabaa25338d2f4b8d4fd90e7401ad6e7452eae11
Diffstat (limited to 'libs/hwui/PathCache.cpp')
-rw-r--r-- | libs/hwui/PathCache.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp index 10440ea3cebf..158c0cc70ff0 100644 --- a/libs/hwui/PathCache.cpp +++ b/libs/hwui/PathCache.cpp @@ -22,6 +22,7 @@ #include <SkRect.h> #include "PathCache.h" +#include "Properties.h" namespace android { namespace uirenderer { @@ -30,9 +31,30 @@ namespace uirenderer { // Constructors/destructor /////////////////////////////////////////////////////////////////////////////// +PathCache::PathCache(): + mCache(GenerationCache<PathCacheEntry, PathTexture*>::kUnlimitedCapacity), + mSize(0), mMaxSize(MB(DEFAULT_PATH_CACHE_SIZE)) { + char property[PROPERTY_VALUE_MAX]; + if (property_get(PROPERTY_PATH_CACHE_SIZE, property, NULL) > 0) { + LOGD(" Setting path cache size to %sMB", property); + setMaxSize(MB(atof(property))); + } else { + LOGD(" Using default path cache size of %.2fMB", DEFAULT_PATH_CACHE_SIZE); + } + init(); +} + PathCache::PathCache(uint32_t maxByteSize): mCache(GenerationCache<PathCacheEntry, PathTexture*>::kUnlimitedCapacity), mSize(0), mMaxSize(maxByteSize) { + init(); +} + +PathCache::~PathCache() { + mCache.clear(); +} + +void PathCache::init() { mCache.setOnEntryRemovedListener(this); GLint maxTextureSize; @@ -40,10 +62,6 @@ PathCache::PathCache(uint32_t maxByteSize): mMaxTextureSize = maxTextureSize; } -PathCache::~PathCache() { - mCache.clear(); -} - /////////////////////////////////////////////////////////////////////////////// // Size management /////////////////////////////////////////////////////////////////////////////// |