Loading libs/hwui/PathCache.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -182,7 +182,8 @@ static void drawPath(const SkPath *path, const SkPaint* paint, SkBitmap& bitmap, PathCache::PathCache() : mCache(LruCache<PathDescription, PathTexture*>::kUnlimitedCapacity) , mSize(0) , mMaxSize(Properties::pathCacheSize) { , mMaxSize(Properties::pathCacheSize) , mTexNum(0) { mCache.setOnEntryRemovedListener(this); GLint maxTextureSize; Loading Loading @@ -238,6 +239,7 @@ void PathCache::removeTexture(PathTexture* texture) { "the cache in an inconsistent state", size); } mSize -= size; mTexNum--; } PATH_LOGD("PathCache::delete name, size, mSize = %d, %d, %d", Loading @@ -262,7 +264,7 @@ void PathCache::purgeCache(uint32_t width, uint32_t height) { } void PathCache::trim() { while (mSize > mMaxSize) { while (mSize > mMaxSize || mTexNum > DEFAULT_PATH_TEXTURE_CAP) { mCache.removeOldest(); } } Loading Loading @@ -316,6 +318,7 @@ void PathCache::generateTexture(SkBitmap& bitmap, Texture* texture) { ATRACE_NAME("Upload Path Texture"); texture->upload(bitmap); texture->setFilter(GL_LINEAR); mTexNum++; } /////////////////////////////////////////////////////////////////////////////// Loading libs/hwui/PathCache.h +6 −0 Original line number Diff line number Diff line Loading @@ -304,6 +304,12 @@ private: bool mDebugEnabled; /** * Driver allocated 4k/8k/16k memory for small path cache, * limit the number of PathTexture in case occupy too much memory in hardware. */ uint32_t mTexNum; sp<PathProcessor> mProcessor; std::vector<uint32_t> mGarbage; Loading libs/hwui/Properties.h +3 −0 Original line number Diff line number Diff line Loading @@ -219,6 +219,9 @@ enum DebugLevel { #define DEFAULT_TEXT_GAMMA 1.4f // cap to 256 to limite paths in the path cache #define DEFAULT_PATH_TEXTURE_CAP 256 /////////////////////////////////////////////////////////////////////////////// // Misc /////////////////////////////////////////////////////////////////////////////// Loading Loading
libs/hwui/PathCache.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -182,7 +182,8 @@ static void drawPath(const SkPath *path, const SkPaint* paint, SkBitmap& bitmap, PathCache::PathCache() : mCache(LruCache<PathDescription, PathTexture*>::kUnlimitedCapacity) , mSize(0) , mMaxSize(Properties::pathCacheSize) { , mMaxSize(Properties::pathCacheSize) , mTexNum(0) { mCache.setOnEntryRemovedListener(this); GLint maxTextureSize; Loading Loading @@ -238,6 +239,7 @@ void PathCache::removeTexture(PathTexture* texture) { "the cache in an inconsistent state", size); } mSize -= size; mTexNum--; } PATH_LOGD("PathCache::delete name, size, mSize = %d, %d, %d", Loading @@ -262,7 +264,7 @@ void PathCache::purgeCache(uint32_t width, uint32_t height) { } void PathCache::trim() { while (mSize > mMaxSize) { while (mSize > mMaxSize || mTexNum > DEFAULT_PATH_TEXTURE_CAP) { mCache.removeOldest(); } } Loading Loading @@ -316,6 +318,7 @@ void PathCache::generateTexture(SkBitmap& bitmap, Texture* texture) { ATRACE_NAME("Upload Path Texture"); texture->upload(bitmap); texture->setFilter(GL_LINEAR); mTexNum++; } /////////////////////////////////////////////////////////////////////////////// Loading
libs/hwui/PathCache.h +6 −0 Original line number Diff line number Diff line Loading @@ -304,6 +304,12 @@ private: bool mDebugEnabled; /** * Driver allocated 4k/8k/16k memory for small path cache, * limit the number of PathTexture in case occupy too much memory in hardware. */ uint32_t mTexNum; sp<PathProcessor> mProcessor; std::vector<uint32_t> mGarbage; Loading
libs/hwui/Properties.h +3 −0 Original line number Diff line number Diff line Loading @@ -219,6 +219,9 @@ enum DebugLevel { #define DEFAULT_TEXT_GAMMA 1.4f // cap to 256 to limite paths in the path cache #define DEFAULT_PATH_TEXTURE_CAP 256 /////////////////////////////////////////////////////////////////////////////// // Misc /////////////////////////////////////////////////////////////////////////////// Loading