reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "gm.h" |
| 9 | #include "SkCanvas.h" |
| 10 | #include "SkColorFilter.h" |
| 11 | #include "SkColorPriv.h" |
| 12 | #include "SkShader.h" |
| 13 | |
| 14 | #include "SkBlurImageFilter.h" |
senorblanco@chromium.org | 44888c6 | 2012-08-20 19:23:24 +0000 | [diff] [blame] | 15 | #include "SkColorFilterImageFilter.h" |
junov@chromium.org | f44fcdc | 2013-08-07 20:00:55 +0000 | [diff] [blame] | 16 | #include "SkDropShadowImageFilter.h" |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 17 | #include "SkTestImageFilters.h" |
| 18 | |
| 19 | class FailImageFilter : public SkImageFilter { |
| 20 | public: |
reed | 7daaaa4 | 2014-08-21 10:53:34 -0700 | [diff] [blame] | 21 | class Registrar { |
| 22 | public: |
| 23 | Registrar() { |
| 24 | SkFlattenable::Register("FailImageFilter", |
reed | 7daaaa4 | 2014-08-21 10:53:34 -0700 | [diff] [blame] | 25 | FailImageFilter::CreateProc, |
reed | 7daaaa4 | 2014-08-21 10:53:34 -0700 | [diff] [blame] | 26 | FailImageFilter::GetFlattenableType()); |
| 27 | } |
| 28 | }; |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 29 | static FailImageFilter* Create() { return new FailImageFilter; } |
djsollen@google.com | ba28d03 | 2012-03-26 17:57:35 +0000 | [diff] [blame] | 30 | |
robertphillips | f3f5bad | 2014-12-19 13:49:15 -0800 | [diff] [blame] | 31 | SK_TO_STRING_OVERRIDE() |
djsollen@google.com | ba28d03 | 2012-03-26 17:57:35 +0000 | [diff] [blame] | 32 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter) |
reed | 9fa60da | 2014-08-21 07:59:51 -0700 | [diff] [blame] | 33 | |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 34 | protected: |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 35 | FailImageFilter() : INHERITED(0, nullptr) {} |
reed | 9fa60da | 2014-08-21 07:59:51 -0700 | [diff] [blame] | 36 | |
robertphillips | 48e7846 | 2016-02-17 13:57:16 -0800 | [diff] [blame] | 37 | bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Context&, |
| 38 | SkBitmap* result, SkIPoint* offset) const override { |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 39 | return false; |
| 40 | } |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 41 | |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 42 | private: |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 43 | typedef SkImageFilter INHERITED; |
| 44 | }; |
| 45 | |
reed | 7daaaa4 | 2014-08-21 10:53:34 -0700 | [diff] [blame] | 46 | static FailImageFilter::Registrar gReg0; |
| 47 | |
reed | 9fa60da | 2014-08-21 07:59:51 -0700 | [diff] [blame] | 48 | SkFlattenable* FailImageFilter::CreateProc(SkReadBuffer& buffer) { |
| 49 | SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0); |
| 50 | return FailImageFilter::Create(); |
| 51 | } |
djsollen@google.com | ba28d03 | 2012-03-26 17:57:35 +0000 | [diff] [blame] | 52 | |
robertphillips | f3f5bad | 2014-12-19 13:49:15 -0800 | [diff] [blame] | 53 | #ifndef SK_IGNORE_TO_STRING |
| 54 | void FailImageFilter::toString(SkString* str) const { |
| 55 | str->appendf("FailImageFilter: ("); |
| 56 | str->append(")"); |
| 57 | } |
| 58 | #endif |
| 59 | |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 60 | class IdentityImageFilter : public SkImageFilter { |
| 61 | public: |
reed | 7daaaa4 | 2014-08-21 10:53:34 -0700 | [diff] [blame] | 62 | class Registrar { |
| 63 | public: |
| 64 | Registrar() { |
| 65 | SkFlattenable::Register("IdentityImageFilter", |
reed | 7daaaa4 | 2014-08-21 10:53:34 -0700 | [diff] [blame] | 66 | IdentityImageFilter::CreateProc, |
reed | 7daaaa4 | 2014-08-21 10:53:34 -0700 | [diff] [blame] | 67 | IdentityImageFilter::GetFlattenableType()); |
| 68 | } |
| 69 | }; |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 70 | static IdentityImageFilter* Create(SkImageFilter* input = nullptr) { |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 71 | return new IdentityImageFilter(input); |
commit-bot@chromium.org | cac5fd5 | 2014-03-10 10:51:58 +0000 | [diff] [blame] | 72 | } |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 73 | |
robertphillips | f3f5bad | 2014-12-19 13:49:15 -0800 | [diff] [blame] | 74 | SK_TO_STRING_OVERRIDE() |
djsollen@google.com | ba28d03 | 2012-03-26 17:57:35 +0000 | [diff] [blame] | 75 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter) |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 76 | protected: |
reed | 7daaaa4 | 2014-08-21 10:53:34 -0700 | [diff] [blame] | 77 | IdentityImageFilter(SkImageFilter* input) : INHERITED(1, &input) {} |
reed | 9fa60da | 2014-08-21 07:59:51 -0700 | [diff] [blame] | 78 | |
robertphillips | 48e7846 | 2016-02-17 13:57:16 -0800 | [diff] [blame] | 79 | bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Context&, |
| 80 | SkBitmap* result, SkIPoint* offset) const override { |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 81 | *result = src; |
commit-bot@chromium.org | f7efa50 | 2014-04-11 18:57:00 +0000 | [diff] [blame] | 82 | offset->set(0, 0); |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 83 | return true; |
| 84 | } |
| 85 | |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 86 | private: |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 87 | typedef SkImageFilter INHERITED; |
| 88 | }; |
| 89 | |
reed | 7daaaa4 | 2014-08-21 10:53:34 -0700 | [diff] [blame] | 90 | static IdentityImageFilter::Registrar gReg1; |
| 91 | |
reed | 9fa60da | 2014-08-21 07:59:51 -0700 | [diff] [blame] | 92 | SkFlattenable* IdentityImageFilter::CreateProc(SkReadBuffer& buffer) { |
| 93 | SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
robertphillips | 2238c9d | 2016-03-30 13:34:16 -0700 | [diff] [blame^] | 94 | return IdentityImageFilter::Create(common.getInput(0).get()); |
reed | 9fa60da | 2014-08-21 07:59:51 -0700 | [diff] [blame] | 95 | } |
djsollen@google.com | ba28d03 | 2012-03-26 17:57:35 +0000 | [diff] [blame] | 96 | |
robertphillips | f3f5bad | 2014-12-19 13:49:15 -0800 | [diff] [blame] | 97 | #ifndef SK_IGNORE_TO_STRING |
| 98 | void IdentityImageFilter::toString(SkString* str) const { |
| 99 | str->appendf("IdentityImageFilter: ("); |
| 100 | str->append(")"); |
| 101 | } |
| 102 | #endif |
| 103 | |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 104 | /////////////////////////////////////////////////////////////////////////////// |
| 105 | |
| 106 | static void draw_paint(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { |
| 107 | SkPaint paint; |
| 108 | paint.setImageFilter(imf); |
| 109 | paint.setColor(SK_ColorGREEN); |
| 110 | canvas->save(); |
| 111 | canvas->clipRect(r); |
| 112 | canvas->drawPaint(paint); |
| 113 | canvas->restore(); |
| 114 | } |
| 115 | |
| 116 | static void draw_line(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { |
| 117 | SkPaint paint; |
| 118 | paint.setColor(SK_ColorBLUE); |
| 119 | paint.setImageFilter(imf); |
| 120 | paint.setStrokeWidth(r.width()/10); |
| 121 | canvas->drawLine(r.fLeft, r.fTop, r.fRight, r.fBottom, paint); |
| 122 | } |
| 123 | |
| 124 | static void draw_rect(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { |
| 125 | SkPaint paint; |
| 126 | paint.setColor(SK_ColorYELLOW); |
| 127 | paint.setImageFilter(imf); |
| 128 | SkRect rr(r); |
| 129 | rr.inset(r.width()/10, r.height()/10); |
| 130 | canvas->drawRect(rr, paint); |
| 131 | } |
| 132 | |
| 133 | static void draw_path(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { |
| 134 | SkPaint paint; |
| 135 | paint.setColor(SK_ColorMAGENTA); |
| 136 | paint.setImageFilter(imf); |
| 137 | paint.setAntiAlias(true); |
| 138 | canvas->drawCircle(r.centerX(), r.centerY(), r.width()*2/5, paint); |
| 139 | } |
| 140 | |
| 141 | static void draw_text(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { |
| 142 | SkPaint paint; |
| 143 | paint.setImageFilter(imf); |
| 144 | paint.setColor(SK_ColorCYAN); |
| 145 | paint.setAntiAlias(true); |
caryclark | 1818acb | 2015-07-24 12:09:25 -0700 | [diff] [blame] | 146 | sk_tool_utils::set_portable_typeface(&paint); |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 147 | paint.setTextSize(r.height()/2); |
| 148 | paint.setTextAlign(SkPaint::kCenter_Align); |
| 149 | canvas->drawText("Text", 4, r.centerX(), r.centerY(), paint); |
| 150 | } |
| 151 | |
| 152 | static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { |
| 153 | SkPaint paint; |
| 154 | paint.setImageFilter(imf); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 155 | |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 156 | SkIRect bounds; |
| 157 | r.roundOut(&bounds); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 158 | |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 159 | SkBitmap bm; |
reed@google.com | eb9a46c | 2014-01-25 16:46:20 +0000 | [diff] [blame] | 160 | bm.allocN32Pixels(bounds.width(), bounds.height()); |
junov@google.com | dbfac8a | 2012-12-06 21:47:40 +0000 | [diff] [blame] | 161 | bm.eraseColor(SK_ColorTRANSPARENT); |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 162 | SkCanvas c(bm); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 163 | draw_path(&c, r, nullptr); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 164 | |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 165 | canvas->drawBitmap(bm, 0, 0, &paint); |
| 166 | } |
| 167 | |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 168 | /////////////////////////////////////////////////////////////////////////////// |
| 169 | |
| 170 | class ImageFiltersBaseGM : public skiagm::GM { |
| 171 | public: |
| 172 | ImageFiltersBaseGM () {} |
| 173 | |
| 174 | protected: |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 175 | SkString onShortName() override { |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 176 | return SkString("imagefiltersbase"); |
| 177 | } |
| 178 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 179 | SkISize onISize() override { return SkISize::Make(700, 500); } |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 180 | |
| 181 | void draw_frame(SkCanvas* canvas, const SkRect& r) { |
| 182 | SkPaint paint; |
| 183 | paint.setStyle(SkPaint::kStroke_Style); |
| 184 | paint.setColor(SK_ColorRED); |
| 185 | canvas->drawRect(r, paint); |
| 186 | } |
| 187 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 188 | void onDraw(SkCanvas* canvas) override { |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 189 | void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = { |
| 190 | draw_paint, |
| 191 | draw_line, draw_rect, draw_path, draw_text, |
| 192 | draw_bitmap, |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 193 | }; |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 194 | |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 195 | auto cf = SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode); |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 196 | SkImageFilter* filters[] = { |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 197 | nullptr, |
commit-bot@chromium.org | cac5fd5 | 2014-03-10 10:51:58 +0000 | [diff] [blame] | 198 | IdentityImageFilter::Create(), |
| 199 | FailImageFilter::Create(), |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 200 | SkColorFilterImageFilter::Create(cf.get()), |
commit-bot@chromium.org | cac5fd5 | 2014-03-10 10:51:58 +0000 | [diff] [blame] | 201 | SkBlurImageFilter::Create(12.0f, 0.0f), |
sugoi | 234f036 | 2014-10-23 13:59:52 -0700 | [diff] [blame] | 202 | SkDropShadowImageFilter::Create(10.0f, 5.0f, 3.0f, 3.0f, SK_ColorBLUE, |
| 203 | SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode), |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 204 | }; |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 205 | |
| 206 | SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64)); |
| 207 | SkScalar MARGIN = SkIntToScalar(16); |
| 208 | SkScalar DX = r.width() + MARGIN; |
| 209 | SkScalar DY = r.height() + MARGIN; |
| 210 | |
| 211 | canvas->translate(MARGIN, MARGIN); |
| 212 | for (size_t i = 0; i < SK_ARRAY_COUNT(drawProc); ++i) { |
| 213 | canvas->save(); |
| 214 | for (size_t j = 0; j < SK_ARRAY_COUNT(filters); ++j) { |
| 215 | drawProc[i](canvas, r, filters[j]); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 216 | |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 217 | draw_frame(canvas, r); |
| 218 | canvas->translate(0, DY); |
| 219 | } |
| 220 | canvas->restore(); |
| 221 | canvas->translate(DX, 0); |
| 222 | } |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 223 | |
reed@google.com | 4bca84d | 2012-06-27 14:00:06 +0000 | [diff] [blame] | 224 | for(size_t j = 0; j < SK_ARRAY_COUNT(filters); ++j) { |
| 225 | SkSafeUnref(filters[j]); |
| 226 | } |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | private: |
| 230 | typedef GM INHERITED; |
| 231 | }; |
reed | 8dc0ccb | 2015-03-20 06:32:52 -0700 | [diff] [blame] | 232 | DEF_GM( return new ImageFiltersBaseGM; ) |
reed@google.com | 8926b16 | 2012-03-23 15:36:36 +0000 | [diff] [blame] | 233 | |
| 234 | /////////////////////////////////////////////////////////////////////////////// |
| 235 | |
reed | 8dc0ccb | 2015-03-20 06:32:52 -0700 | [diff] [blame] | 236 | /* |
| 237 | * Want to test combos of filter and LCD text, to be sure we disable LCD in the presence of |
| 238 | * a filter. |
| 239 | */ |
| 240 | class ImageFiltersTextBaseGM : public skiagm::GM { |
| 241 | SkString fSuffix; |
| 242 | public: |
| 243 | ImageFiltersTextBaseGM(const char suffix[]) : fSuffix(suffix) {} |
| 244 | |
| 245 | protected: |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 246 | SkString onShortName() override { |
reed | 8dc0ccb | 2015-03-20 06:32:52 -0700 | [diff] [blame] | 247 | SkString name; |
| 248 | name.printf("%s_%s", "textfilter", fSuffix.c_str()); |
| 249 | return name; |
| 250 | } |
| 251 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 252 | SkISize onISize() override { return SkISize::Make(512, 342); } |
reed | 8dc0ccb | 2015-03-20 06:32:52 -0700 | [diff] [blame] | 253 | |
| 254 | void drawWaterfall(SkCanvas* canvas, const SkPaint& origPaint) { |
| 255 | const uint32_t flags[] = { |
| 256 | 0, |
| 257 | SkPaint::kAntiAlias_Flag, |
| 258 | SkPaint::kAntiAlias_Flag | SkPaint::kLCDRenderText_Flag, |
| 259 | }; |
| 260 | SkPaint paint(origPaint); |
caryclark | 1818acb | 2015-07-24 12:09:25 -0700 | [diff] [blame] | 261 | sk_tool_utils::set_portable_typeface(&paint); |
reed | 8dc0ccb | 2015-03-20 06:32:52 -0700 | [diff] [blame] | 262 | paint.setTextSize(30); |
| 263 | |
| 264 | SkAutoCanvasRestore acr(canvas, true); |
| 265 | for (size_t i = 0; i < SK_ARRAY_COUNT(flags); ++i) { |
| 266 | paint.setFlags(flags[i]); |
| 267 | canvas->drawText("Hamburgefons", 11, 0, 0, paint); |
| 268 | canvas->translate(0, 40); |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | virtual void installFilter(SkPaint* paint) = 0; |
| 273 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 274 | void onDraw(SkCanvas* canvas) override { |
reed | 8dc0ccb | 2015-03-20 06:32:52 -0700 | [diff] [blame] | 275 | SkPaint paint; |
| 276 | |
| 277 | canvas->translate(20, 40); |
| 278 | |
| 279 | for (int doSaveLayer = 0; doSaveLayer <= 1; ++doSaveLayer) { |
| 280 | SkAutoCanvasRestore acr(canvas, true); |
| 281 | for (int useFilter = 0; useFilter <= 1; ++useFilter) { |
| 282 | SkAutoCanvasRestore acr2(canvas, true); |
| 283 | |
| 284 | SkPaint paint; |
| 285 | if (useFilter) { |
| 286 | this->installFilter(&paint); |
| 287 | } |
| 288 | if (doSaveLayer) { |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 289 | canvas->saveLayer(nullptr, &paint); |
| 290 | paint.setImageFilter(nullptr); |
reed | 8dc0ccb | 2015-03-20 06:32:52 -0700 | [diff] [blame] | 291 | } |
| 292 | this->drawWaterfall(canvas, paint); |
| 293 | |
| 294 | acr2.restore(); |
| 295 | canvas->translate(250, 0); |
| 296 | } |
| 297 | acr.restore(); |
| 298 | canvas->translate(0, 200); |
| 299 | } |
| 300 | } |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 301 | |
reed | 8dc0ccb | 2015-03-20 06:32:52 -0700 | [diff] [blame] | 302 | private: |
| 303 | typedef GM INHERITED; |
| 304 | }; |
| 305 | |
| 306 | class ImageFiltersText_IF : public ImageFiltersTextBaseGM { |
| 307 | public: |
| 308 | ImageFiltersText_IF() : ImageFiltersTextBaseGM("image") {} |
| 309 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 310 | void installFilter(SkPaint* paint) override { |
reed | 8dc0ccb | 2015-03-20 06:32:52 -0700 | [diff] [blame] | 311 | paint->setImageFilter(SkBlurImageFilter::Create(1.5f, 1.5f))->unref(); |
| 312 | } |
| 313 | }; |
| 314 | DEF_GM( return new ImageFiltersText_IF; ) |
| 315 | |
| 316 | class ImageFiltersText_CF : public ImageFiltersTextBaseGM { |
| 317 | public: |
| 318 | ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {} |
| 319 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 320 | void installFilter(SkPaint* paint) override { |
reed | d053ce9 | 2016-03-22 10:17:23 -0700 | [diff] [blame] | 321 | paint->setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode)); |
reed | 8dc0ccb | 2015-03-20 06:32:52 -0700 | [diff] [blame] | 322 | } |
| 323 | }; |
| 324 | DEF_GM( return new ImageFiltersText_CF; ) |