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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 offsetBackground, | 141 offsetBackground, |
142 offsetForeground, | 142 offsetForeground, |
143 nullptr)); | 143 nullptr)); |
144 DrawClippedPaint(canvas, clipRect, paint, x, y); | 144 DrawClippedPaint(canvas, clipRect, 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 // Test cropping | 150 // Test cropping |
151 static const size_t nbSamples = 3; | 151 constexpr size_t nbSamples = 3; |
152 SkXfermode::Mode sampledModes[nbSamples] = {SkXfermode::kOverlay_Mode, | 152 SkXfermode::Mode sampledModes[nbSamples] = {SkXfermode::kOverlay_Mode, |
153 SkXfermode::kSrcOver_Mode, | 153 SkXfermode::kSrcOver_Mode, |
154 SkXfermode::kPlus_Mode}; | 154 SkXfermode::kPlus_Mode}; |
155 int offsets[nbSamples][4] = {{ 10, 10, -16, -16}, | 155 int offsets[nbSamples][4] = {{ 10, 10, -16, -16}, |
156 { 10, 10, 10, 10}, | 156 { 10, 10, 10, 10}, |
157 {-10, -10, -6, -6}}; | 157 {-10, -10, -6, -6}}; |
158 for (size_t i = 0; i < nbSamples; ++i) { | 158 for (size_t i = 0; i < nbSamples; ++i) { |
159 SkIRect cropRect = SkIRect::MakeXYWH(offsets[i][0], | 159 SkIRect cropRect = SkIRect::MakeXYWH(offsets[i][0], |
160 offsets[i][1], | 160 offsets[i][1], |
161 fBitmap.width() + offsets[i][2
], | 161 fBitmap.width() + offsets[i][2
], |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 sk_sp<SkImage> fCheckerboard; | 230 sk_sp<SkImage> fCheckerboard; |
231 | 231 |
232 typedef GM INHERITED; | 232 typedef GM INHERITED; |
233 }; | 233 }; |
234 | 234 |
235 ////////////////////////////////////////////////////////////////////////////// | 235 ////////////////////////////////////////////////////////////////////////////// |
236 | 236 |
237 DEF_GM( return new XfermodeImageFilterGM; ); | 237 DEF_GM( return new XfermodeImageFilterGM; ); |
238 | 238 |
239 } | 239 } |
OLD | NEW |