| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 draw_line, draw_rect, draw_path, draw_text, | 191 draw_line, draw_rect, draw_path, draw_text, |
| 192 draw_bitmap, | 192 draw_bitmap, |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 auto cf = SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kSrcIn_
Mode); | 195 auto cf = SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kSrcIn_
Mode); |
| 196 SkImageFilter* filters[] = { | 196 SkImageFilter* filters[] = { |
| 197 nullptr, | 197 nullptr, |
| 198 IdentityImageFilter::Create(), | 198 IdentityImageFilter::Create(), |
| 199 FailImageFilter::Create(), | 199 FailImageFilter::Create(), |
| 200 SkColorFilterImageFilter::Create(cf.get()), | 200 SkColorFilterImageFilter::Create(cf.get()), |
| 201 SkBlurImageFilter::Create(12.0f, 0.0f), | 201 SkBlurImageFilter::Make(12.0f, 0.0f, nullptr).release(), |
| 202 SkDropShadowImageFilter::Create(10.0f, 5.0f, 3.0f, 3.0f, SK_ColorBLU
E, | 202 SkDropShadowImageFilter::Create(10.0f, 5.0f, 3.0f, 3.0f, SK_ColorBLU
E, |
| 203 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode), | 203 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode), |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64)); | 206 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64)); |
| 207 SkScalar MARGIN = SkIntToScalar(16); | 207 SkScalar MARGIN = SkIntToScalar(16); |
| 208 SkScalar DX = r.width() + MARGIN; | 208 SkScalar DX = r.width() + MARGIN; |
| 209 SkScalar DY = r.height() + MARGIN; | 209 SkScalar DY = r.height() + MARGIN; |
| 210 | 210 |
| 211 canvas->translate(MARGIN, MARGIN); | 211 canvas->translate(MARGIN, MARGIN); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 301 |
| 302 private: | 302 private: |
| 303 typedef GM INHERITED; | 303 typedef GM INHERITED; |
| 304 }; | 304 }; |
| 305 | 305 |
| 306 class ImageFiltersText_IF : public ImageFiltersTextBaseGM { | 306 class ImageFiltersText_IF : public ImageFiltersTextBaseGM { |
| 307 public: | 307 public: |
| 308 ImageFiltersText_IF() : ImageFiltersTextBaseGM("image") {} | 308 ImageFiltersText_IF() : ImageFiltersTextBaseGM("image") {} |
| 309 | 309 |
| 310 void installFilter(SkPaint* paint) override { | 310 void installFilter(SkPaint* paint) override { |
| 311 paint->setImageFilter(SkBlurImageFilter::Create(1.5f, 1.5f))->unref(); | 311 paint->setImageFilter(SkBlurImageFilter::Make(1.5f, 1.5f, nullptr)); |
| 312 } | 312 } |
| 313 }; | 313 }; |
| 314 DEF_GM( return new ImageFiltersText_IF; ) | 314 DEF_GM( return new ImageFiltersText_IF; ) |
| 315 | 315 |
| 316 class ImageFiltersText_CF : public ImageFiltersTextBaseGM { | 316 class ImageFiltersText_CF : public ImageFiltersTextBaseGM { |
| 317 public: | 317 public: |
| 318 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {} | 318 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {} |
| 319 | 319 |
| 320 void installFilter(SkPaint* paint) override { | 320 void installFilter(SkPaint* paint) override { |
| 321 paint->setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfer
mode::kSrcIn_Mode)); | 321 paint->setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfer
mode::kSrcIn_Mode)); |
| 322 } | 322 } |
| 323 }; | 323 }; |
| 324 DEF_GM( return new ImageFiltersText_CF; ) | 324 DEF_GM( return new ImageFiltersText_CF; ) |
| OLD | NEW |