| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 size.add(SkToS32(pixelSize)); | 122 size.add(SkToS32(pixelSize)); |
| 123 if (!isPos32Bits(size)) { | 123 if (!isPos32Bits(size)) { |
| 124 return NULL; | 124 return NULL; |
| 125 } | 125 } |
| 126 return (Level*)sk_malloc_throw(size.get32()); | 126 return (Level*)sk_malloc_throw(size.get32()); |
| 127 } | 127 } |
| 128 | 128 |
| 129 SkMipMap* SkMipMap::Build(const SkBitmap& src) { | 129 SkMipMap* SkMipMap::Build(const SkBitmap& src) { |
| 130 void (*proc)(SkBitmap* dst, int x, int y, const SkBitmap& src); | 130 void (*proc)(SkBitmap* dst, int x, int y, const SkBitmap& src); |
| 131 | 131 |
| 132 const SkBitmap::Config config = src.getConfig(); | 132 const SkBitmap::Config config = src.config(); |
| 133 switch (config) { | 133 switch (config) { |
| 134 case SkBitmap::kARGB_8888_Config: | 134 case SkBitmap::kARGB_8888_Config: |
| 135 proc = downsampleby2_proc32; | 135 proc = downsampleby2_proc32; |
| 136 break; | 136 break; |
| 137 case SkBitmap::kRGB_565_Config: | 137 case SkBitmap::kRGB_565_Config: |
| 138 proc = downsampleby2_proc16; | 138 proc = downsampleby2_proc16; |
| 139 break; | 139 break; |
| 140 case SkBitmap::kARGB_4444_Config: | 140 case SkBitmap::kARGB_4444_Config: |
| 141 proc = downsampleby2_proc4444; | 141 proc = downsampleby2_proc4444; |
| 142 break; | 142 break; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 253 } |
| 254 | 254 |
| 255 if (level > fCount) { | 255 if (level > fCount) { |
| 256 level = fCount; | 256 level = fCount; |
| 257 } | 257 } |
| 258 if (levelPtr) { | 258 if (levelPtr) { |
| 259 *levelPtr = fLevels[level - 1]; | 259 *levelPtr = fLevels[level - 1]; |
| 260 } | 260 } |
| 261 return true; | 261 return true; |
| 262 } | 262 } |
| OLD | NEW |