aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-17 21:31:26 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-17 21:31:26 +0000
commita713f9c6f6a06d216d53e268b9c691941053dabf (patch)
treeb30ac83502f95e32d621d06b2421da8799b5150d /tools
parentf338d7c860bf0bca82cac793069522311a3dbb1a (diff)
add new readPixels with direct memory parameters
BUG=skia: R=scroggo@google.com, bsalomon@google.com, robertphillips@google.com, fmalita@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/199413013 git-svn-id: http://skia.googlecode.com/svn/trunk@13840 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools')
-rw-r--r--tools/sk_tool_utils.cpp15
-rw-r--r--tools/sk_tool_utils.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp
index 1197388694..d13b0d81f8 100644
--- a/tools/sk_tool_utils.cpp
+++ b/tools/sk_tool_utils.cpp
@@ -2,6 +2,21 @@
namespace sk_tool_utils {
+const char* colortype_name(SkColorType ct) {
+ switch (ct) {
+ case kUnknown_SkColorType: return "Unknown";
+ case kAlpha_8_SkColorType: return "Alpha_8";
+ case kIndex_8_SkColorType: return "Index_8";
+ case kARGB_4444_SkColorType: return "ARGB_4444";
+ case kRGB_565_SkColorType: return "RGB_565";
+ case kRGBA_8888_SkColorType: return "RGBA_8888";
+ case kBGRA_8888_SkColorType: return "BGRA_8888";
+ default:
+ SkASSERT(false);
+ return "unexpected colortype";
+ }
+}
+
void config8888_to_imagetypes(SkCanvas::Config8888 config, SkColorType* ct, SkAlphaType* at) {
switch (config) {
case SkCanvas::kNative_Premul_Config8888:
diff --git a/tools/sk_tool_utils.h b/tools/sk_tool_utils.h
index 7747a12096..a450aa1244 100644
--- a/tools/sk_tool_utils.h
+++ b/tools/sk_tool_utils.h
@@ -12,6 +12,8 @@
#include "SkBitmap.h"
namespace sk_tool_utils {
+
+ const char* colortype_name(SkColorType);
/**
* Return the colorType and alphaType that correspond to the specified Config8888