OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkBitmapHeap.h" | 9 #include "SkBitmapHeap.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 // Now clear out the heap, after which it should be empty. | 82 // Now clear out the heap, after which it should be empty. |
83 heap.freeMemoryIfPossible(~0U); | 83 heap.freeMemoryIfPossible(~0U); |
84 REPORTER_ASSERT(reporter, heap.count() == 0); | 84 REPORTER_ASSERT(reporter, heap.count() == 0); |
85 | 85 |
86 // Now attempt to flatten the shader again. | 86 // Now attempt to flatten the shader again. |
87 heap.deferAddingOwners(); | 87 heap.deferAddingOwners(); |
88 index = dictionary.find(*bitmapShader); | 88 index = dictionary.find(*bitmapShader); |
89 heap.endAddingOwnersDeferral(false); | 89 heap.endAddingOwnersDeferral(false); |
90 | 90 |
91 // The dictionary should report the same index since the new entry is identi
cal. | |
92 // The bitmap heap should contain the bitmap, but with no references. | 91 // The bitmap heap should contain the bitmap, but with no references. |
93 REPORTER_ASSERT(reporter, 1 == index); | |
94 REPORTER_ASSERT(reporter, heap.count() == 1); | 92 REPORTER_ASSERT(reporter, heap.count() == 1); |
95 REPORTER_ASSERT(reporter, SkBitmapHeapTester::GetRefCount(heap.getEntry(0))
== 0); | 93 REPORTER_ASSERT(reporter, SkBitmapHeapTester::GetRefCount(heap.getEntry(0))
== 0); |
96 } | 94 } |
OLD | NEW |