| 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" |
| 11 #include "SkDropShadowImageFilter.h" | 11 #include "SkDropShadowImageFilter.h" |
| 12 #include "SkMatrixImageFilter.h" | |
| 13 #include "SkOffsetImageFilter.h" | 12 #include "SkOffsetImageFilter.h" |
| 14 #include "SkPictureImageFilter.h" | 13 #include "SkPictureImageFilter.h" |
| 15 #include "SkPictureRecorder.h" | 14 #include "SkPictureRecorder.h" |
| 16 #include "SkRandom.h" | 15 #include "SkRandom.h" |
| 17 | 16 |
| 18 namespace skiagm { | 17 namespace skiagm { |
| 19 | 18 |
| 20 // Each method of this type must draw its geometry inside 'r' using 'p' | 19 // Each method of this type must draw its geometry inside 'r' using 'p' |
| 21 typedef void(*drawMth)(SkCanvas* canvas, const SkRect& r, const SkPaint& p); | 20 typedef void(*drawMth)(SkCanvas* canvas, const SkRect& r, const SkPaint& p); |
| 22 | 21 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 p.setImageFilter(filter); | 85 p.setImageFilter(filter); |
| 87 SkASSERT(p.canComputeFastBounds()); | 86 SkASSERT(p.canComputeFastBounds()); |
| 88 } | 87 } |
| 89 | 88 |
| 90 // Create a selection of imagefilter-based paints to test | 89 // Create a selection of imagefilter-based paints to test |
| 91 static void create_paints(SkImageFilter* source, SkTArray<SkPaint>* paints) { | 90 static void create_paints(SkImageFilter* source, SkTArray<SkPaint>* paints) { |
| 92 { | 91 { |
| 93 SkMatrix scale; | 92 SkMatrix scale; |
| 94 scale.setScale(2.0f, 2.0f); | 93 scale.setScale(2.0f, 2.0f); |
| 95 | 94 |
| 96 SkAutoTUnref<SkMatrixImageFilter> scaleMIF( | 95 SkAutoTUnref<SkImageFilter> scaleMIF( |
| 97 SkMatrixImageFilter::Create(scale, kLow_SkFilterQuality, source)); | 96 SkImageFilter::CreateMatrixFilter(scale, kLow_SkFilterQuality, sourc
e)); |
| 98 | 97 |
| 99 add_paint(scaleMIF, paints); | 98 add_paint(scaleMIF, paints); |
| 100 } | 99 } |
| 101 | 100 |
| 102 { | 101 { |
| 103 SkMatrix rot; | 102 SkMatrix rot; |
| 104 rot.setRotate(-33.3f); | 103 rot.setRotate(-33.3f); |
| 105 | 104 |
| 106 SkAutoTUnref<SkMatrixImageFilter> rotMIF( | 105 SkAutoTUnref<SkImageFilter> rotMIF( |
| 107 SkMatrixImageFilter::Create(rot, kLow_SkFilterQuality, source)); | 106 SkImageFilter::CreateMatrixFilter(rot, kLow_SkFilterQuality, source)
); |
| 108 | 107 |
| 109 add_paint(rotMIF, paints); | 108 add_paint(rotMIF, paints); |
| 110 } | 109 } |
| 111 | 110 |
| 112 { | 111 { |
| 113 static const SkDropShadowImageFilter::ShadowMode kBoth = | 112 static const SkDropShadowImageFilter::ShadowMode kBoth = |
| 114 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode
; | 113 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode
; |
| 115 | 114 |
| 116 SkAutoTUnref<SkDropShadowImageFilter> dsif( | 115 SkAutoTUnref<SkDropShadowImageFilter> dsif( |
| 117 SkDropShadowImageFilter::Create(10.0f, 10.0f, | 116 SkDropShadowImageFilter::Create(10.0f, 10.0f, |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 317 |
| 319 private: | 318 private: |
| 320 typedef GM INHERITED; | 319 typedef GM INHERITED; |
| 321 }; | 320 }; |
| 322 | 321 |
| 323 ////////////////////////////////////////////////////////////////////////////// | 322 ////////////////////////////////////////////////////////////////////////////// |
| 324 | 323 |
| 325 DEF_GM(return SkNEW(ImageFilterFastBoundGM);) | 324 DEF_GM(return SkNEW(ImageFilterFastBoundGM);) |
| 326 | 325 |
| 327 } | 326 } |
| OLD | NEW |