OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 | 9 |
10 #include "SkArithmeticMode.h" | 10 #include "SkArithmeticMode.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 SkISize onISize() override { return SkISize::Make(600, 150); } | 111 SkISize onISize() override { return SkISize::Make(600, 150); } |
112 | 112 |
113 void onOnceBeforeDraw() override { | 113 void onOnceBeforeDraw() override { |
114 fImage = SkImage::MakeFromBitmap( | 114 fImage = SkImage::MakeFromBitmap( |
115 sk_tool_utils::create_string_bitmap(100, 100, SK_ColorWHITE, 20, 70,
96, "e")); | 115 sk_tool_utils::create_string_bitmap(100, 100, SK_ColorWHITE, 20, 70,
96, "e")); |
116 } | 116 } |
117 | 117 |
118 void onDraw(SkCanvas* canvas) override { | 118 void onDraw(SkCanvas* canvas) override { |
119 canvas->clear(SK_ColorBLACK); | 119 canvas->clear(SK_ColorBLACK); |
120 { | 120 { |
121 sk_sp<SkImageFilter> bitmapSource(SkImageSource::Create(fImage.get()
)); | 121 sk_sp<SkImageFilter> bitmapSource(SkImageSource::Make(fImage)); |
122 sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(SK_ColorRED, | 122 sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(SK_ColorRED, |
123 SkXfermode::kS
rcIn_Mode)); | 123 SkXfermode::kS
rcIn_Mode)); |
124 sk_sp<SkImageFilter> blur(SkBlurImageFilter::Create(4.0f, 4.0f, bitm
apSource.get())); | 124 sk_sp<SkImageFilter> blur(SkBlurImageFilter::Create(4.0f, 4.0f, bitm
apSource.get())); |
125 sk_sp<SkImageFilter> erode(SkErodeImageFilter::Create(4, 4, blur.get
())); | 125 sk_sp<SkImageFilter> erode(SkErodeImageFilter::Create(4, 4, blur.get
())); |
126 sk_sp<SkImageFilter> color(SkColorFilterImageFilter::Create(cf.get()
, erode.get())); | 126 sk_sp<SkImageFilter> color(SkColorFilterImageFilter::Create(cf.get()
, erode.get())); |
127 sk_sp<SkImageFilter> merge(SkMergeImageFilter::Make(blur, color)); | 127 sk_sp<SkImageFilter> merge(SkMergeImageFilter::Make(blur, color)); |
128 | 128 |
129 SkPaint paint; | 129 SkPaint paint; |
130 paint.setImageFilter(std::move(merge)); | 130 paint.setImageFilter(std::move(merge)); |
131 canvas->drawPaint(paint); | 131 canvas->drawPaint(paint); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 | 239 |
240 sk_sp<SkImage> fImage; | 240 sk_sp<SkImage> fImage; |
241 | 241 |
242 typedef GM INHERITED; | 242 typedef GM INHERITED; |
243 }; | 243 }; |
244 | 244 |
245 /////////////////////////////////////////////////////////////////////////////// | 245 /////////////////////////////////////////////////////////////////////////////// |
246 | 246 |
247 DEF_GM(return new ImageFiltersGraphGM;) | 247 DEF_GM(return new ImageFiltersGraphGM;) |
OLD | NEW |