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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 titlePaint.setAntiAlias(true); | 84 titlePaint.setAntiAlias(true); |
85 titlePaint.setLCDRenderText(true); | 85 titlePaint.setLCDRenderText(true); |
86 titlePaint.setTextSize(15 * SK_Scalar1); | 86 titlePaint.setTextSize(15 * SK_Scalar1); |
87 const char title[] = "Quad Drawn Into Rectangle Clips With " | 87 const char title[] = "Quad Drawn Into Rectangle Clips With " |
88 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; | 88 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; |
89 canvas->drawText(title, strlen(title), | 89 canvas->drawText(title, strlen(title), |
90 20 * SK_Scalar1, | 90 20 * SK_Scalar1, |
91 20 * SK_Scalar1, | 91 20 * SK_Scalar1, |
92 titlePaint); | 92 titlePaint); |
93 | 93 |
94 SkRandom rand; | 94 SkLCGRandom rand; |
95 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); | 95 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); |
96 canvas->save(); | 96 canvas->save(); |
97 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); | 97 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); |
98 canvas->save(); | 98 canvas->save(); |
99 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { | 99 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { |
100 if (0 < cap) { | 100 if (0 < cap) { |
101 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); | 101 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); |
102 } | 102 } |
103 canvas->save(); | 103 canvas->save(); |
104 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { | 104 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 titlePaint.setAntiAlias(true); | 227 titlePaint.setAntiAlias(true); |
228 titlePaint.setLCDRenderText(true); | 228 titlePaint.setLCDRenderText(true); |
229 titlePaint.setTextSize(15 * SK_Scalar1); | 229 titlePaint.setTextSize(15 * SK_Scalar1); |
230 const char title[] = "Quad Closed Drawn Into Rectangle Clips With " | 230 const char title[] = "Quad Closed Drawn Into Rectangle Clips With " |
231 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; | 231 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; |
232 canvas->drawText(title, strlen(title), | 232 canvas->drawText(title, strlen(title), |
233 20 * SK_Scalar1, | 233 20 * SK_Scalar1, |
234 20 * SK_Scalar1, | 234 20 * SK_Scalar1, |
235 titlePaint); | 235 titlePaint); |
236 | 236 |
237 SkRandom rand; | 237 SkLCGRandom rand; |
238 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); | 238 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); |
239 canvas->save(); | 239 canvas->save(); |
240 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); | 240 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); |
241 canvas->save(); | 241 canvas->save(); |
242 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { | 242 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { |
243 if (0 < cap) { | 243 if (0 < cap) { |
244 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); | 244 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); |
245 } | 245 } |
246 canvas->save(); | 246 canvas->save(); |
247 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { | 247 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 ////////////////////////////////////////////////////////////////////////////// | 299 ////////////////////////////////////////////////////////////////////////////// |
300 | 300 |
301 static GM* QuadPathFactory(void*) { return new QuadPathGM; } | 301 static GM* QuadPathFactory(void*) { return new QuadPathGM; } |
302 static GMRegistry regQuadPath(QuadPathFactory); | 302 static GMRegistry regQuadPath(QuadPathFactory); |
303 | 303 |
304 static GM* QuadClosePathFactory(void*) { return new QuadClosePathGM; } | 304 static GM* QuadClosePathFactory(void*) { return new QuadClosePathGM; } |
305 static GMRegistry regQuadClosePath(QuadClosePathFactory); | 305 static GMRegistry regQuadClosePath(QuadClosePathFactory); |
306 | 306 |
307 } | 307 } |
OLD | NEW |