From c5e15a1afab2621e860a251c3fcf5917867ad49f Mon Sep 17 00:00:00 2001 From: reed Date: Mon, 29 Sep 2014 12:10:27 -0700 Subject: remove alphatype from colortable the owning bitmap is (already) responsible for knowing the alphatype BUG=skia: R=djsollen@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/611093002 --- tests/BitmapCopyTest.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'tests/BitmapCopyTest.cpp') diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp index 3923846226..eb7c663254 100644 --- a/tests/BitmapCopyTest.cpp +++ b/tests/BitmapCopyTest.cpp @@ -61,11 +61,11 @@ static void init_src(const SkBitmap& bitmap) { } } -static SkColorTable* init_ctable(SkAlphaType alphaType) { +static SkColorTable* init_ctable() { static const SkColor colors[] = { SK_ColorBLACK, SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE }; - return new SkColorTable(colors, SK_ARRAY_COUNT(colors), alphaType); + return new SkColorTable(colors, SK_ARRAY_COUNT(colors)); } struct Pair { @@ -196,19 +196,16 @@ static const int H = 33; static void setup_src_bitmaps(SkBitmap* srcOpaque, SkBitmap* srcPremul, SkColorType ct) { - SkColorTable* ctOpaque = NULL; - SkColorTable* ctPremul = NULL; + SkColorTable* ctable = NULL; if (kIndex_8_SkColorType == ct) { - ctOpaque = init_ctable(kOpaque_SkAlphaType); - ctPremul = init_ctable(kPremul_SkAlphaType); + ctable = init_ctable(); } srcOpaque->allocPixels(SkImageInfo::Make(W, H, ct, kOpaque_SkAlphaType), - NULL, ctOpaque); + NULL, ctable); srcPremul->allocPixels(SkImageInfo::Make(W, H, ct, kPremul_SkAlphaType), - NULL, ctPremul); - SkSafeUnref(ctOpaque); - SkSafeUnref(ctPremul); + NULL, ctable); + SkSafeUnref(ctable); init_src(*srcOpaque); init_src(*srcPremul); } @@ -384,7 +381,7 @@ DEF_TEST(BitmapCopy, reporter) { SkBitmap src, subset; SkColorTable* ct = NULL; if (kIndex_8_SkColorType == src.colorType()) { - ct = init_ctable(kPremul_SkAlphaType); + ct = init_ctable(); } int localSubW; -- cgit v1.2.3