OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "gm.h" | 7 #include "gm.h" |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 titlePaint.setAntiAlias(true); | 83 titlePaint.setAntiAlias(true); |
84 titlePaint.setLCDRenderText(true); | 84 titlePaint.setLCDRenderText(true); |
85 titlePaint.setTextSize(15 * SK_Scalar1); | 85 titlePaint.setTextSize(15 * SK_Scalar1); |
86 const char title[] = "Line Drawn Into Rectangle Clips With " | 86 const char title[] = "Line Drawn Into Rectangle Clips With " |
87 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; | 87 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; |
88 canvas->drawText(title, strlen(title), | 88 canvas->drawText(title, strlen(title), |
89 20 * SK_Scalar1, | 89 20 * SK_Scalar1, |
90 20 * SK_Scalar1, | 90 20 * SK_Scalar1, |
91 titlePaint); | 91 titlePaint); |
92 | 92 |
93 SkRandom rand; | 93 SkLCGRandom rand; |
94 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); | 94 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); |
95 canvas->save(); | 95 canvas->save(); |
96 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); | 96 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); |
97 canvas->save(); | 97 canvas->save(); |
98 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { | 98 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { |
99 if (0 < cap) { | 99 if (0 < cap) { |
100 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); | 100 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); |
101 } | 101 } |
102 canvas->save(); | 102 canvas->save(); |
103 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { | 103 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 titlePaint.setAntiAlias(true); | 225 titlePaint.setAntiAlias(true); |
226 titlePaint.setLCDRenderText(true); | 226 titlePaint.setLCDRenderText(true); |
227 titlePaint.setTextSize(15 * SK_Scalar1); | 227 titlePaint.setTextSize(15 * SK_Scalar1); |
228 const char title[] = "Line Closed Drawn Into Rectangle Clips With " | 228 const char title[] = "Line Closed Drawn Into Rectangle Clips With " |
229 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; | 229 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; |
230 canvas->drawText(title, strlen(title), | 230 canvas->drawText(title, strlen(title), |
231 20 * SK_Scalar1, | 231 20 * SK_Scalar1, |
232 20 * SK_Scalar1, | 232 20 * SK_Scalar1, |
233 titlePaint); | 233 titlePaint); |
234 | 234 |
235 SkRandom rand; | 235 SkLCGRandom rand; |
236 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); | 236 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); |
237 canvas->save(); | 237 canvas->save(); |
238 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); | 238 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); |
239 canvas->save(); | 239 canvas->save(); |
240 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { | 240 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { |
241 if (0 < cap) { | 241 if (0 < cap) { |
242 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); | 242 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); |
243 } | 243 } |
244 canvas->save(); | 244 canvas->save(); |
245 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { | 245 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 296 |
297 ////////////////////////////////////////////////////////////////////////////// | 297 ////////////////////////////////////////////////////////////////////////////// |
298 | 298 |
299 static GM* LinePathFactory(void*) { return new LinePathGM; } | 299 static GM* LinePathFactory(void*) { return new LinePathGM; } |
300 static GMRegistry regLinePath(LinePathFactory); | 300 static GMRegistry regLinePath(LinePathFactory); |
301 | 301 |
302 static GM* LineClosePathFactory(void*) { return new LineClosePathGM; } | 302 static GM* LineClosePathFactory(void*) { return new LineClosePathGM; } |
303 static GMRegistry regLineClosePath(LineClosePathFactory); | 303 static GMRegistry regLineClosePath(LineClosePathFactory); |
304 | 304 |
305 } | 305 } |
OLD | NEW |