Index: tools/sk_tool_utils.cpp |
diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp |
index 3eb55554b6dc780042b49c2b2587be073e147cf4..d13b0d81f8e2561fdd01cf1b0cae5d38a04f7b2f 100644 |
--- a/tools/sk_tool_utils.cpp |
+++ b/tools/sk_tool_utils.cpp |
@@ -17,6 +17,37 @@ const char* colortype_name(SkColorType ct) { |
} |
} |
+void config8888_to_imagetypes(SkCanvas::Config8888 config, SkColorType* ct, SkAlphaType* at) { |
+ switch (config) { |
+ case SkCanvas::kNative_Premul_Config8888: |
+ *ct = kPMColor_SkColorType; |
+ *at = kPremul_SkAlphaType; |
+ break; |
+ case SkCanvas::kNative_Unpremul_Config8888: |
+ *ct = kPMColor_SkColorType; |
+ *at = kUnpremul_SkAlphaType; |
+ break; |
+ case SkCanvas::kBGRA_Premul_Config8888: |
+ *ct = kBGRA_8888_SkColorType; |
+ *at = kPremul_SkAlphaType; |
+ break; |
+ case SkCanvas::kBGRA_Unpremul_Config8888: |
+ *ct = kBGRA_8888_SkColorType; |
+ *at = kUnpremul_SkAlphaType; |
+ break; |
+ case SkCanvas::kRGBA_Premul_Config8888: |
+ *ct = kRGBA_8888_SkColorType; |
+ *at = kPremul_SkAlphaType; |
+ break; |
+ case SkCanvas::kRGBA_Unpremul_Config8888: |
+ *ct = kRGBA_8888_SkColorType; |
+ *at = kUnpremul_SkAlphaType; |
+ break; |
+ default: |
+ SkASSERT(0); |
+ } |
+} |
+ |
void write_pixels(SkCanvas* canvas, const SkBitmap& bitmap, int x, int y, |
SkColorType colorType, SkAlphaType alphaType) { |
SkBitmap tmp(bitmap); |