OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkMatrixConvolutionImageFilter.h" | 10 #include "SkMatrixConvolutionImageFilter.h" |
11 #include "SkGradientShader.h" | 11 #include "SkGradientShader.h" |
12 | 12 |
13 namespace skiagm { | 13 namespace skiagm { |
14 | 14 |
15 class MatrixConvolutionGM : public GM { | 15 class MatrixConvolutionGM : public GM { |
16 public: | 16 public: |
17 MatrixConvolutionGM() : fInitialized(false) { | 17 MatrixConvolutionGM() : fInitialized(false) { |
18 this->setBGColor(0x00000000); | 18 this->setBGColor(0x00000000); |
19 } | 19 } |
20 | 20 |
21 protected: | 21 protected: |
22 virtual SkString onShortName() { | 22 virtual SkString onShortName() { |
23 return SkString("matrixconvolution"); | 23 return SkString("matrixconvolution"); |
24 } | 24 } |
25 | 25 |
26 void make_bitmap() { | 26 void make_bitmap() { |
27 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 80, 80); | 27 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 80, 80); |
28 fBitmap.allocPixels(); | 28 fBitmap.allocPixels(); |
29 SkDevice device(fBitmap); | 29 SkBitmapDevice device(fBitmap); |
30 SkCanvas canvas(&device); | 30 SkCanvas canvas(&device); |
31 canvas.clear(0x00000000); | 31 canvas.clear(0x00000000); |
32 SkPaint paint; | 32 SkPaint paint; |
33 paint.setAntiAlias(true); | 33 paint.setAntiAlias(true); |
34 paint.setColor(0xFFFFFFFF); | 34 paint.setColor(0xFFFFFFFF); |
35 paint.setTextSize(SkIntToScalar(180)); | 35 paint.setTextSize(SkIntToScalar(180)); |
36 SkPoint pts[2] = { SkPoint::Make(0, 0), | 36 SkPoint pts[2] = { SkPoint::Make(0, 0), |
37 SkPoint::Make(0, SkIntToScalar(80)) }; | 37 SkPoint::Make(0, SkIntToScalar(80)) }; |
38 SkColor colors[2] = { 0xFFFFFFFF, 0x40404040 }; | 38 SkColor colors[2] = { 0xFFFFFFFF, 0x40404040 }; |
39 SkScalar pos[2] = { 0, SkIntToScalar(80) }; | 39 SkScalar pos[2] = { 0, SkIntToScalar(80) }; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 SkBitmap fBitmap; | 89 SkBitmap fBitmap; |
90 bool fInitialized; | 90 bool fInitialized; |
91 }; | 91 }; |
92 | 92 |
93 ////////////////////////////////////////////////////////////////////////////// | 93 ////////////////////////////////////////////////////////////////////////////// |
94 | 94 |
95 static GM* MyFactory(void*) { return new MatrixConvolutionGM; } | 95 static GM* MyFactory(void*) { return new MatrixConvolutionGM; } |
96 static GMRegistry reg(MyFactory); | 96 static GMRegistry reg(MyFactory); |
97 | 97 |
98 } | 98 } |
OLD | NEW |