OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |