OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 "SkGr.h" | 8 #include "SkGr.h" |
9 #include "SkConfig8888.h" | 9 #include "SkConfig8888.h" |
10 #include "SkMessageBus.h" | 10 #include "SkMessageBus.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 return kRGB_565_GrPixelConfig; | 251 return kRGB_565_GrPixelConfig; |
252 case SkBitmap::kARGB_4444_Config: | 252 case SkBitmap::kARGB_4444_Config: |
253 return kRGBA_4444_GrPixelConfig; | 253 return kRGBA_4444_GrPixelConfig; |
254 case SkBitmap::kARGB_8888_Config: | 254 case SkBitmap::kARGB_8888_Config: |
255 return kSkia8888_GrPixelConfig; | 255 return kSkia8888_GrPixelConfig; |
256 default: | 256 default: |
257 // kNo_Config, kA1_Config missing | 257 // kNo_Config, kA1_Config missing |
258 return kUnknown_GrPixelConfig; | 258 return kUnknown_GrPixelConfig; |
259 } | 259 } |
260 } | 260 } |
261 | |
262 bool GrPixelConfig2ColorType(GrPixelConfig config, SkColorType* ctOut) { | |
263 SkColorType ct; | |
264 switch (config) { | |
265 case kAlpha_8_GrPixelConfig: | |
266 ct = kAlpha_8_SkColorType; | |
267 break; | |
268 case kIndex_8_GrPixelConfig: | |
269 ct = kIndex8_SkColorType; | |
270 break; | |
271 case kRGB_565_GrPixelConfig: | |
272 ct = kRGB_565_SkColorType; | |
273 break; | |
274 case kRGBA_4444_GrPixelConfig: | |
275 ct = kARGB_4444_SkColorType; | |
276 break; | |
277 case kRGBA_8888_GrPixelConfig: | |
278 ct = kRGBA_8888_SkColorType; | |
279 break; | |
280 case kBGRA_8888_GrPixelConfig: | |
281 ct = kBGRA_8888_SkColorType; | |
282 break; | |
283 default: | |
284 return false; | |
285 } | |
286 if (ctOut) { | |
287 *ctOut = ct; | |
288 } | |
289 return true; | |
290 } | |
OLD | NEW |