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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « gyp/tests.gypi ('k') | src/core/SkBitmapProcState.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkGraphics_DEFINED 10 #ifndef SkGraphics_DEFINED
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 */ 72 */
73 static int SetFontCacheCountLimit(int count); 73 static int SetFontCacheCountLimit(int count);
74 74
75 /** 75 /**
76 * For debugging purposes, this will attempt to purge the font cache. It 76 * For debugging purposes, this will attempt to purge the font cache. It
77 * does not change the limit, but will cause subsequent font measures and 77 * does not change the limit, but will cause subsequent font measures and
78 * draws to be recreated, since they will no longer be in the cache. 78 * draws to be recreated, since they will no longer be in the cache.
79 */ 79 */
80 static void PurgeFontCache(); 80 static void PurgeFontCache();
81 81
82 static size_t GetImageCacheBytesUsed(); 82 /**
83 static size_t GetImageCacheByteLimit(); 83 * Scaling bitmaps with the SkPaint::kHigh_FilterLevel setting is
84 static size_t SetImageCacheByteLimit(size_t newLimit); 84 * expensive, so the result is saved in the global Scaled Image
85 * Cache.
86 *
87 * This function returns the memory usage of the Scaled Image Cache.
88 */
89 static size_t GetImageCacheTotalBytesUsed();
90 /**
91 * These functions get/set the memory usage limit for the Scaled
92 * Image Cache. Bitmaps are purged from the cache when the
93 * memory useage exceeds this limit.
94 */
95 static size_t GetImageCacheTotalByteLimit();
96 static size_t SetImageCacheTotalByteLimit(size_t newLimit);
97
98 // DEPRECATED
99 static size_t GetImageCacheBytesUsed() {
100 return GetImageCacheTotalBytesUsed();
101 }
102 // DEPRECATED
103 static size_t GetImageCacheByteLimit() {
104 return GetImageCacheTotalByteLimit();
105 }
106 // DEPRECATED
107 static size_t SetImageCacheByteLimit(size_t newLimit) {
108 return SetImageCacheTotalByteLimit(newLimit);
109 }
110
111 /**
112 * Scaling bitmaps with the SkPaint::kHigh_FilterLevel setting is
113 * expensive, so the result is saved in the global Scaled Image
114 * Cache. When the resulting bitmap is too large, this can
115 * overload the cache. If the ImageCacheSingleAllocationByteLimit
116 * is set to a non-zero number, and the resulting bitmap would be
117 * larger than that value, the bitmap scaling algorithm falls
118 * back onto a cheaper algorithm and does not cache the result.
119 * Zero is the default value.
120 */
121 static size_t GetImageCacheSingleAllocationByteLimit();
122 static size_t SetImageCacheSingleAllocationByteLimit(size_t newLimit);
85 123
86 /** 124 /**
87 * Applications with command line options may pass optional state, such 125 * Applications with command line options may pass optional state, such
88 * as cache sizes, here, for instance: 126 * as cache sizes, here, for instance:
89 * font-cache-limit=12345678 127 * font-cache-limit=12345678
90 * 128 *
91 * The flags format is name=value[;name=value...] with no spaces. 129 * The flags format is name=value[;name=value...] with no spaces.
92 * This format is subject to change. 130 * This format is subject to change.
93 */ 131 */
94 static void SetFlags(const char* flags); 132 static void SetFlags(const char* flags);
(...skipping 30 matching lines...) Expand all
125 public: 163 public:
126 SkAutoGraphics() { 164 SkAutoGraphics() {
127 SkGraphics::Init(); 165 SkGraphics::Init();
128 } 166 }
129 ~SkAutoGraphics() { 167 ~SkAutoGraphics() {
130 SkGraphics::Term(); 168 SkGraphics::Term();
131 } 169 }
132 }; 170 };
133 171
134 #endif 172 #endif
OLDNEW
« 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