Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: tools/sk_tool_utils.cpp

Issue 205963003: Revert "hide Config8888 entirely". Broke a bunch of builds. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/sk_tool_utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "sk_tool_utils.h" 1 #include "sk_tool_utils.h"
2 2
3 namespace sk_tool_utils { 3 namespace sk_tool_utils {
4 4
5 const char* colortype_name(SkColorType ct) { 5 const char* colortype_name(SkColorType ct) {
6 switch (ct) { 6 switch (ct) {
7 case kUnknown_SkColorType: return "Unknown"; 7 case kUnknown_SkColorType: return "Unknown";
8 case kAlpha_8_SkColorType: return "Alpha_8"; 8 case kAlpha_8_SkColorType: return "Alpha_8";
9 case kIndex_8_SkColorType: return "Index_8"; 9 case kIndex_8_SkColorType: return "Index_8";
10 case kARGB_4444_SkColorType: return "ARGB_4444"; 10 case kARGB_4444_SkColorType: return "ARGB_4444";
11 case kRGB_565_SkColorType: return "RGB_565"; 11 case kRGB_565_SkColorType: return "RGB_565";
12 case kRGBA_8888_SkColorType: return "RGBA_8888"; 12 case kRGBA_8888_SkColorType: return "RGBA_8888";
13 case kBGRA_8888_SkColorType: return "BGRA_8888"; 13 case kBGRA_8888_SkColorType: return "BGRA_8888";
14 default: 14 default:
15 SkASSERT(false); 15 SkASSERT(false);
16 return "unexpected colortype"; 16 return "unexpected colortype";
17 } 17 }
18 } 18 }
19 19
20 void config8888_to_imagetypes(SkCanvas::Config8888 config, SkColorType* ct, SkAl phaType* at) {
21 switch (config) {
22 case SkCanvas::kNative_Premul_Config8888:
23 *ct = kPMColor_SkColorType;
24 *at = kPremul_SkAlphaType;
25 break;
26 case SkCanvas::kNative_Unpremul_Config8888:
27 *ct = kPMColor_SkColorType;
28 *at = kUnpremul_SkAlphaType;
29 break;
30 case SkCanvas::kBGRA_Premul_Config8888:
31 *ct = kBGRA_8888_SkColorType;
32 *at = kPremul_SkAlphaType;
33 break;
34 case SkCanvas::kBGRA_Unpremul_Config8888:
35 *ct = kBGRA_8888_SkColorType;
36 *at = kUnpremul_SkAlphaType;
37 break;
38 case SkCanvas::kRGBA_Premul_Config8888:
39 *ct = kRGBA_8888_SkColorType;
40 *at = kPremul_SkAlphaType;
41 break;
42 case SkCanvas::kRGBA_Unpremul_Config8888:
43 *ct = kRGBA_8888_SkColorType;
44 *at = kUnpremul_SkAlphaType;
45 break;
46 default:
47 SkASSERT(0);
48 }
49 }
50
20 void write_pixels(SkCanvas* canvas, const SkBitmap& bitmap, int x, int y, 51 void write_pixels(SkCanvas* canvas, const SkBitmap& bitmap, int x, int y,
21 SkColorType colorType, SkAlphaType alphaType) { 52 SkColorType colorType, SkAlphaType alphaType) {
22 SkBitmap tmp(bitmap); 53 SkBitmap tmp(bitmap);
23 tmp.lockPixels(); 54 tmp.lockPixels();
24 55
25 SkImageInfo info = tmp.info(); 56 SkImageInfo info = tmp.info();
26 info.fColorType = colorType; 57 info.fColorType = colorType;
27 info.fAlphaType = alphaType; 58 info.fAlphaType = alphaType;
28 59
29 canvas->writePixels(info, tmp.getPixels(), tmp.rowBytes(), x, y); 60 canvas->writePixels(info, tmp.getPixels(), tmp.rowBytes(), x, y);
30 } 61 }
31 62
32 } 63 }
OLDNEW
« no previous file with comments | « tools/sk_tool_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698