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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkMipMap.h" | 9 #include "SkMipMap.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 {-100, -100, 0}, | 118 {-100, -100, 0}, |
119 | 119 |
120 // Test mipmaps with 0, 1, 2 as dimensions | 120 // Test mipmaps with 0, 1, 2 as dimensions |
121 // (SkMipMap::Build requires a min size of 2) | 121 // (SkMipMap::Build requires a min size of 2) |
122 // | 122 // |
123 // 0 | 123 // 0 |
124 {0, 100, 0}, | 124 {0, 100, 0}, |
125 {100, 0, 0}, | 125 {100, 0, 0}, |
126 {0, 0, 0}, | 126 {0, 0, 0}, |
127 // 1 | 127 // 1 |
128 {1, 100, 0}, | 128 {1, 100, 6}, |
129 {100, 1, 0}, | 129 {100, 1, 6}, |
130 {1, 1, 0}, | 130 {1, 1, 0}, |
131 // 2 | 131 // 2 |
132 {2, 100, 1}, | 132 {2, 100, 6}, |
133 {100, 2, 1}, | 133 {100, 2, 6}, |
134 {2, 2, 1}, | 134 {2, 2, 1}, |
135 | 135 |
136 // Test a handful of boundaries such as 63x63 and 64x64 | 136 // Test a handful of boundaries such as 63x63 and 64x64 |
137 {63, 63, 5}, | 137 {63, 63, 5}, |
138 {64, 64, 6}, | 138 {64, 64, 6}, |
139 {127, 127, 6}, | 139 {127, 127, 6}, |
140 {128, 128, 7}, | 140 {128, 128, 7}, |
141 {255, 255, 7}, | 141 {255, 255, 7}, |
142 {256, 256, 8}, | 142 {256, 256, 8}, |
143 | 143 |
144 // Test different dimensions, such as 256x64 | 144 // Test different dimensions, such as 256x64 |
145 {64, 129, 6}, | 145 {64, 129, 7}, |
146 {255, 32, 5}, | 146 {255, 32, 7}, |
147 {500, 1000, 8} | 147 {500, 1000, 9} |
148 }; | 148 }; |
149 | 149 |
150 for (auto& currentTest : tests) { | 150 for (auto& currentTest : tests) { |
151 int levelCount = SkMipMap::ComputeLevelCount(currentTest.fWidth, current
Test.fHeight); | 151 int levelCount = SkMipMap::ComputeLevelCount(currentTest.fWidth, current
Test.fHeight); |
152 REPORTER_ASSERT(reporter, currentTest.fExpectedLevelCount == levelCount)
; | 152 REPORTER_ASSERT(reporter, currentTest.fExpectedLevelCount == levelCount)
; |
153 } | 153 } |
154 } | 154 } |
OLD | NEW |