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

Unified Diff: gm/bitmapcopy.cpp

Issue 171723007: add new copyTo version to SkBitmap, which takes SkColorType (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dm/DMWriteTask.cpp ('k') | gm/bitmapfilters.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/bitmapcopy.cpp
diff --git a/gm/bitmapcopy.cpp b/gm/bitmapcopy.cpp
index 5bd2bf88da5996c44ef33eed1d34200f415e050d..68db90802433eca29b70c372d7f0f73f2071a153 100644
--- a/gm/bitmapcopy.cpp
+++ b/gm/bitmapcopy.cpp
@@ -9,23 +9,23 @@
namespace skiagm {
-static const char* gConfigNames[] = {
- "unknown config",
+static const char* gColorTypeNames[] = {
+ "unknown",
"A8",
- "Index8",
"565",
"4444",
- "8888"
+ "8888",
+ "8888",
+ "Index8",
};
-SkBitmap::Config gConfigs[] = {
- SkBitmap::kRGB_565_Config,
- SkBitmap::kARGB_4444_Config, // TODO(edisonn): Should we remove it from GM?
- // it fails to copy in bitmap with this config.
- SkBitmap::kARGB_8888_Config,
+static const SkColorType gColorTypes[] = {
+ kRGB_565_SkColorType,
+ kARGB_4444_SkColorType,
+ kPMColor_SkColorType,
};
-#define NUM_CONFIGS (sizeof(gConfigs) / sizeof(SkBitmap::Config))
+#define NUM_CONFIGS SK_ARRAY_COUNT(gColorTypes)
static void draw_checks(SkCanvas* canvas, int width, int height) {
SkPaint paint;
@@ -72,7 +72,7 @@ protected:
draw_checks(&canvasTmp, 40, 40);
for (unsigned i = 0; i < NUM_CONFIGS; ++i) {
- src.copyTo(&fDst[i], gConfigs[i]);
+ src.copyTo(&fDst[i], gColorTypes[i]);
}
canvas->clear(0xFFDDDDDD);
@@ -83,7 +83,7 @@ protected:
height = paint.getFontSpacing();
}
for (unsigned i = 0; i < NUM_CONFIGS; i++) {
- const char* name = gConfigNames[src.config()];
+ const char* name = gColorTypeNames[src.colorType()];
SkScalar textWidth = paint.measureText(name, strlen(name));
if (textWidth > width) {
width = textWidth;
@@ -96,7 +96,7 @@ protected:
for (unsigned i = 0; i < NUM_CONFIGS; i++) {
canvas->save();
// Draw destination config name
- const char* name = gConfigNames[fDst[i].config()];
+ const char* name = gColorTypeNames[fDst[i].colorType()];
SkScalar textWidth = paint.measureText(name, strlen(name));
SkScalar x = (width - textWidth) / SkScalar(2);
SkScalar y = paint.getFontSpacing() / SkScalar(2);
« no previous file with comments | « dm/DMWriteTask.cpp ('k') | gm/bitmapfilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698