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

Side by Side Diff: tests/ImageCacheTest.cpp

Issue 462993003: Set maximum output size for scaled-image-cache images (Closed) Base URL: https://skia.googlesource.com/skia.git@m37_2062
Patch Set: Created 6 years, 4 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 | « src/core/SkScaledImageCache.cpp ('k') | tests/ScaledImageCache.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDiscardableMemory.h" 8 #include "SkDiscardableMemory.h"
9 #include "SkScaledImageCache.h" 9 #include "SkScaledImageCache.h"
10 #include "Test.h" 10 #include "Test.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 // test the originals after all that purging 68 // test the originals after all that purging
69 for (int i = 0; i < COUNT; ++i) { 69 for (int i = 0; i < COUNT; ++i) {
70 SkBitmap tmp; 70 SkBitmap tmp;
71 id = cache.findAndLock(bm[i], scale, scale, &tmp); 71 id = cache.findAndLock(bm[i], scale, scale, &tmp);
72 if (id) { 72 if (id) {
73 cache.unlock(id); 73 cache.unlock(id);
74 } 74 }
75 } 75 }
76 76
77 cache.setByteLimit(0); 77 cache.setTotalByteLimit(0);
78 } 78 }
79 79
80 #include "SkDiscardableMemoryPool.h" 80 #include "SkDiscardableMemoryPool.h"
81 81
82 static SkDiscardableMemoryPool* gPool; 82 static SkDiscardableMemoryPool* gPool;
83 static SkDiscardableMemory* pool_factory(size_t bytes) { 83 static SkDiscardableMemory* pool_factory(size_t bytes) {
84 SkASSERT(gPool); 84 SkASSERT(gPool);
85 return gPool->create(bytes); 85 return gPool->create(bytes);
86 } 86 }
87 87
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 cache.unlock(id1); 124 cache.unlock(id1);
125 cache.unlock(id2); 125 cache.unlock(id2);
126 126
127 SkBitmap tmp; 127 SkBitmap tmp;
128 // Lookup should return the value that was added last. 128 // Lookup should return the value that was added last.
129 SkScaledImageCache::ID* id = cache.findAndLock(original, 0.5f, 0.5f, &tmp); 129 SkScaledImageCache::ID* id = cache.findAndLock(original, 0.5f, 0.5f, &tmp);
130 REPORTER_ASSERT(r, NULL != id); 130 REPORTER_ASSERT(r, NULL != id);
131 REPORTER_ASSERT(r, tmp.getGenerationID() == scaled2.getGenerationID()); 131 REPORTER_ASSERT(r, tmp.getGenerationID() == scaled2.getGenerationID());
132 cache.unlock(id); 132 cache.unlock(id);
133 } 133 }
OLDNEW
« no previous file with comments | « src/core/SkScaledImageCache.cpp ('k') | tests/ScaledImageCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698