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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 virtual void onDraw(SkCanvas* canvas) override { | 113 virtual void onDraw(SkCanvas* canvas) override { |
114 void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = { | 114 void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = { |
115 draw_bitmap, draw_path, draw_paint, draw_text | 115 draw_bitmap, draw_path, draw_paint, draw_text |
116 }; | 116 }; |
117 | 117 |
118 auto cf(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_M
ode)); | 118 auto cf(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_M
ode)); |
119 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10,
44, 44)), SkImageFilter::CropRect::kHasAll_CropEdge); | 119 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10,
44, 44)), SkImageFilter::CropRect::kHasAll_CropEdge); |
120 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, -
100, 10, 10)), SkImageFilter::CropRect::kHasAll_CropEdge); | 120 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, -
100, 10, 10)), SkImageFilter::CropRect::kHasAll_CropEdge); |
121 | 121 |
122 SkAutoTUnref<SkImageFilter> offset(SkOffsetImageFilter::Create( | 122 sk_sp<SkImageFilter> offset(SkOffsetImageFilter::Make(SkIntToScalar(-10)
, |
123 SkIntToScalar(-10), SkIntToScalar(-10))); | 123 SkIntToScalar(-10)
, |
| 124 nullptr)); |
124 | 125 |
125 sk_sp<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf.get(),
offset.get())); | 126 sk_sp<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf.get(),
offset.get())); |
126 | 127 |
127 SkAutoTUnref<SkImageFilter> erodeX(SkErodeImageFilter::Create(8, 0, null
ptr, &cropRect)); | 128 SkAutoTUnref<SkImageFilter> erodeX(SkErodeImageFilter::Create(8, 0, null
ptr, &cropRect)); |
128 SkAutoTUnref<SkImageFilter> erodeY(SkErodeImageFilter::Create(0, 8, null
ptr, &cropRect)); | 129 SkAutoTUnref<SkImageFilter> erodeY(SkErodeImageFilter::Create(0, 8, null
ptr, &cropRect)); |
129 | 130 |
130 SkImageFilter* filters[] = { | 131 SkImageFilter* filters[] = { |
131 nullptr, | 132 nullptr, |
132 SkColorFilterImageFilter::Create(cf.get(), nullptr, &cropRect), | 133 SkColorFilterImageFilter::Create(cf.get(), nullptr, &cropRect), |
133 SkBlurImageFilter::Create(0.0f, 0.0f, nullptr, &cropRect), | 134 SkBlurImageFilter::Create(0.0f, 0.0f, nullptr, &cropRect), |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 170 } |
170 | 171 |
171 private: | 172 private: |
172 SkBitmap fCheckerboard; | 173 SkBitmap fCheckerboard; |
173 typedef GM INHERITED; | 174 typedef GM INHERITED; |
174 }; | 175 }; |
175 | 176 |
176 /////////////////////////////////////////////////////////////////////////////// | 177 /////////////////////////////////////////////////////////////////////////////// |
177 | 178 |
178 DEF_GM( return new ImageFiltersCroppedGM; ) | 179 DEF_GM( return new ImageFiltersCroppedGM; ) |
OLD | NEW |