OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkColorFilter.h" | 9 #include "SkColorFilter.h" |
10 | 10 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 paint.setStyle(SkPaint::kStroke_Style); | 86 paint.setStyle(SkPaint::kStroke_Style); |
87 paint.setColor(SK_ColorRED); | 87 paint.setColor(SK_ColorRED); |
88 canvas->drawRect(r, paint); | 88 canvas->drawRect(r, paint); |
89 } | 89 } |
90 | 90 |
91 virtual void onDraw(SkCanvas* canvas) { | 91 virtual void onDraw(SkCanvas* canvas) { |
92 void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = { | 92 void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = { |
93 draw_bitmap, draw_path, draw_paint, draw_text | 93 draw_bitmap, draw_path, draw_paint, draw_text |
94 }; | 94 }; |
95 | 95 |
96 SkAutoTUnref<SkColorFilter> cf( | 96 auto cf(SkColorFilter::MakeModeFilter(SK_ColorMAGENTA, SkXfermode::kSrcI
n_Mode)); |
97 SkColorFilter::CreateModeFilter(SK_ColorMAGENTA, SkXfermode::kSrcIn_
Mode)); | |
98 SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf.get
())); | 97 SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf.get
())); |
99 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10,
44, 44)), | 98 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10,
44, 44)), |
100 SkImageFilter::CropRect::kHasAll_CropEd
ge); | 99 SkImageFilter::CropRect::kHasAll_CropEd
ge); |
101 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, -
100, 10, 10)), | 100 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, -
100, 10, 10)), |
102 SkImageFilter::CropRect::kHasAll_CropE
dge); | 101 SkImageFilter::CropRect::kHasAll_CropE
dge); |
103 | 102 |
104 SkImageFilter* filters[] = { | 103 SkImageFilter* filters[] = { |
105 nullptr, | 104 nullptr, |
106 SkDropShadowImageFilter::Create(7.0f, 0.0f, 0.0f, 3.0f, SK_ColorBLUE
, | 105 SkDropShadowImageFilter::Create(7.0f, 0.0f, 0.0f, 3.0f, SK_ColorBLUE
, |
107 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode), | 106 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode), |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } | 139 } |
141 } | 140 } |
142 | 141 |
143 private: | 142 private: |
144 typedef GM INHERITED; | 143 typedef GM INHERITED; |
145 }; | 144 }; |
146 | 145 |
147 /////////////////////////////////////////////////////////////////////////////// | 146 /////////////////////////////////////////////////////////////////////////////// |
148 | 147 |
149 DEF_GM( return new DropShadowImageFilterGM; ) | 148 DEF_GM( return new DropShadowImageFilterGM; ) |
OLD | NEW |