diff options
author | Mike Reed <reed@google.com> | 2017-07-03 13:36:17 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-03 19:07:25 +0000 |
commit | a920d367bf9b3724f66173e4aa702ca09f680dea (patch) | |
tree | 6f1501e4c0c1c9568b99428d201adb19e281390e /gm | |
parent | 0401c0d1d3ad9db5d3eecb3096bd569dfe5c2498 (diff) |
remove unneeded code for index8 imagse
Bug: skia:6828
Change-Id: I039d6bc35a1ed93ce747247f32fe4e9d5b09da0c
Reviewed-on: https://skia-review.googlesource.com/21400
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'gm')
-rw-r--r-- | gm/all_bitmap_configs.cpp | 47 |
1 files changed, 1 insertions, 46 deletions
diff --git a/gm/all_bitmap_configs.cpp b/gm/all_bitmap_configs.cpp index 4c8ea359f1..d9735b2d3d 100644 --- a/gm/all_bitmap_configs.cpp +++ b/gm/all_bitmap_configs.cpp @@ -102,47 +102,6 @@ int find(T* array, int N, T item) { return -1; } -static SkPMColor premultiply_color(SkColor c) { - return SkPremultiplyARGBInline(SkColorGetA(c), SkColorGetR(c), - SkColorGetG(c), SkColorGetB(c)); -} - -static SkBitmap indexed_bitmap() { - SkBitmap n32bitmap; - n32bitmap.allocN32Pixels(SCALE, SCALE); - n32bitmap.eraseColor(SK_ColorTRANSPARENT); - - SkCanvas canvas(n32bitmap); - color_wheel_native(&canvas); - const SkColor colors[] = { - SK_ColorTRANSPARENT, - SK_ColorWHITE, - SK_ColorBLACK, - SK_ColorRED, - SK_ColorGREEN, - SK_ColorBLUE, - SK_ColorCYAN, - SK_ColorMAGENTA, - SK_ColorYELLOW, - }; - SkPMColor pmColors[SK_ARRAY_COUNT(colors)]; - for (size_t i = 0; i < SK_ARRAY_COUNT(colors); ++i) { - pmColors[i] = premultiply_color(colors[i]); - } - SkBitmap bm; - SkImageInfo info = SkImageInfo::Make(SCALE, SCALE, kIndex_8_SkColorType, - kPremul_SkAlphaType); - bm.allocPixels(info, SkColorTable::Make(pmColors, SK_ARRAY_COUNT(pmColors))); - for (int y = 0; y < SCALE; ++y) { - for (int x = 0; x < SCALE; ++x) { - SkPMColor c = *n32bitmap.getAddr32(x, y); - int idx = find(pmColors, SK_ARRAY_COUNT(pmColors), c); - *bm.getAddr8(x, y) = SkClampMax(idx, SK_ARRAY_COUNT(pmColors) - 1); - } - } - return bm; -} - static void draw(SkCanvas* canvas, const SkPaint& p, const SkBitmap& src, @@ -153,7 +112,7 @@ static void draw(SkCanvas* canvas, canvas->drawString(text, 0.0f, 12.0f, p); } -DEF_SIMPLE_GM(all_bitmap_configs, canvas, SCALE, 6 * SCALE) { +DEF_SIMPLE_GM(all_bitmap_configs, canvas, SCALE, 5 * SCALE) { SkAutoCanvasRestore autoCanvasRestore(canvas, true); SkPaint p; p.setColor(SK_ColorBLACK); @@ -181,10 +140,6 @@ DEF_SIMPLE_GM(all_bitmap_configs, canvas, SCALE, 6 * SCALE) { } canvas->translate(0.0f, SkIntToScalar(SCALE)); - SkBitmap bitmapIndexed = indexed_bitmap(); - draw(canvas, p, bitmapIndexed, kIndex_8_SkColorType, "Index 8"); - - canvas->translate(0.0f, SkIntToScalar(SCALE)); SkBitmap bitmapA8 = make_bitmap(kAlpha_8_SkColorType); draw(canvas, p, bitmapA8, kAlpha_8_SkColorType, "Alpha 8"); |