Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Unified Diff: gm/tablecolorfilter.cpp

Issue 1821103004: Revert of Revert[2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/skbug1719.cpp ('k') | gm/testimagefilters.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/tablecolorfilter.cpp
diff --git a/gm/tablecolorfilter.cpp b/gm/tablecolorfilter.cpp
index c9ca474e764564a85359d6c4df174bfeef3b3875..dcc29f37cf3d8de45cb099f15a8f3aff0259c55a 100644
--- a/gm/tablecolorfilter.cpp
+++ b/gm/tablecolorfilter.cpp
@@ -73,27 +73,27 @@
}
}
-static sk_sp<SkColorFilter> make_null_cf() {
+static SkColorFilter* make_null_cf() {
return nullptr;
}
-static sk_sp<SkColorFilter> make_cf0() {
+static SkColorFilter* make_cf0() {
uint8_t table[256]; make_table0(table);
- return SkTableColorFilter::Make(table);
-}
-static sk_sp<SkColorFilter> make_cf1() {
+ return SkTableColorFilter::Create(table);
+}
+static SkColorFilter* make_cf1() {
uint8_t table[256]; make_table1(table);
- return SkTableColorFilter::Make(table);
-}
-static sk_sp<SkColorFilter> make_cf2() {
+ return SkTableColorFilter::Create(table);
+}
+static SkColorFilter* make_cf2() {
uint8_t table[256]; make_table2(table);
- return SkTableColorFilter::Make(table);
-}
-static sk_sp<SkColorFilter> make_cf3() {
+ return SkTableColorFilter::Create(table);
+}
+static 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::MakeARGB(nullptr, table0, table1, table2);
+ return SkTableColorFilter::CreateARGB(nullptr, table0, table1, table2);
}
class TableColorFilterGM : public skiagm::GM {
@@ -114,9 +114,8 @@
canvas->translate(20, 20);
- static sk_sp<SkColorFilter> (*gColorFilterMakers[])() = {
- make_null_cf, make_cf0, make_cf1, make_cf2, make_cf3
- };
+ static 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.
@@ -156,25 +155,25 @@
// 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]());
+ paint.setColorFilter(gColorFilterMakers[i]())->unref();
canvas->drawBitmap(bm, x, y, &paint);
}
paint.setColorFilter(nullptr);
for (unsigned i = 0; i < SK_ARRAY_COUNT(gColorFilterMakers); ++i) {
- auto colorFilter1(gColorFilterMakers[i]());
+ SkAutoTUnref<SkColorFilter> colorFilter1(gColorFilterMakers[i]());
SkAutoTUnref<SkImageFilter> imageFilter1(SkColorFilterImageFilter::Create(
- colorFilter1.get(), nullptr, nullptr));
+ colorFilter1, 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) {
- auto colorFilter2(gColorFilterMakers[j]());
+ SkAutoTUnref<SkColorFilter> colorFilter2(gColorFilterMakers[j]());
SkAutoTUnref<SkImageFilter> imageFilter2(SkColorFilterImageFilter::Create(
- colorFilter2.get(), imageFilter1, nullptr));
+ colorFilter2, imageFilter1, nullptr));
paint.setImageFilter(imageFilter2);
canvas->drawBitmap(bm, x, y, &paint);
x += xOffset;
@@ -226,11 +225,11 @@
canvas->drawColor(sk_tool_utils::color_to_565(0xFFDDDDDD));
const int MODES = MODE_COUNT * COLOR_COUNT;
- sk_sp<SkColorFilter> filters[MODES];
+ SkAutoTUnref<SkColorFilter> filters[MODES];
int index = 0;
for (int i = 0; i < MODE_COUNT; ++i) {
for (int j = 0; j < COLOR_COUNT; ++j) {
- filters[index++] = SkColorFilter::MakeModeFilter(fColors[j], fModes[i]);
+ filters[index++].reset(SkColorFilter::CreateModeFilter(fColors[j], fModes[i]));
}
}
@@ -262,7 +261,9 @@
for (int y = 0; y < MODES; ++y) {
canvas->save();
for (int x = 0; x < MODES; ++x) {
- paint.setColorFilter(SkColorFilter::MakeComposeFilter(filters[y], filters[x]));
+ SkAutoTUnref<SkColorFilter> compose(SkColorFilter::CreateComposeFilter(filters[y],
+ filters[x]));
+ paint.setColorFilter(compose);
canvas->drawRect(r, paint);
canvas->translate(r.width() + spacer, 0);
}
« no previous file with comments | « gm/skbug1719.cpp ('k') | gm/testimagefilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698