Index: gm/tablecolorfilter.cpp |
diff --git a/gm/tablecolorfilter.cpp b/gm/tablecolorfilter.cpp |
index dcc29f37cf3d8de45cb099f15a8f3aff0259c55a..c9ca474e764564a85359d6c4df174bfeef3b3875 100644 |
--- a/gm/tablecolorfilter.cpp |
+++ b/gm/tablecolorfilter.cpp |
@@ -73,27 +73,27 @@ static void make_table2(uint8_t table[]) { |
} |
} |
-static SkColorFilter* make_null_cf() { |
+static sk_sp<SkColorFilter> make_null_cf() { |
return nullptr; |
} |
-static SkColorFilter* make_cf0() { |
+static sk_sp<SkColorFilter> make_cf0() { |
uint8_t table[256]; make_table0(table); |
- return SkTableColorFilter::Create(table); |
+ return SkTableColorFilter::Make(table); |
} |
-static SkColorFilter* make_cf1() { |
+static sk_sp<SkColorFilter> make_cf1() { |
uint8_t table[256]; make_table1(table); |
- return SkTableColorFilter::Create(table); |
+ return SkTableColorFilter::Make(table); |
} |
-static SkColorFilter* make_cf2() { |
+static sk_sp<SkColorFilter> make_cf2() { |
uint8_t table[256]; make_table2(table); |
- return SkTableColorFilter::Create(table); |
+ return SkTableColorFilter::Make(table); |
} |
-static SkColorFilter* make_cf3() { |
+static sk_sp<SkColorFilter> make_cf3() { |
uint8_t table0[256]; make_table0(table0); |
uint8_t table1[256]; make_table1(table1); |
uint8_t table2[256]; make_table2(table2); |
- return SkTableColorFilter::CreateARGB(nullptr, table0, table1, table2); |
+ return SkTableColorFilter::MakeARGB(nullptr, table0, table1, table2); |
} |
class TableColorFilterGM : public skiagm::GM { |
@@ -114,8 +114,9 @@ protected: |
canvas->translate(20, 20); |
- static SkColorFilter* (*gColorFilterMakers[])() = { make_null_cf, make_cf0, make_cf1, |
- make_cf2, make_cf3 }; |
+ static sk_sp<SkColorFilter> (*gColorFilterMakers[])() = { |
+ make_null_cf, make_cf0, make_cf1, make_cf2, make_cf3 |
+ }; |
static void (*gBitmapMakers[])(SkBitmap*) = { make_bm0, make_bm1 }; |
// This test will be done once for each bitmap with the results stacked vertically. |
@@ -155,25 +156,25 @@ protected: |
// each draw being at xOffset of the previous one |
for (unsigned i = 1; i < SK_ARRAY_COUNT(gColorFilterMakers); ++i) { |
x += xOffset; |
- paint.setColorFilter(gColorFilterMakers[i]())->unref(); |
+ paint.setColorFilter(gColorFilterMakers[i]()); |
canvas->drawBitmap(bm, x, y, &paint); |
} |
paint.setColorFilter(nullptr); |
for (unsigned i = 0; i < SK_ARRAY_COUNT(gColorFilterMakers); ++i) { |
- SkAutoTUnref<SkColorFilter> colorFilter1(gColorFilterMakers[i]()); |
+ auto colorFilter1(gColorFilterMakers[i]()); |
SkAutoTUnref<SkImageFilter> imageFilter1(SkColorFilterImageFilter::Create( |
- colorFilter1, nullptr, nullptr)); |
+ colorFilter1.get(), nullptr, nullptr)); |
// Move down to the next line and draw it |
// each draw being at xOffset of the previous one |
y += yOffset; |
x = 0; |
for (unsigned j = 1; j < SK_ARRAY_COUNT(gColorFilterMakers); ++j) { |
- SkAutoTUnref<SkColorFilter> colorFilter2(gColorFilterMakers[j]()); |
+ auto colorFilter2(gColorFilterMakers[j]()); |
SkAutoTUnref<SkImageFilter> imageFilter2(SkColorFilterImageFilter::Create( |
- colorFilter2, imageFilter1, nullptr)); |
+ colorFilter2.get(), imageFilter1, nullptr)); |
paint.setImageFilter(imageFilter2); |
canvas->drawBitmap(bm, x, y, &paint); |
x += xOffset; |
@@ -225,11 +226,11 @@ protected: |
canvas->drawColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); |
const int MODES = MODE_COUNT * COLOR_COUNT; |
- SkAutoTUnref<SkColorFilter> filters[MODES]; |
+ sk_sp<SkColorFilter> filters[MODES]; |
int index = 0; |
for (int i = 0; i < MODE_COUNT; ++i) { |
for (int j = 0; j < COLOR_COUNT; ++j) { |
- filters[index++].reset(SkColorFilter::CreateModeFilter(fColors[j], fModes[i])); |
+ filters[index++] = SkColorFilter::MakeModeFilter(fColors[j], fModes[i]); |
} |
} |
@@ -261,9 +262,7 @@ protected: |
for (int y = 0; y < MODES; ++y) { |
canvas->save(); |
for (int x = 0; x < MODES; ++x) { |
- SkAutoTUnref<SkColorFilter> compose(SkColorFilter::CreateComposeFilter(filters[y], |
- filters[x])); |
- paint.setColorFilter(compose); |
+ paint.setColorFilter(SkColorFilter::MakeComposeFilter(filters[y], filters[x])); |
canvas->drawRect(r, paint); |
canvas->translate(r.width() + spacer, 0); |
} |