Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: include/core/SkGraphics.h

Issue 394003003: Set maximum output size for scaled-image-cache images (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: AnotherPatchSet Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/tests.gypi ('k') | src/core/SkBitmapProcState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkGraphics.h
diff --git a/include/core/SkGraphics.h b/include/core/SkGraphics.h
index 2667a388d2bbb66a7081fe18bb053328fbdc9266..e7865ca5afb4c393af54fc0bfa8fb7a22392e3e3 100644
--- a/include/core/SkGraphics.h
+++ b/include/core/SkGraphics.h
@@ -79,9 +79,47 @@ public:
*/
static void PurgeFontCache();
- static size_t GetImageCacheBytesUsed();
- static size_t GetImageCacheByteLimit();
- static size_t SetImageCacheByteLimit(size_t newLimit);
+ /**
+ * Scaling bitmaps with the SkPaint::kHigh_FilterLevel setting is
+ * expensive, so the result is saved in the global Scaled Image
+ * Cache.
+ *
+ * This function returns the memory usage of the Scaled Image Cache.
+ */
+ static size_t GetImageCacheTotalBytesUsed();
+ /**
+ * These functions get/set the memory usage limit for the Scaled
+ * Image Cache. Bitmaps are purged from the cache when the
+ * memory useage exceeds this limit.
+ */
+ static size_t GetImageCacheTotalByteLimit();
+ static size_t SetImageCacheTotalByteLimit(size_t newLimit);
+
+ // DEPRECATED
+ static size_t GetImageCacheBytesUsed() {
+ return GetImageCacheTotalBytesUsed();
+ }
+ // DEPRECATED
+ static size_t GetImageCacheByteLimit() {
+ return GetImageCacheTotalByteLimit();
+ }
+ // DEPRECATED
+ static size_t SetImageCacheByteLimit(size_t newLimit) {
+ return SetImageCacheTotalByteLimit(newLimit);
+ }
+
+ /**
+ * Scaling bitmaps with the SkPaint::kHigh_FilterLevel setting is
+ * expensive, so the result is saved in the global Scaled Image
+ * Cache. When the resulting bitmap is too large, this can
+ * overload the cache. If the ImageCacheSingleAllocationByteLimit
+ * is set to a non-zero number, and the resulting bitmap would be
+ * larger than that value, the bitmap scaling algorithm falls
+ * back onto a cheaper algorithm and does not cache the result.
+ * Zero is the default value.
+ */
+ static size_t GetImageCacheSingleAllocationByteLimit();
+ static size_t SetImageCacheSingleAllocationByteLimit(size_t newLimit);
/**
* Applications with command line options may pass optional state, such
« no previous file with comments | « gyp/tests.gypi ('k') | src/core/SkBitmapProcState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698