diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-23 03:59:35 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-23 03:59:35 +0000 |
commit | 8a2ad3cae710f05cca57e48dd1732d575dba2dc7 (patch) | |
tree | 65d3463543af4bc3d330de2bef37cffc6d10395e /gm | |
parent | d5b294acad96ffa3ccb5c56f6290036922f76907 (diff) |
add new copyTo version to SkBitmap, which takes SkColorType
BUG=skia:
R=scroggo@google.com, halcanary@google.com, bsalomon@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/171723007
git-svn-id: http://skia.googlecode.com/svn/trunk@13553 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm')
-rw-r--r-- | gm/bitmapcopy.cpp | 26 | ||||
-rw-r--r-- | gm/bitmapfilters.cpp | 6 | ||||
-rw-r--r-- | gm/bitmapscroll.cpp | 2 | ||||
-rw-r--r-- | gm/copyTo4444.cpp | 2 | ||||
-rw-r--r-- | gm/gmmain.cpp | 2 |
5 files changed, 19 insertions, 19 deletions
diff --git a/gm/bitmapcopy.cpp b/gm/bitmapcopy.cpp index 5bd2bf88da..68db908024 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); diff --git a/gm/bitmapfilters.cpp b/gm/bitmapfilters.cpp index 7addf25c01..fb3b304eb9 100644 --- a/gm/bitmapfilters.cpp +++ b/gm/bitmapfilters.cpp @@ -85,9 +85,9 @@ class FilterGM : public GM { } fOnce = true; make_bm(&fBM8); - fBM8.copyTo(&fBM4444, SkBitmap::kARGB_4444_Config); - fBM8.copyTo(&fBM16, SkBitmap::kRGB_565_Config); - fBM8.copyTo(&fBM32, SkBitmap::kARGB_8888_Config); + fBM8.copyTo(&fBM4444, kARGB_4444_SkColorType); + fBM8.copyTo(&fBM16, kRGB_565_SkColorType); + fBM8.copyTo(&fBM32, kPMColor_SkColorType); } public: SkBitmap fBM8, fBM4444, fBM16, fBM32; diff --git a/gm/bitmapscroll.cpp b/gm/bitmapscroll.cpp index b14b0475dd..d2b8ca0f9a 100644 --- a/gm/bitmapscroll.cpp +++ b/gm/bitmapscroll.cpp @@ -129,7 +129,7 @@ protected: // scrollRect() should always return true, even if it's a no-op SkBitmap scrolledBitmap; SkDEBUGCODE(bool copyToReturnValue = )origBitmap.copyTo( - &scrolledBitmap, origBitmap.config()); + &scrolledBitmap, origBitmap.colorType()); SkASSERT(copyToReturnValue); SkDEBUGCODE(bool scrollRectReturnValue = )scrolledBitmap.scrollRect( subset, scrollX * xMult, scrollY * yMult); diff --git a/gm/copyTo4444.cpp b/gm/copyTo4444.cpp index 4efe00b6dc..7e2c2798e4 100644 --- a/gm/copyTo4444.cpp +++ b/gm/copyTo4444.cpp @@ -40,7 +40,7 @@ protected: return; } canvas->drawBitmap(bm, 0, 0); - SkAssertResult(bm.copyTo(&bm4444, SkBitmap::kARGB_4444_Config)); + SkAssertResult(bm.copyTo(&bm4444, kARGB_4444_SkColorType)); canvas->drawBitmap(bm4444, SkIntToScalar(bm.width()), 0); } diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp index c52c5d843b..662e981484 100644 --- a/gm/gmmain.cpp +++ b/gm/gmmain.cpp @@ -293,7 +293,7 @@ public: // from this method, we should be able to get rid of the // transformation to 8888 format also. SkBitmap copy; - bitmap.copyTo(©, SkBitmap::kARGB_8888_Config); + bitmap.copyTo(©, kPMColor_SkColorType); if (!SkImageEncoder::EncodeFile(path.c_str(), copy, SkImageEncoder::kPNG_Type, 100)) { |