aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
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
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')
-rw-r--r--gm/blurredclippedcircle.cpp4
-rw-r--r--gm/blurroundrect.cpp5
-rw-r--r--gm/color4f.cpp22
-rw-r--r--gm/colorcube.cpp47
-rw-r--r--gm/coloremoji.cpp4
-rw-r--r--gm/colorfilterimagefilter.cpp37
-rw-r--r--gm/colorfilters.cpp2
-rw-r--r--gm/colormatrix.cpp4
-rw-r--r--gm/dropshadowimagefilter.cpp3
-rw-r--r--gm/emboss.cpp2
-rw-r--r--gm/fadefilter.cpp6
-rw-r--r--gm/imagefilters.cpp4
-rw-r--r--gm/imagefiltersbase.cpp8
-rw-r--r--gm/imagefilterscropexpand.cpp6
-rw-r--r--gm/imagefilterscropped.cpp3
-rw-r--r--gm/imagefiltersgraph.cpp23
-rw-r--r--gm/lumafilter.cpp8
-rw-r--r--gm/megalooper.cpp7
-rw-r--r--gm/modecolorfilters.cpp4
-rw-r--r--gm/multipicturedraw.cpp2
-rw-r--r--gm/recordopts.cpp10
-rw-r--r--gm/skbug1719.cpp3
-rw-r--r--gm/tablecolorfilter.cpp41
-rw-r--r--gm/testimagefilters.cpp18
-rw-r--r--gm/textbloblooper.cpp2
-rw-r--r--gm/tileimagefilter.cpp4
-rw-r--r--gm/vertices.cpp28
27 files changed, 174 insertions, 133 deletions
diff --git a/gm/blurredclippedcircle.cpp b/gm/blurredclippedcircle.cpp
index 3bbff755e9..d1d374c7d4 100644
--- a/gm/blurredclippedcircle.cpp
+++ b/gm/blurredclippedcircle.cpp
@@ -67,9 +67,9 @@ protected:
kNormal_SkBlurStyle,
1.366025f,
SkBlurMaskFilter::kHighQuality_BlurFlag))->unref();
- paint.setColorFilter(SkColorFilter::MakeModeFilter(
+ paint.setColorFilter(SkColorFilter::CreateModeFilter(
SK_ColorRED,
- SkXfermode::kSrcIn_Mode));
+ SkXfermode::kSrcIn_Mode))->unref();
paint.setAntiAlias(true);
canvas->drawRRect(rr, paint);
diff --git a/gm/blurroundrect.cpp b/gm/blurroundrect.cpp
index 9135ba099f..fe4a939946 100644
--- a/gm/blurroundrect.cpp
+++ b/gm/blurroundrect.cpp
@@ -60,9 +60,10 @@ public:
SkBlurMask::ConvertRadiusToSigma(SK_ScalarHalf),
SkBlurMaskFilter::kHighQuality_BlurFlag);
paint->setMaskFilter(maskFilter)->unref();
- paint->setColorFilter(SkColorFilter::MakeModeFilter(
+ SkColorFilter* colorFilter = SkColorFilter::CreateModeFilter(
sk_tool_utils::color_to_565(SK_ColorLTGRAY),
- SkXfermode::kSrcIn_Mode));
+ SkXfermode::kSrcIn_Mode);
+ paint->setColorFilter(colorFilter)->unref();
paint->setColor(sk_tool_utils::color_to_565(SK_ColorGRAY));
}
{
diff --git a/gm/color4f.cpp b/gm/color4f.cpp
index ec9bbcbfba..2d5b7d2c1a 100644
--- a/gm/color4f.cpp
+++ b/gm/color4f.cpp
@@ -22,43 +22,43 @@ static sk_sp<SkShader> make_alpha_color() {
return SkShader::MakeColorShader(0x80FF0000);
}
-static sk_sp<SkColorFilter> make_cf_null() {
+static SkColorFilter* make_cf_null() {
return nullptr;
}
-static sk_sp<SkColorFilter> make_cf0() {
+static SkColorFilter* make_cf0() {
SkColorMatrix cm;
cm.setSaturation(0.75f);
- return SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat);
+ return SkColorMatrixFilter::Create(cm);
}
-static sk_sp<SkColorFilter> make_cf1() {
+static SkColorFilter* make_cf1() {
SkColorMatrix cm;
cm.setSaturation(0.75f);
- auto a(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat));
+ SkAutoTUnref<SkColorFilter> a(SkColorMatrixFilter::Create(cm));
// CreateComposedFilter will try to concat these two matrices, resulting in a single
// filter (which is good for speed). For this test, we want to force a real compose of
// these two, so our inner filter has a scale-up, which disables the optimization of
// combining the two matrices.
cm.setScale(1.1f, 0.9f, 1);
- auto b(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat));
- return SkColorFilter::MakeComposeFilter(a, b);
+ SkAutoTUnref<SkColorFilter> b(SkColorMatrixFilter::Create(cm));
+ return SkColorFilter::CreateComposeFilter(a, b);
}
-static sk_sp<SkColorFilter> make_cf2() {
- return SkColorFilter::MakeModeFilter(0x8044CC88, SkXfermode::kSrcATop_Mode);
+static SkColorFilter* make_cf2() {
+ return SkColorFilter::CreateModeFilter(0x8044CC88, SkXfermode::kSrcATop_Mode);
}
static void draw_into_canvas(SkCanvas* canvas) {
const SkRect r = SkRect::MakeWH(50, 100);
sk_sp<SkShader> (*shaders[])() { make_opaque_color, make_alpha_color };
- sk_sp<SkColorFilter> (*filters[])() { make_cf_null, make_cf0, make_cf1, make_cf2 };
+ SkColorFilter* (*filters[])() { make_cf_null, make_cf0, make_cf1, make_cf2 };
SkPaint paint;
for (auto shProc : shaders) {
paint.setShader(shProc());
for (auto cfProc : filters) {
- paint.setColorFilter(cfProc());
+ SkSafeUnref(paint.setColorFilter(cfProc()));
canvas->drawRect(r, paint);
canvas->translate(60, 0);
}
diff --git a/gm/colorcube.cpp b/gm/colorcube.cpp
index 54e0688c6a..01aaf15610 100644
--- a/gm/colorcube.cpp
+++ b/gm/colorcube.cpp
@@ -25,12 +25,27 @@ static sk_sp<SkShader> MakeLinear() {
class ColorCubeGM : public GM {
public:
- ColorCubeGM() : fInitialized(false) {
+ ColorCubeGM()
+ : fInitialized(false)
+ , f3DLut4(nullptr)
+ , f3DLut8(nullptr)
+ , f3DLut16(nullptr)
+ , f3DLut32(nullptr)
+ , f3DLut64(nullptr)
+ {
this->setBGColor(0xFF000000);
}
+ ~ColorCubeGM() {
+ SkSafeUnref(f3DLut4);
+ SkSafeUnref(f3DLut8);
+ SkSafeUnref(f3DLut16);
+ SkSafeUnref(f3DLut32);
+ SkSafeUnref(f3DLut64);
+ }
+
protected:
- SkString onShortName() override {
+ virtual SkString onShortName() {
return SkString("colorcube");
}
@@ -52,8 +67,8 @@ protected:
canvas.drawRect(SkRect::MakeWH(80, 80), paint);
}
- void make_3Dlut(sk_sp<SkData>* data, int size, bool invR, bool invG, bool invB) {
- *data = SkData::MakeUninitialized(sizeof(SkColor) * size * size * size);
+ void make_3Dlut(SkData** data, int size, bool invR, bool invG, bool invB) {
+ *data = SkData::NewUninitialized(sizeof(SkColor) * size * size * size);
SkColor* pixels = (SkColor*)((*data)->writable_data());
SkAutoTMalloc<uint8_t> lutMemory(size);
SkAutoTMalloc<uint8_t> invLutMemory(size);
@@ -77,11 +92,11 @@ protected:
}
}
- SkISize onISize() override {
+ virtual SkISize onISize() {
return SkISize::Make(500, 100);
}
- void onDraw(SkCanvas* canvas) override {
+ virtual void onDraw(SkCanvas* canvas) {
if (!fInitialized) {
this->make_bitmap();
this->make_3Dluts();
@@ -89,19 +104,19 @@ protected:
}
canvas->clear(0x00000000);
SkPaint paint;
- paint.setColorFilter(SkColorCubeFilter::Make(f3DLut4, 4));
+ paint.setColorFilter(SkColorCubeFilter::Create(f3DLut4, 4))->unref();
canvas->drawBitmap(fBitmap, 10, 10, &paint);
- paint.setColorFilter(SkColorCubeFilter::Make(f3DLut8, 8));
+ paint.setColorFilter(SkColorCubeFilter::Create(f3DLut8, 8))->unref();
canvas->drawBitmap(fBitmap, 110, 10, &paint);
- paint.setColorFilter(SkColorCubeFilter::Make(f3DLut16, 16));
+ paint.setColorFilter(SkColorCubeFilter::Create(f3DLut16, 16))->unref();
canvas->drawBitmap(fBitmap, 210, 10, &paint);
- paint.setColorFilter(SkColorCubeFilter::Make(f3DLut32, 32));
+ paint.setColorFilter(SkColorCubeFilter::Create(f3DLut32, 32))->unref();
canvas->drawBitmap(fBitmap, 310, 10, &paint);
- paint.setColorFilter(SkColorCubeFilter::Make(f3DLut64, 64));
+ paint.setColorFilter(SkColorCubeFilter::Create(f3DLut64, 64))->unref();
canvas->drawBitmap(fBitmap, 410, 10, &paint);
}
@@ -109,11 +124,11 @@ private:
typedef GM INHERITED;
bool fInitialized;
SkBitmap fBitmap;
- sk_sp<SkData> f3DLut4;
- sk_sp<SkData> f3DLut8;
- sk_sp<SkData> f3DLut16;
- sk_sp<SkData> f3DLut32;
- sk_sp<SkData> f3DLut64;
+ SkData* f3DLut4;
+ SkData* f3DLut8;
+ SkData* f3DLut16;
+ SkData* f3DLut32;
+ SkData* f3DLut64;
};
//////////////////////////////////////////////////////////////////////////////
diff --git a/gm/coloremoji.cpp b/gm/coloremoji.cpp
index 4be8202d19..78c347c079 100644
--- a/gm/coloremoji.cpp
+++ b/gm/coloremoji.cpp
@@ -34,8 +34,8 @@ static SkImageFilter* make_grayscale(SkImageFilter* input = nullptr) {
matrix[1] = matrix[6] = matrix[11] = 0.7152f;
matrix[2] = matrix[7] = matrix[12] = 0.0722f;
matrix[18] = 1.0f;
- auto filter(SkColorFilter::MakeMatrixFilterRowMajor255(matrix));
- return SkColorFilterImageFilter::Create(filter.get(), input);
+ SkAutoTUnref<SkColorFilter> filter(SkColorMatrixFilter::Create(matrix));
+ return SkColorFilterImageFilter::Create(filter, input);
}
static SkImageFilter* make_blur(float amount, SkImageFilter* input = nullptr) {
diff --git a/gm/colorfilterimagefilter.cpp b/gm/colorfilterimagefilter.cpp
index 497757e128..f72108f433 100644
--- a/gm/colorfilterimagefilter.cpp
+++ b/gm/colorfilterimagefilter.cpp
@@ -18,34 +18,34 @@
#define FILTER_HEIGHT SkIntToScalar(30)
#define MARGIN SkIntToScalar(10)
-static sk_sp<SkColorFilter> cf_make_brightness(float brightness) {
+static SkColorFilter* cf_make_brightness(float brightness) {
SkScalar amount255 = SkScalarMul(brightness, SkIntToScalar(255));
SkScalar matrix[20] = {
1, 0, 0, 0, amount255,
0, 1, 0, 0, amount255,
0, 0, 1, 0, amount255,
0, 0, 0, 1, 0 };
- return SkColorFilter::MakeMatrixFilterRowMajor255(matrix);
+ return SkColorMatrixFilter::Create(matrix);
}
-static sk_sp<SkColorFilter> cf_make_grayscale() {
+static SkColorFilter* cf_make_grayscale() {
SkScalar matrix[20];
memset(matrix, 0, 20 * sizeof(SkScalar));
matrix[0] = matrix[5] = matrix[10] = 0.2126f;
matrix[1] = matrix[6] = matrix[11] = 0.7152f;
matrix[2] = matrix[7] = matrix[12] = 0.0722f;
matrix[18] = 1.0f;
- return SkColorFilter::MakeMatrixFilterRowMajor255(matrix);
+ return SkColorMatrixFilter::Create(matrix);
}
-static sk_sp<SkColorFilter> cf_make_colorize(SkColor color) {
- return SkColorFilter::MakeModeFilter(color, SkXfermode::kSrc_Mode);
+static SkColorFilter* cf_make_colorize(SkColor color) {
+ return SkColorFilter::CreateModeFilter(color, SkXfermode::kSrc_Mode);
}
-static void sk_gm_get_colorfilters(SkTArray<sk_sp<SkColorFilter>>* array) {
- array->push_back(cf_make_brightness(0.5f));
- array->push_back(cf_make_grayscale());
- array->push_back(cf_make_colorize(SK_ColorBLUE));
+static void sk_gm_get_colorfilters(SkTDArray<SkColorFilter*>* array) {
+ *array->append() = cf_make_brightness(0.5f);
+ *array->append() = cf_make_grayscale();
+ *array->append() = cf_make_colorize(SK_ColorBLUE);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -92,15 +92,18 @@ static SkImageFilter* make_blur(float amount, SkImageFilter* input = nullptr) {
}
static SkImageFilter* make_brightness(float amount, SkImageFilter* input = nullptr) {
- return SkColorFilterImageFilter::Create(cf_make_brightness(amount).get(), input);
+ SkAutoTUnref<SkColorFilter> filter(cf_make_brightness(amount));
+ return SkColorFilterImageFilter::Create(filter, input);
}
static SkImageFilter* make_grayscale(SkImageFilter* input = nullptr) {
- return SkColorFilterImageFilter::Create(cf_make_grayscale().get(), input);
+ SkAutoTUnref<SkColorFilter> filter(cf_make_grayscale());
+ return SkColorFilterImageFilter::Create(filter, input);
}
static SkImageFilter* make_mode_blue(SkImageFilter* input = nullptr) {
- return SkColorFilterImageFilter::Create(cf_make_colorize(SK_ColorBLUE).get(), input);
+ SkAutoTUnref<SkColorFilter> filter(cf_make_colorize(SK_ColorBLUE));
+ return SkColorFilterImageFilter::Create(filter, input);
}
static void drawClippedRect(SkCanvas* canvas,
@@ -176,8 +179,8 @@ DEF_SIMPLE_GM(colorfilterimagefilter_layer, canvas, 32, 32) {
SkAutoCanvasRestore autoCanvasRestore(canvas, false);
SkColorMatrix cm;
cm.setSaturation(0.0f);
- auto cf(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat));
- SkAutoTUnref<SkImageFilter> imf(SkColorFilterImageFilter::Create(cf.get()));
+ SkAutoTUnref<SkColorFilter> cf(SkColorMatrixFilter::Create(cm));
+ SkAutoTUnref<SkImageFilter> imf(SkColorFilterImageFilter::Create(cf));
SkPaint p;
p.setImageFilter(imf);
canvas->saveLayer(NULL, &p);
@@ -192,7 +195,7 @@ public:
};
DEF_SIMPLE_GM(colorfiltershader, canvas, 800, 800) {
- SkTArray<sk_sp<SkColorFilter>> filters;
+ SkTRefArray<SkColorFilter*> filters;
sk_gm_get_colorfilters(&filters);
SkTRefArray<SkShader*> shaders;
@@ -207,7 +210,7 @@ DEF_SIMPLE_GM(colorfiltershader, canvas, 800, 800) {
canvas->save();
for (int x = -1; x < filters.count(); ++x) {
- sk_sp<SkColorFilter> filter = x >= 0 ? filters[x] : nullptr;
+ SkColorFilter* filter = x >= 0 ? filters[x] : nullptr;
paint.setShader(shader->makeWithColorFilter(filter));
canvas->drawRect(r, paint);
diff --git a/gm/colorfilters.cpp b/gm/colorfilters.cpp
index 635298533b..eaee39dd55 100644
--- a/gm/colorfilters.cpp
+++ b/gm/colorfilters.cpp
@@ -30,7 +30,7 @@ static void install_nothing(SkPaint* paint, uint32_t, uint32_t) {
}
static void install_lighting(SkPaint* paint, uint32_t mul, uint32_t add) {
- paint->setColorFilter(SkColorMatrixFilter::MakeLightingFilter(mul, add));
+ paint->setColorFilter(SkColorMatrixFilter::CreateLightingFilter(mul, add))->unref();
}
class ColorFiltersGM : public skiagm::GM {
diff --git a/gm/colormatrix.cpp b/gm/colormatrix.cpp
index 8ac15dba8e..de80ebb64b 100644
--- a/gm/colormatrix.cpp
+++ b/gm/colormatrix.cpp
@@ -14,11 +14,11 @@
#define HEIGHT 500
static void set_color_matrix(SkPaint* paint, const SkColorMatrix& matrix) {
- paint->setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(matrix.fMat));
+ paint->setColorFilter(SkColorMatrixFilter::Create(matrix))->unref();
}
static void set_array(SkPaint* paint, const SkScalar array[]) {
- paint->setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(array));
+ paint->setColorFilter(SkColorMatrixFilter::Create(array))->unref();
}
class ColorMatrixGM : public skiagm::GM {
diff --git a/gm/dropshadowimagefilter.cpp b/gm/dropshadowimagefilter.cpp
index 567ef803b5..512c82de01 100644
--- a/gm/dropshadowimagefilter.cpp
+++ b/gm/dropshadowimagefilter.cpp
@@ -93,7 +93,8 @@ protected:
draw_bitmap, draw_path, draw_paint, draw_text
};
- auto cf(SkColorFilter::MakeModeFilter(SK_ColorMAGENTA, SkXfermode::kSrcIn_Mode));
+ SkAutoTUnref<SkColorFilter> cf(
+ SkColorFilter::CreateModeFilter(SK_ColorMAGENTA, SkXfermode::kSrcIn_Mode));
SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf.get()));
SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)),
SkImageFilter::CropRect::kHasAll_CropEdge);
diff --git a/gm/emboss.cpp b/gm/emboss.cpp
index 5773577389..20d3c91890 100644
--- a/gm/emboss.cpp
+++ b/gm/emboss.cpp
@@ -49,7 +49,7 @@ protected:
// this combination of emboss+colorfilter used to crash -- so we exercise it to
// confirm that we have a fix.
- paint.setColorFilter(SkColorFilter::MakeModeFilter(0xFFFF0000, SkXfermode::kSrcATop_Mode));
+ paint.setColorFilter(SkColorFilter::CreateModeFilter(0xFFFF0000, SkXfermode::kSrcATop_Mode))->unref();
canvas->translate(bm.width() + SkIntToScalar(10), 0);
canvas->drawBitmap(bm, 10, 10, &paint);
}
diff --git a/gm/fadefilter.cpp b/gm/fadefilter.cpp
index 386e32b098..6f64e1e30e 100644
--- a/gm/fadefilter.cpp
+++ b/gm/fadefilter.cpp
@@ -15,8 +15,10 @@ DEF_SIMPLE_GM(fadefilter, canvas, 256, 256) {
0, 1, 0, 0, 128.0f,
0, 0, 1, 0, 128.0f,
0, 0, 0, 1, 0 };
- auto colorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(matrix));
- SkAutoTUnref<SkImageFilter> filter(SkColorFilterImageFilter::Create(colorFilter.get()));
+ SkAutoTUnref<SkColorFilter> colorFilter(
+ SkColorMatrixFilter::Create(matrix));
+ SkAutoTUnref<SkImageFilter> filter(
+ SkColorFilterImageFilter::Create(colorFilter));
SkPaint layerPaint;
layerPaint.setImageFilter(filter);
canvas->drawRect(SkRect::MakeLTRB(64, 64, 192, 192), layerPaint);
diff --git a/gm/imagefilters.cpp b/gm/imagefilters.cpp
index 21ce0fef97..24a08ff865 100644
--- a/gm/imagefilters.cpp
+++ b/gm/imagefilters.cpp
@@ -140,7 +140,7 @@ static void draw_set(SkCanvas* canvas, SkImageFilter* filters[], int count) {
DEF_SIMPLE_GM(savelayer_with_backdrop, canvas, 830, 550) {
SkColorMatrix cm;
cm.setSaturation(10);
- auto cf(SkColorFilter::MakeMatrixFilterRowMajor255(cm.fMat));
+ SkAutoTUnref<SkColorFilter> cf(SkColorMatrixFilter::Create(cm));
const SkScalar kernel[] = { 4, 0, 4, 0, -15, 0, 4, 0, 4 };
SkImageFilter* filters[] = {
SkBlurImageFilter::Create(10, 10),
@@ -148,7 +148,7 @@ DEF_SIMPLE_GM(savelayer_with_backdrop, canvas, 830, 550) {
SkMatrixConvolutionImageFilter::Create({ 3, 3 }, kernel, 1, 0, { 0, 0 },
SkMatrixConvolutionImageFilter::kClampToBlack_TileMode,
true),
- SkColorFilterImageFilter::Create(cf.get()),
+ SkColorFilterImageFilter::Create(cf),
};
const struct {
diff --git a/gm/imagefiltersbase.cpp b/gm/imagefiltersbase.cpp
index ca8a2d421a..a55328a999 100644
--- a/gm/imagefiltersbase.cpp
+++ b/gm/imagefiltersbase.cpp
@@ -192,16 +192,18 @@ protected:
draw_bitmap,
};
- auto cf = SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode);
+ SkColorFilter* cf = SkColorFilter::CreateModeFilter(SK_ColorRED,
+ SkXfermode::kSrcIn_Mode);
SkImageFilter* filters[] = {
nullptr,
IdentityImageFilter::Create(),
FailImageFilter::Create(),
- SkColorFilterImageFilter::Create(cf.get()),
+ SkColorFilterImageFilter::Create(cf),
SkBlurImageFilter::Create(12.0f, 0.0f),
SkDropShadowImageFilter::Create(10.0f, 5.0f, 3.0f, 3.0f, SK_ColorBLUE,
SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode),
};
+ cf->unref();
SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64));
SkScalar MARGIN = SkIntToScalar(16);
@@ -318,7 +320,7 @@ public:
ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {}
void installFilter(SkPaint* paint) override {
- paint->setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode));
+ paint->setColorFilter(SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode))->unref();
}
};
DEF_GM( return new ImageFiltersText_CF; )
diff --git a/gm/imagefilterscropexpand.cpp b/gm/imagefilterscropexpand.cpp
index ada206cea4..f3ca4d32a6 100644
--- a/gm/imagefilterscropexpand.cpp
+++ b/gm/imagefilterscropexpand.cpp
@@ -40,6 +40,8 @@ protected:
SkISize onISize() override { return SkISize::Make(730, 650); }
void onDraw(SkCanvas* canvas) override {
+ SkAutoTUnref<SkColorFilter> cf(
+ SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode));
SkImageFilter::CropRect cropRect(
SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)),
SkImageFilter::CropRect::kHasAll_CropEdge);
@@ -57,7 +59,7 @@ protected:
0, 1, 0, 0, sk255,
0, 0, 1, 0, 0,
0, 0, 0, 0, sk255 };
- auto cfAlphaTrans(SkColorFilter::MakeMatrixFilterRowMajor255(matrix));
+ SkAutoTUnref<SkColorFilter> cfAlphaTrans(SkColorMatrixFilter::Create(matrix));
SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64));
SkScalar MARGIN = SkIntToScalar(12);
@@ -78,7 +80,7 @@ protected:
SkImageFilter::CropRect bigRect(rect, SkImageFilter::CropRect::kHasAll_CropEdge);
Draw(canvas, checkerboard, rect, SkColorFilterImageFilter::Create(
- cfAlphaTrans.get(), noopCropped.get(), &bigRect));
+ cfAlphaTrans, noopCropped.get(), &bigRect));
Draw(canvas, checkerboard, rect, SkBlurImageFilter::Create(
0.3f, 0.3f, noopCropped.get(), &bigRect));
diff --git a/gm/imagefilterscropped.cpp b/gm/imagefilterscropped.cpp
index b06761d80c..d39e6b026a 100644
--- a/gm/imagefilterscropped.cpp
+++ b/gm/imagefilterscropped.cpp
@@ -115,7 +115,8 @@ protected:
draw_bitmap, draw_path, draw_paint, draw_text
};
- auto cf(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode));
+ SkAutoTUnref<SkColorFilter> cf(
+ SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode));
SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)), SkImageFilter::CropRect::kHasAll_CropEdge);
SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, -100, 10, 10)), SkImageFilter::CropRect::kHasAll_CropEdge);
diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp
index 547a3bbbe2..fa9c512591 100644
--- a/gm/imagefiltersgraph.cpp
+++ b/gm/imagefiltersgraph.cpp
@@ -119,10 +119,11 @@ protected:
canvas->clear(SK_ColorBLACK);
{
SkAutoTUnref<SkImageFilter> bitmapSource(SkImageSource::Create(fImage.get()));
- auto cf(SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode));
+ SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED,
+ SkXfermode::kSrcIn_Mode));
SkAutoTUnref<SkImageFilter> blur(SkBlurImageFilter::Create(4.0f, 4.0f, bitmapSource));
SkAutoTUnref<SkImageFilter> erode(SkErodeImageFilter::Create(4, 4, blur));
- SkAutoTUnref<SkImageFilter> color(SkColorFilterImageFilter::Create(cf.get(), erode));
+ SkAutoTUnref<SkImageFilter> color(SkColorFilterImageFilter::Create(cf, erode));
SkAutoTUnref<SkImageFilter> merge(SkMergeImageFilter::Create(blur, color));
SkPaint paint;
@@ -138,8 +139,8 @@ protected:
0, 0, SK_Scalar1, 0, 0,
0, 0, 0, 0.5f, 0 };
- auto matrixFilter(SkColorFilter::MakeMatrixFilterRowMajor255(matrix));
- SkAutoTUnref<SkImageFilter> colorMorph(SkColorFilterImageFilter::Create(matrixFilter.get(), morph));
+ SkAutoTUnref<SkColorFilter> matrixFilter(SkColorMatrixFilter::Create(matrix));
+ SkAutoTUnref<SkImageFilter> colorMorph(SkColorFilterImageFilter::Create(matrixFilter, morph));
SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kSrcOver_Mode));
SkAutoTUnref<SkImageFilter> blendColor(SkXfermodeImageFilter::Create(mode, colorMorph));
@@ -153,8 +154,8 @@ protected:
0, SK_Scalar1, 0, 0, 0,
0, 0, SK_Scalar1, 0, 0,
0, 0, 0, 0.5f, 0 };
- auto matrixCF(SkColorFilter::MakeMatrixFilterRowMajor255(matrix));
- SkAutoTUnref<SkImageFilter> matrixFilter(SkColorFilterImageFilter::Create(matrixCF.get()));
+ SkAutoTUnref<SkColorFilter> matrixCF(SkColorMatrixFilter::Create(matrix));
+ SkAutoTUnref<SkImageFilter> matrixFilter(SkColorFilterImageFilter::Create(matrixCF));
SkAutoTUnref<SkImageFilter> offsetFilter(
SimpleOffsetFilter::Create(10.0f, 10.f, matrixFilter));
@@ -217,14 +218,16 @@ protected:
}
{
// Test that crop offsets are absolute, not relative to the parent's crop rect.
- auto cf1(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode));
- auto cf2(SkColorFilter::MakeModeFilter(SK_ColorGREEN, SkXfermode::kSrcIn_Mode));
+ SkAutoTUnref<SkColorFilter> cf1(SkColorFilter::CreateModeFilter(SK_ColorBLUE,
+ SkXfermode::kSrcIn_Mode));
+ SkAutoTUnref<SkColorFilter> cf2(SkColorFilter::CreateModeFilter(SK_ColorGREEN,
+ SkXfermode::kSrcIn_Mode));
SkImageFilter::CropRect outerRect(SkRect::MakeXYWH(SkIntToScalar(10), SkIntToScalar(10),
SkIntToScalar(80), SkIntToScalar(80)));
SkImageFilter::CropRect innerRect(SkRect::MakeXYWH(SkIntToScalar(20), SkIntToScalar(20),
SkIntToScalar(60), SkIntToScalar(60)));
- SkAutoTUnref<SkImageFilter> color1(SkColorFilterImageFilter::Create(cf1.get(), nullptr, &outerRect));
- SkAutoTUnref<SkImageFilter> color2(SkColorFilterImageFilter::Create(cf2.get(), color1, &innerRect));
+ SkAutoTUnref<SkImageFilter> color1(SkColorFilterImageFilter::Create(cf1, nullptr, &outerRect));
+ SkAutoTUnref<SkImageFilter> color2(SkColorFilterImageFilter::Create(cf2, color1, &innerRect));
SkPaint paint;
paint.setImageFilter(color2);
diff --git a/gm/lumafilter.cpp b/gm/lumafilter.cpp
index 10eefabd56..adffd008c1 100644
--- a/gm/lumafilter.cpp
+++ b/gm/lumafilter.cpp
@@ -26,7 +26,7 @@ static void draw_label(SkCanvas* canvas, const char* label,
paint);
}
-static void draw_scene(SkCanvas* canvas, const sk_sp<SkColorFilter>& filter, SkXfermode::Mode mode,
+static void draw_scene(SkCanvas* canvas, SkColorFilter* filter, SkXfermode::Mode mode,
const sk_sp<SkShader>& s1, const sk_sp<SkShader>& s2) {
SkPaint paint;
paint.setAntiAlias(true);
@@ -83,7 +83,7 @@ public:
SkPoint g2Points[] = { { 0, 0 }, { kSize, 0 } };
SkScalar pos[] = { 0.2f, 1.0f };
- fFilter = SkLumaColorFilter::Make();
+ fFilter.reset(SkLumaColorFilter::Create());
fGr1 = SkGradientShader::MakeLinear(g1Points, g1Colors, pos, SK_ARRAY_COUNT(g1Colors),
SkShader::kClamp_TileMode);
fGr2 = SkGradientShader::MakeLinear(g2Points, g2Colors, pos, SK_ARRAY_COUNT(g2Colors),
@@ -137,8 +137,8 @@ protected:
}
private:
- sk_sp<SkColorFilter> fFilter;
- sk_sp<SkShader> fGr1, fGr2;
+ SkAutoTUnref<SkColorFilter> fFilter;
+ sk_sp<SkShader> fGr1, fGr2;
typedef skiagm::GM INHERITED;
};
diff --git a/gm/megalooper.cpp b/gm/megalooper.cpp
index 6f5640272f..5fe9af298b 100644
--- a/gm/megalooper.cpp
+++ b/gm/megalooper.cpp
@@ -175,7 +175,8 @@ private:
paint->setMaskFilter(this->createBlur())->unref();
- paint->setColorFilter(SkColorFilter::MakeModeFilter(color, SkXfermode::kSrcIn_Mode));
+ SkColorFilter* cf = SkColorFilter::CreateModeFilter(color, SkXfermode::kSrcIn_Mode);
+ paint->setColorFilter(cf)->unref();
return looperBuilder.detach();
}
@@ -221,8 +222,8 @@ private:
paint->setMaskFilter(this->createBlur())->unref();
- paint->setColorFilter(SkColorFilter::MakeModeFilter(gColors[i],
- SkXfermode::kSrcIn_Mode));
+ SkColorFilter* cf = SkColorFilter::CreateModeFilter(gColors[i], SkXfermode::kSrcIn_Mode);
+ paint->setColorFilter(cf)->unref();
}
return looperBuilder.detach();
diff --git a/gm/modecolorfilters.cpp b/gm/modecolorfilters.cpp
index 4e5d45cf96..de6a18a41c 100644
--- a/gm/modecolorfilters.cpp
+++ b/gm/modecolorfilters.cpp
@@ -121,7 +121,9 @@ protected:
static const int kRectsPerRow = SkMax32(this->getISize().fWidth / kRectWidth, 1);
for (size_t cfm = 0; cfm < SK_ARRAY_COUNT(modes); ++cfm) {
for (size_t cfc = 0; cfc < SK_ARRAY_COUNT(colors); ++cfc) {
- paint.setColorFilter(SkColorFilter::MakeModeFilter(colors[cfc], modes[cfm]));
+ SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(colors[cfc],
+ modes[cfm]));
+ paint.setColorFilter(cf);
for (size_t s = 0; s < SK_ARRAY_COUNT(shaders); ++s) {
paint.setShader(shaders[s]);
bool hasShader = nullptr == paint.getShader();
diff --git a/gm/multipicturedraw.cpp b/gm/multipicturedraw.cpp
index a4b09b2c2f..1f302ee57a 100644
--- a/gm/multipicturedraw.cpp
+++ b/gm/multipicturedraw.cpp
@@ -420,7 +420,7 @@ static void tiled(SkCanvas* finalCanvas, SkMultiPictureDraw* mpd,
step.fY = SkIntToScalar(y*kTileHeight);
step.fPaint = new SkPaint;
step.fPaint->setColorFilter(
- SkColorFilter::MakeModeFilter(colors[x][y], SkXfermode::kModulate_Mode));
+ SkColorFilter::CreateModeFilter(colors[x][y], SkXfermode::kModulate_Mode))->unref();
step.fSurf = create_compat_surface(finalCanvas, kTileWidth, kTileHeight);
diff --git a/gm/recordopts.cpp b/gm/recordopts.cpp
index bac6d8858c..97d13cb9c9 100644
--- a/gm/recordopts.cpp
+++ b/gm/recordopts.cpp
@@ -22,26 +22,26 @@ static const int kDetectorGreenValue = 50;
// kDetectorGreenValue and then the incorrect value is observable by some part of the drawing
// pipeline, that pixel will remain empty.
-static sk_sp<SkColorFilter> make_detector_color_filter() {
+static SkColorFilter* make_detector_color_filter() {
uint8_t tableA[256] = { 0, };
uint8_t tableR[256] = { 0, };
uint8_t tableG[256] = { 0, };
uint8_t tableB[256] = { 0, };
tableA[255] = 255;
tableG[kDetectorGreenValue] = 255;
- return SkTableColorFilter::MakeARGB(tableA, tableR, tableG, tableB);
+ return SkTableColorFilter::CreateARGB(tableA, tableR, tableG, tableB);
}
// This detector detects that color filter phase of the pixel pipeline receives the correct value.
static void install_detector_color_filter(SkPaint* drawPaint) {
- drawPaint->setColorFilter(make_detector_color_filter());
+ drawPaint->setColorFilter(make_detector_color_filter())->unref();
}
// This detector detects that image filter phase of the pixel pipeline receives the correct value.
static void install_detector_image_filter(SkPaint* drawPaint) {
- auto colorFilter(make_detector_color_filter());
+ SkAutoTUnref<SkColorFilter> colorFilter(make_detector_color_filter());
SkImageFilter* imageFilter =
- SkColorFilterImageFilter::Create(colorFilter.get(), drawPaint->getImageFilter());
+ SkColorFilterImageFilter::Create(colorFilter, drawPaint->getImageFilter());
drawPaint->setImageFilter(imageFilter)->unref();
}
diff --git a/gm/skbug1719.cpp b/gm/skbug1719.cpp
index 3358de5525..23c0c5fec0 100644
--- a/gm/skbug1719.cpp
+++ b/gm/skbug1719.cpp
@@ -64,7 +64,8 @@ DEF_SIMPLE_GM_BG(skbug1719, canvas, 300, 100,
SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
0.78867501f,
SkBlurMaskFilter::kHighQuality_BlurFlag))->unref();
- paint.setColorFilter(SkColorFilter::MakeModeFilter(0xBFFFFFFF, SkXfermode::kSrcIn_Mode));
+ paint.setColorFilter(
+ SkColorFilter::CreateModeFilter(0xBFFFFFFF, SkXfermode::kSrcIn_Mode))->unref();
canvas->clipPath(clipPath, SkRegion::kIntersect_Op, true);
canvas->drawPath(drawPath, paint);
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);
}
diff --git a/gm/testimagefilters.cpp b/gm/testimagefilters.cpp
index 465d606e2b..1ea9575c7c 100644
--- a/gm/testimagefilters.cpp
+++ b/gm/testimagefilters.cpp
@@ -24,8 +24,10 @@
static SkImageFilter* make0() { return SkDownSampleImageFilter::Create(SK_Scalar1 / 5); }
static SkImageFilter* make1() { return SkOffsetImageFilter::Create(SkIntToScalar(16), SkIntToScalar(16)); }
static SkImageFilter* make2() {
- auto cf = SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode);
- return SkColorFilterImageFilter::Create(cf.get());
+ SkColorFilter* cf = SkColorFilter::CreateModeFilter(SK_ColorBLUE,
+ SkXfermode::kSrcIn_Mode);
+ SkAutoUnref aur(cf);
+ return SkColorFilterImageFilter::Create(cf);
}
static SkImageFilter* make3() {
return SkBlurImageFilter::Create(8, 0);
@@ -54,8 +56,10 @@ static SkImageFilter* make6() {
SkImageFilter* compose = SkComposeImageFilter::Create(outer, inner);
SkAutoUnref aur2(compose);
- auto cf = SkColorFilter::MakeModeFilter(0x880000FF, SkXfermode::kSrcIn_Mode);
- SkImageFilter* blue = SkColorFilterImageFilter::Create(cf.get());
+ SkColorFilter* cf = SkColorFilter::CreateModeFilter(0x880000FF,
+ SkXfermode::kSrcIn_Mode);
+ SkAutoUnref aur3(cf);
+ SkImageFilter* blue = SkColorFilterImageFilter::Create(cf);
SkAutoUnref aur4(blue);
return SkMergeImageFilter::Create(compose, blue);
@@ -69,8 +73,10 @@ static SkImageFilter* make7() {
SkImageFilter* compose = SkComposeImageFilter::Create(outer, inner);
SkAutoUnref aur2(compose);
- auto cf = SkColorFilter::MakeModeFilter(0x880000FF, SkXfermode::kSrcIn_Mode);
- SkImageFilter* blue = SkColorFilterImageFilter::Create(cf.get());
+ SkColorFilter* cf = SkColorFilter::CreateModeFilter(0x880000FF,
+ SkXfermode::kSrcIn_Mode);
+ SkAutoUnref aur3(cf);
+ SkImageFilter* blue = SkColorFilterImageFilter::Create(cf);
SkAutoUnref aur4(blue);
return SkMergeImageFilter::Create(compose, blue);
diff --git a/gm/textbloblooper.cpp b/gm/textbloblooper.cpp
index ac8b7c9759..d9701131a4 100644
--- a/gm/textbloblooper.cpp
+++ b/gm/textbloblooper.cpp
@@ -97,7 +97,7 @@ static void color_filter(SkPaint* paint) {
SkRect r;
r.setWH(SkIntToScalar(kWidth), 50);
paint->setShader(make_shader(r));
- paint->setColorFilter(SkColorMatrixFilter::MakeLightingFilter(0xF0F0F0, 0));
+ paint->setColorFilter(SkColorMatrixFilter::CreateLightingFilter(0xF0F0F0, 0))->unref();
}
static void kitchen_sink(SkPaint* paint) {
diff --git a/gm/tileimagefilter.cpp b/gm/tileimagefilter.cpp
index f75e7f9722..cf8825e5bb 100644
--- a/gm/tileimagefilter.cpp
+++ b/gm/tileimagefilter.cpp
@@ -93,9 +93,9 @@ protected:
SkRect dstRect = SkRect::MakeWH(SkIntToScalar(fBitmap->width() * 2),
SkIntToScalar(fBitmap->height() * 2));
SkAutoTUnref<SkImageFilter> tile(SkTileImageFilter::Create(srcRect, dstRect, nullptr));
- auto cf(SkColorFilter::MakeMatrixFilterRowMajor255(matrix));
+ SkAutoTUnref<SkColorFilter> cf(SkColorMatrixFilter::Create(matrix));
- SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf.get(), tile.get()));
+ SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf, tile.get()));
SkPaint paint;
paint.setImageFilter(cfif);
canvas->save();
diff --git a/gm/vertices.cpp b/gm/vertices.cpp
index 9c4ccc16bb..177dc43c2b 100644
--- a/gm/vertices.cpp
+++ b/gm/vertices.cpp
@@ -26,17 +26,17 @@ static sk_sp<SkShader> make_shader2() {
return SkShader::MakeColorShader(SK_ColorBLUE);
}
-static sk_sp<SkColorFilter> make_color_filter() {
- return SkColorFilter::MakeModeFilter(0xFFAABBCC, SkXfermode::kDarken_Mode);
+static SkColorFilter* make_color_filter() {
+ return SkColorFilter::CreateModeFilter(0xFFAABBCC, SkXfermode::kDarken_Mode);
}
class VerticesGM : public skiagm::GM {
- SkPoint fPts[9];
- SkPoint fTexs[9];
- SkColor fColors[9];
- sk_sp<SkShader> fShader1;
- sk_sp<SkShader> fShader2;
- sk_sp<SkColorFilter> fColorFilter;
+ SkPoint fPts[9];
+ SkPoint fTexs[9];
+ SkColor fColors[9];
+ sk_sp<SkShader> fShader1;
+ sk_sp<SkShader> fShader2;
+ SkAutoTUnref<SkColorFilter> fColorFilter;
public:
VerticesGM() {}
@@ -60,7 +60,7 @@ protected:
fShader1 = make_shader1(w, h);
fShader2 = make_shader2();
- fColorFilter = make_color_filter();
+ fColorFilter.reset(make_color_filter());
SkRandom rand;
for (size_t i = 0; i < SK_ARRAY_COUNT(fColors); ++i) {
@@ -85,11 +85,11 @@ protected:
};
const struct {
- const SkColor* fColors;
- const SkPoint* fTexs;
- const sk_sp<SkShader>& fShader;
- const sk_sp<SkColorFilter>& fColorFilter;
- uint8_t fAlpha;
+ const SkColor* fColors;
+ const SkPoint* fTexs;
+ const sk_sp<SkShader>& fShader;
+ SkColorFilter* fColorFilter;
+ uint8_t fAlpha;
} rec[] = {
{ fColors, nullptr, fShader1, nullptr , 0xFF },
{ nullptr, fTexs , fShader1, nullptr , 0xFF },