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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 SkColorSetARGB(255, 0, (kDetectorGreenValue + 1), 0) // This tests that detectors work. | 183 SkColorSetARGB(255, 0, (kDetectorGreenValue + 1), 0) // This tests that detectors work. |
184 }; | 184 }; |
185 | 185 |
186 InstallDetectorFunc detectorInstallFuncs[] = { | 186 InstallDetectorFunc detectorInstallFuncs[] = { |
187 install_detector_image_filter, | 187 install_detector_image_filter, |
188 install_detector_color_filter | 188 install_detector_color_filter |
189 }; | 189 }; |
190 | 190 |
191 for (size_t i = 0; i < SK_ARRAY_COUNT(shapeColors); ++i) { | 191 for (size_t i = 0; i < SK_ARRAY_COUNT(shapeColors); ++i) { |
192 shapeColor = shapeColors[i]; | 192 shapeColor = shapeColors[i]; |
193 for (size_t j = 0; j < SK_ARRAY_COUNT(shapeColors); ++j) { | 193 for (size_t j = 0; j < SK_ARRAY_COUNT(detectorInstallFuncs); ++j) { |
reed1
2016/06/23 17:43:29
can we use the fancy style (and be perhaps even cl
| |
194 InstallDetectorFunc detectorInstallFunc = detectorInstallFuncs[j]; | 194 InstallDetectorFunc detectorInstallFunc = detectorInstallFuncs[j]; |
195 for (size_t k = 0; k < SK_ARRAY_COUNT(funcs); ++k) { | 195 for (size_t k = 0; k < SK_ARRAY_COUNT(funcs); ++k) { |
196 TestVariantSequence drawTestSequence = funcs[k]; | 196 TestVariantSequence drawTestSequence = funcs[k]; |
197 canvas->save(); | 197 canvas->save(); |
198 drawTestSequence(canvas, shapeColor, detectorInstallFunc); | 198 drawTestSequence(canvas, shapeColor, detectorInstallFunc); |
199 canvas->flush(); | 199 canvas->flush(); |
200 canvas->translate(SkIntToScalar(kTestRectSize) + SkIntToScalar(1 ), SkIntToScalar(0)); | 200 canvas->translate(SkIntToScalar(kTestRectSize) + SkIntToScalar(1 ), SkIntToScalar(0)); |
201 { | 201 { |
202 SkPictureRecorder recorder; | 202 SkPictureRecorder recorder; |
203 drawTestSequence(recorder.beginRecording(SkIntToScalar(kTest RectSize), | 203 drawTestSequence(recorder.beginRecording(SkIntToScalar(kTest RectSize), |
204 SkIntToScalar(kTest RectSize)), | 204 SkIntToScalar(kTest RectSize)), |
205 shapeColor, detectorInstallFunc); | 205 shapeColor, detectorInstallFunc); |
206 recorder.finishRecordingAsPicture()->playback(canvas); | 206 recorder.finishRecordingAsPicture()->playback(canvas); |
207 canvas->flush(); | 207 canvas->flush(); |
208 } | 208 } |
209 | 209 |
210 canvas->restore(); | 210 canvas->restore(); |
211 canvas->translate(SkIntToScalar(0), SkIntToScalar(kTestRectSize) + SkIntToScalar(1)); | 211 canvas->translate(SkIntToScalar(0), SkIntToScalar(kTestRectSize) + SkIntToScalar(1)); |
212 } | 212 } |
213 | 213 |
214 } | 214 } |
215 } | 215 } |
216 } | 216 } |
OLD | NEW |