aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/BitmapCopyTest.cpp
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-03-31 09:20:50 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-31 15:39:31 +0000
commit2e491a6a113c5e16a3b7bede5fa6f588deeb928d (patch)
treee8540e14d4ca1dd12ca3b2df5d9ef0b6f48b3a7f /tests/BitmapCopyTest.cpp
parentf3333c89bf05fc602d9bf8e1e24547668c660383 (diff)
clean up (partially) colortable api
Needs this to land: https://codereview.chromium.org/2789853002/ Bug: skia: Change-Id: I38d916a546b7fa64d000d973e695ddda24a589e7 Reviewed-on: https://skia-review.googlesource.com/10600 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
Diffstat (limited to 'tests/BitmapCopyTest.cpp')
-rw-r--r--tests/BitmapCopyTest.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index 70958cae55..4578bbb7d7 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -62,11 +62,11 @@ static void init_src(const SkBitmap& bitmap) {
}
}
-static SkColorTable* init_ctable() {
+static sk_sp<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));
+ return SkColorTable::Make(colors, SK_ARRAY_COUNT(colors));
}
struct Pair {
@@ -194,16 +194,13 @@ static const int H = 33;
static void setup_src_bitmaps(SkBitmap* srcOpaque, SkBitmap* srcPremul,
SkColorType ct) {
- SkColorTable* ctable = nullptr;
+ sk_sp<SkColorTable> ctable;
if (kIndex_8_SkColorType == ct) {
ctable = init_ctable();
}
- srcOpaque->allocPixels(SkImageInfo::Make(W, H, ct, kOpaque_SkAlphaType),
- nullptr, ctable);
- srcPremul->allocPixels(SkImageInfo::Make(W, H, ct, kPremul_SkAlphaType),
- nullptr, ctable);
- SkSafeUnref(ctable);
+ srcOpaque->allocPixels(SkImageInfo::Make(W, H, ct, kOpaque_SkAlphaType), ctable);
+ srcPremul->allocPixels(SkImageInfo::Make(W, H, ct, kPremul_SkAlphaType), ctable);
init_src(*srcOpaque);
init_src(*srcPremul);
}
@@ -378,7 +375,7 @@ DEF_TEST(BitmapCopy, reporter) {
// Create bitmap to act as source for copies and subsets.
SkBitmap src, subset;
- SkColorTable* ct = nullptr;
+ sk_sp<SkColorTable> ct;
if (kIndex_8_SkColorType == src.colorType()) {
ct = init_ctable();
}
@@ -394,7 +391,6 @@ DEF_TEST(BitmapCopy, reporter) {
kPremul_SkAlphaType))) {
// failure is fine, as we will notice later on
}
- SkSafeUnref(ct);
// Either copy src or extract into 'subset', which is used
// for subsequent calls to copyPixelsTo/From.