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 "SkColor.h" | 9 #include "SkColor.h" |
10 #include "SkMatrixImageFilter.h" | 10 #include "SkImageFilter.h" |
11 | 11 |
12 namespace skiagm { | 12 namespace skiagm { |
13 | 13 |
14 class MatrixImageFilterGM : public GM { | 14 class MatrixImageFilterGM : public GM { |
15 public: | 15 public: |
16 MatrixImageFilterGM() { | 16 MatrixImageFilterGM() { |
17 this->setBGColor(0x00000000); | 17 this->setBGColor(0x00000000); |
18 } | 18 } |
19 | 19 |
20 protected: | 20 protected: |
21 virtual SkString onShortName() { | 21 virtual SkString onShortName() { |
22 return SkString("matriximagefilter"); | 22 return SkString("matriximagefilter"); |
23 } | 23 } |
24 | 24 |
25 void draw(SkCanvas* canvas, const SkRect& rect, const SkBitmap& bitmap, | 25 void draw(SkCanvas* canvas, const SkRect& rect, const SkBitmap& bitmap, |
26 const SkMatrix& matrix, SkFilterQuality filter) { | 26 const SkMatrix& matrix, SkFilterQuality filter) { |
27 SkAutoTUnref<SkImageFilter> imageFilter( | 27 SkAutoTUnref<SkImageFilter> imageFilter( |
28 SkMatrixImageFilter::Create(matrix, filter)); | 28 SkImageFilter::CreateMatrixFilter(matrix, filter)); |
29 SkPaint paint; | 29 SkPaint paint; |
30 paint.setImageFilter(imageFilter.get()); | 30 paint.setImageFilter(imageFilter.get()); |
31 canvas->saveLayer(&rect, &paint); | 31 canvas->saveLayer(&rect, &paint); |
32 canvas->drawBitmap(bitmap, 0, 0); | 32 canvas->drawBitmap(bitmap, 0, 0); |
33 canvas->restore(); | 33 canvas->restore(); |
34 } | 34 } |
35 | 35 |
36 virtual SkISize onISize() { | 36 virtual SkISize onISize() { |
37 return SkISize::Make(420, 100); | 37 return SkISize::Make(420, 100); |
38 } | 38 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 private: | 86 private: |
87 typedef GM INHERITED; | 87 typedef GM INHERITED; |
88 }; | 88 }; |
89 | 89 |
90 ////////////////////////////////////////////////////////////////////////////// | 90 ////////////////////////////////////////////////////////////////////////////// |
91 | 91 |
92 static GM* MyFactory(void*) { return new MatrixImageFilterGM; } | 92 static GM* MyFactory(void*) { return new MatrixImageFilterGM; } |
93 static GMRegistry reg(MyFactory); | 93 static GMRegistry reg(MyFactory); |
94 | 94 |
95 } | 95 } |
OLD | NEW |