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" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 canvas->restore(); | 77 canvas->restore(); |
78 } | 78 } |
79 | 79 |
80 typedef SkMatrixConvolutionImageFilter MCIF; | 80 typedef SkMatrixConvolutionImageFilter MCIF; |
81 | 81 |
82 virtual void onDraw(SkCanvas* canvas) { | 82 virtual void onDraw(SkCanvas* canvas) { |
83 if (!fInitialized) { | 83 if (!fInitialized) { |
84 make_bitmap(); | 84 make_bitmap(); |
85 fInitialized = true; | 85 fInitialized = true; |
86 } | 86 } |
87 canvas->clear(0x00000000); | 87 canvas->clear(SK_ColorBLACK); |
88 SkIPoint kernelOffset = SkIPoint::Make(1, 0); | 88 SkIPoint kernelOffset = SkIPoint::Make(1, 0); |
89 for (int x = 10; x < 310; x += 100) { | 89 for (int x = 10; x < 310; x += 100) { |
90 this->draw(canvas, x, 10, kernelOffset, MCIF::kClamp_TileMode, true)
; | 90 this->draw(canvas, x, 10, kernelOffset, MCIF::kClamp_TileMode, true)
; |
91 this->draw(canvas, x, 110, kernelOffset, MCIF::kClampToBlack_TileMod
e, true); | 91 this->draw(canvas, x, 110, kernelOffset, MCIF::kClampToBlack_TileMod
e, true); |
92 this->draw(canvas, x, 210, kernelOffset, MCIF::kRepeat_TileMode, tru
e); | 92 this->draw(canvas, x, 210, kernelOffset, MCIF::kRepeat_TileMode, tru
e); |
93 kernelOffset.fY++; | 93 kernelOffset.fY++; |
94 } | 94 } |
95 kernelOffset.fY = 1; | 95 kernelOffset.fY = 1; |
96 SkImageFilter::CropRect rect(SkRect::MakeXYWH(10, 5, 60, 60)); | 96 SkImageFilter::CropRect rect(SkRect::MakeXYWH(10, 5, 60, 60)); |
97 this->draw(canvas, 310, 10, kernelOffset, MCIF::kClamp_TileMode, true, &
rect); | 97 this->draw(canvas, 310, 10, kernelOffset, MCIF::kClamp_TileMode, true, &
rect); |
(...skipping 10 matching lines...) Expand all Loading... |
108 SkBitmap fBitmap; | 108 SkBitmap fBitmap; |
109 bool fInitialized; | 109 bool fInitialized; |
110 }; | 110 }; |
111 | 111 |
112 ////////////////////////////////////////////////////////////////////////////// | 112 ////////////////////////////////////////////////////////////////////////////// |
113 | 113 |
114 static GM* MyFactory(void*) { return new MatrixConvolutionGM; } | 114 static GM* MyFactory(void*) { return new MatrixConvolutionGM; } |
115 static GMRegistry reg(MyFactory); | 115 static GMRegistry reg(MyFactory); |
116 | 116 |
117 } | 117 } |
OLD | NEW |