| 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 "SkMipMap.h" | 8 #include "SkMipMap.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 proc_3_3 = downsample_3_3<ColorTypeFilter_8>; | 226 proc_3_3 = downsample_3_3<ColorTypeFilter_8>; |
| 227 break; | 227 break; |
| 228 default: | 228 default: |
| 229 // TODO: We could build miplevels for kIndex8 if the levels were in
8888. | 229 // TODO: We could build miplevels for kIndex8 if the levels were in
8888. |
| 230 // Means using more ram, but the quality would be fine. | 230 // Means using more ram, but the quality would be fine. |
| 231 return nullptr; | 231 return nullptr; |
| 232 } | 232 } |
| 233 | 233 |
| 234 // whip through our loop to compute the exact size needed | 234 // whip through our loop to compute the exact size needed |
| 235 size_t size = 0; | 235 size_t size = 0; |
| 236 int countLevels = 0; | 236 int countLevels = 0; |
| 237 { | 237 { |
| 238 int width = src.width(); | 238 int width = src.width(); |
| 239 int height = src.height(); | 239 int height = src.height(); |
| 240 for (;;) { | 240 for (;;) { |
| 241 width >>= 1; | 241 width >>= 1; |
| 242 height >>= 1; | 242 height >>= 1; |
| 243 if (0 == width || 0 == height) { | 243 if (0 == width || 0 == height) { |
| 244 break; | 244 break; |
| 245 } | 245 } |
| 246 size += SkColorTypeMinRowBytes(ct, width) * height; | 246 size += SkColorTypeMinRowBytes(ct, width) * height; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 return false; | 435 return false; |
| 436 } | 436 } |
| 437 if (index > fCount - 1) { | 437 if (index > fCount - 1) { |
| 438 return false; | 438 return false; |
| 439 } | 439 } |
| 440 if (levelPtr) { | 440 if (levelPtr) { |
| 441 *levelPtr = fLevels[index]; | 441 *levelPtr = fLevels[index]; |
| 442 } | 442 } |
| 443 return true; | 443 return true; |
| 444 } | 444 } |
| OLD | NEW |