| 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 "Test.h" | 8 #include "Test.h" |
| 9 #include "SkScaledImageCache.h" | 9 #include "SkScaledImageCache.h" |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 REPORTER_ASSERT(reporter, tmp.pixelRef() == tmp2.pixelRef()); | 41 REPORTER_ASSERT(reporter, tmp.pixelRef() == tmp2.pixelRef()); |
| 42 REPORTER_ASSERT(reporter, tmp.width() == tmp2.width()); | 42 REPORTER_ASSERT(reporter, tmp.width() == tmp2.width()); |
| 43 REPORTER_ASSERT(reporter, tmp.height() == tmp2.height()); | 43 REPORTER_ASSERT(reporter, tmp.height() == tmp2.height()); |
| 44 cache.unlock(id2); | 44 cache.unlock(id2); |
| 45 | 45 |
| 46 cache.unlock(id); | 46 cache.unlock(id); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // stress test, should trigger purges | 49 // stress test, should trigger purges |
| 50 for (size_t i = 0; i < COUNT * 100; ++i) { | 50 for (size_t i = 0; i < COUNT * 100; ++i) { |
| 51 scale += 1; |
| 52 |
| 51 SkBitmap tmp; | 53 SkBitmap tmp; |
| 52 | 54 |
| 53 make_bm(&tmp, DIM, DIM); | 55 make_bm(&tmp, DIM, DIM); |
| 54 id = cache.addAndLock(bm[0], scale, scale, tmp); | 56 id = cache.addAndLock(bm[0], scale, scale, tmp); |
| 55 REPORTER_ASSERT(reporter, NULL != id); | 57 REPORTER_ASSERT(reporter, NULL != id); |
| 56 cache.unlock(id); | 58 cache.unlock(id); |
| 57 | |
| 58 scale += 1; | |
| 59 } | 59 } |
| 60 | 60 |
| 61 cache.setByteLimit(0); | 61 cache.setByteLimit(0); |
| 62 } | 62 } |
| 63 | 63 |
| 64 #include "TestClassDef.h" | 64 #include "TestClassDef.h" |
| 65 DEFINE_TESTCLASS("ImageCache", TestImageCacheClass, TestImageCache) | 65 DEFINE_TESTCLASS("ImageCache", TestImageCacheClass, TestImageCache) |
| OLD | NEW |