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 "sk_tool_utils.h" | 9 #include "sk_tool_utils.h" |
10 #include "SkArithmeticMode.h" | 10 #include "SkArithmeticMode.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // Test arithmetic mode as image filter | 131 // Test arithmetic mode as image filter |
132 SkAutoTUnref<SkXfermode> mode(SkArithmeticMode::Create(0, SK_Scalar1, SK
_Scalar1, 0)); | 132 SkAutoTUnref<SkXfermode> mode(SkArithmeticMode::Create(0, SK_Scalar1, SK
_Scalar1, 0)); |
133 SkAutoTUnref<SkImageFilter> filter(SkXfermodeImageFilter::Create(mode, b
ackground)); | 133 SkAutoTUnref<SkImageFilter> filter(SkXfermodeImageFilter::Create(mode, b
ackground)); |
134 paint.setImageFilter(filter); | 134 paint.setImageFilter(filter); |
135 drawClippedBitmap(canvas, fBitmap, paint, x, y); | 135 drawClippedBitmap(canvas, fBitmap, paint, x, y); |
136 x += fBitmap.width() + MARGIN; | 136 x += fBitmap.width() + MARGIN; |
137 if (x + fBitmap.width() > WIDTH) { | 137 if (x + fBitmap.width() > WIDTH) { |
138 x = 0; | 138 x = 0; |
139 y += fBitmap.height() + MARGIN; | 139 y += fBitmap.height() + MARGIN; |
140 } | 140 } |
141 // Test NULL mode | 141 // Test nullptr mode |
142 filter.reset(SkXfermodeImageFilter::Create(NULL, background)); | 142 filter.reset(SkXfermodeImageFilter::Create(nullptr, background)); |
143 paint.setImageFilter(filter); | 143 paint.setImageFilter(filter); |
144 drawClippedBitmap(canvas, fBitmap, paint, x, y); | 144 drawClippedBitmap(canvas, fBitmap, paint, x, y); |
145 x += fBitmap.width() + MARGIN; | 145 x += fBitmap.width() + MARGIN; |
146 if (x + fBitmap.width() > WIDTH) { | 146 if (x + fBitmap.width() > WIDTH) { |
147 x = 0; | 147 x = 0; |
148 y += fBitmap.height() + MARGIN; | 148 y += fBitmap.height() + MARGIN; |
149 } | 149 } |
150 SkRect clipRect = SkRect::MakeWH(SkIntToScalar(fBitmap.width() + 4), | 150 SkRect clipRect = SkRect::MakeWH(SkIntToScalar(fBitmap.width() + 4), |
151 SkIntToScalar(fBitmap.height() + 4)); | 151 SkIntToScalar(fBitmap.height() + 4)); |
152 // Test offsets on SrcMode (uses fixed-function blend) | 152 // Test offsets on SrcMode (uses fixed-function blend) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 private: | 203 private: |
204 SkBitmap fBitmap, fCheckerboard; | 204 SkBitmap fBitmap, fCheckerboard; |
205 typedef GM INHERITED; | 205 typedef GM INHERITED; |
206 }; | 206 }; |
207 | 207 |
208 ////////////////////////////////////////////////////////////////////////////// | 208 ////////////////////////////////////////////////////////////////////////////// |
209 | 209 |
210 DEF_GM( return new XfermodeImageFilterGM; ); | 210 DEF_GM( return new XfermodeImageFilterGM; ); |
211 | 211 |
212 } | 212 } |
OLD | NEW |