OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkBitmapSource.h" | 9 #include "SkBitmapSource.h" |
10 #include "SkBlurImageFilter.h" | 10 #include "SkBlurImageFilter.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 | 110 |
111 { | 111 { |
112 static const SkDropShadowImageFilter::ShadowMode kBoth = | 112 static const SkDropShadowImageFilter::ShadowMode kBoth = |
113 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode
; | 113 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode
; |
114 | 114 |
115 SkAutoTUnref<SkDropShadowImageFilter> dsif( | 115 SkAutoTUnref<SkDropShadowImageFilter> dsif( |
116 SkDropShadowImageFilter::Create(10.0f, 10.0f, | 116 SkDropShadowImageFilter::Create(10.0f, 10.0f, |
117 3.0f, 3.0f, | 117 3.0f, 3.0f, |
118 SK_ColorRED, kBoth, | 118 SK_ColorRED, kBoth, |
119 source, NULL)); | 119 source, nullptr)); |
120 | 120 |
121 add_paint(dsif, paints); | 121 add_paint(dsif, paints); |
122 } | 122 } |
123 | 123 |
124 { | 124 { |
125 SkAutoTUnref<SkDropShadowImageFilter> dsif( | 125 SkAutoTUnref<SkDropShadowImageFilter> dsif( |
126 SkDropShadowImageFilter::Create(27.0f, 27.0f, | 126 SkDropShadowImageFilter::Create(27.0f, 27.0f, |
127 3.0f, 3.0f, | 127 3.0f, 3.0f, |
128 SK_ColorRED, | 128 SK_ColorRED, |
129 SkDropShadowImageFilter::kDrawShadow
Only_ShadowMode, | 129 SkDropShadowImageFilter::kDrawShadow
Only_ShadowMode, |
130 source, NULL)); | 130 source, nullptr)); |
131 | 131 |
132 add_paint(dsif, paints); | 132 add_paint(dsif, paints); |
133 } | 133 } |
134 | 134 |
135 { | 135 { |
136 SkAutoTUnref<SkBlurImageFilter> bif(SkBlurImageFilter::Create(3, 3, sour
ce)); | 136 SkAutoTUnref<SkBlurImageFilter> bif(SkBlurImageFilter::Create(3, 3, sour
ce)); |
137 | 137 |
138 add_paint(bif, paints); | 138 add_paint(bif, paints); |
139 } | 139 } |
140 | 140 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 canvas->restore(); | 224 canvas->restore(); |
225 } | 225 } |
226 | 226 |
227 void onDraw(SkCanvas* canvas) override{ | 227 void onDraw(SkCanvas* canvas) override{ |
228 | 228 |
229 SkPaint blackFill; | 229 SkPaint blackFill; |
230 | 230 |
231 //----------- | 231 //----------- |
232 // Normal paints (no source) | 232 // Normal paints (no source) |
233 SkTArray<SkPaint> paints; | 233 SkTArray<SkPaint> paints; |
234 create_paints(NULL, &paints); | 234 create_paints(nullptr, &paints); |
235 | 235 |
236 //----------- | 236 //----------- |
237 // Paints with a PictureImageFilter as a source | 237 // Paints with a PictureImageFilter as a source |
238 SkAutoTUnref<SkPicture> pic; | 238 SkAutoTUnref<SkPicture> pic; |
239 | 239 |
240 { | 240 { |
241 SkPictureRecorder rec; | 241 SkPictureRecorder rec; |
242 | 242 |
243 SkCanvas* c = rec.beginRecording(10, 10); | 243 SkCanvas* c = rec.beginRecording(10, 10); |
244 c->drawRect(SkRect::MakeWH(10, 10), blackFill); | 244 c->drawRect(SkRect::MakeWH(10, 10), blackFill); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } | 316 } |
317 | 317 |
318 private: | 318 private: |
319 typedef GM INHERITED; | 319 typedef GM INHERITED; |
320 }; | 320 }; |
321 | 321 |
322 ////////////////////////////////////////////////////////////////////////////// | 322 ////////////////////////////////////////////////////////////////////////////// |
323 | 323 |
324 DEF_GM(return new ImageFilterFastBoundGM;) | 324 DEF_GM(return new ImageFilterFastBoundGM;) |
325 } | 325 } |
OLD | NEW |