aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/tablecolorfilter.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-03-22 07:35:17 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-22 07:35:17 -0700
commit1eb81db650d31f50be67b12d60c4f9e7dd08432f (patch)
tree58a5fd565f06a398192be170009fefa2a12a1ee2 /gm/tablecolorfilter.cpp
parentee451cf09de31267c93b64e1fdac7c823cee7e85 (diff)
Revert of switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.org/1822623002/ )
Reason for revert: need to fix unguarded makeWithFilter Original issue's description: > switch colorfilters to sk_sp > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1822623002 > > Committed: https://skia.googlesource.com/skia/+/f809d7687a4fb7b88b651b046da2bc0035d6aa09 TBR=fmalita@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1820303002
Diffstat (limited to 'gm/tablecolorfilter.cpp')
-rw-r--r--gm/tablecolorfilter.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/gm/tablecolorfilter.cpp b/gm/tablecolorfilter.cpp
index c9ca474e76..dcc29f37cf 100644
--- a/gm/tablecolorfilter.cpp
+++ b/gm/tablecolorfilter.cpp
@@ -73,27 +73,27 @@ static void make_table2(uint8_t table[]) {
}
}
-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);
+ return SkTableColorFilter::Create(table);
}
-static sk_sp<SkColorFilter> make_cf1() {
+static SkColorFilter* make_cf1() {
uint8_t table[256]; make_table1(table);
- return SkTableColorFilter::Make(table);
+ return SkTableColorFilter::Create(table);
}
-static sk_sp<SkColorFilter> make_cf2() {
+static SkColorFilter* make_cf2() {
uint8_t table[256]; make_table2(table);
- return SkTableColorFilter::Make(table);
+ return SkTableColorFilter::Create(table);
}
-static sk_sp<SkColorFilter> make_cf3() {
+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 @@ protected:
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 @@ 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]());
+ 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 @@ protected:
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 @@ protected:
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);
}