| 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 auto cf(SkColorFilter::MakeModeFilter(SK_ColorMAGENTA, SkXfermode::kSrcI
n_Mode)); | 96 SkAutoTUnref<SkColorFilter> cf( |
| 97 SkColorFilter::CreateModeFilter(SK_ColorMAGENTA, SkXfermode::kSrcIn_
Mode)); |
| 97 SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf.get
())); | 98 SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf.get
())); |
| 98 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10,
44, 44)), | 99 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10,
44, 44)), |
| 99 SkImageFilter::CropRect::kHasAll_CropEd
ge); | 100 SkImageFilter::CropRect::kHasAll_CropEd
ge); |
| 100 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, -
100, 10, 10)), | 101 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, -
100, 10, 10)), |
| 101 SkImageFilter::CropRect::kHasAll_CropE
dge); | 102 SkImageFilter::CropRect::kHasAll_CropE
dge); |
| 102 | 103 |
| 103 SkImageFilter* filters[] = { | 104 SkImageFilter* filters[] = { |
| 104 nullptr, | 105 nullptr, |
| 105 SkDropShadowImageFilter::Create(7.0f, 0.0f, 0.0f, 3.0f, SK_ColorBLUE
, | 106 SkDropShadowImageFilter::Create(7.0f, 0.0f, 0.0f, 3.0f, SK_ColorBLUE
, |
| 106 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode), | 107 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode), |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 140 } |
| 140 } | 141 } |
| 141 | 142 |
| 142 private: | 143 private: |
| 143 typedef GM INHERITED; | 144 typedef GM INHERITED; |
| 144 }; | 145 }; |
| 145 | 146 |
| 146 /////////////////////////////////////////////////////////////////////////////// | 147 /////////////////////////////////////////////////////////////////////////////// |
| 147 | 148 |
| 148 DEF_GM( return new DropShadowImageFilterGM; ) | 149 DEF_GM( return new DropShadowImageFilterGM; ) |
| OLD | NEW |