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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 sk_tool_utils::set_portable_typeface(&titlePaint); | 89 sk_tool_utils::set_portable_typeface(&titlePaint); |
90 titlePaint.setLCDRenderText(true); | 90 titlePaint.setLCDRenderText(true); |
91 titlePaint.setTextSize(15 * SK_Scalar1); | 91 titlePaint.setTextSize(15 * SK_Scalar1); |
92 const char title[] = "Quad Drawn Into Rectangle Clips With " | 92 const char title[] = "Quad Drawn Into Rectangle Clips With " |
93 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; | 93 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; |
94 canvas->drawText(title, strlen(title), | 94 canvas->drawText(title, strlen(title), |
95 20 * SK_Scalar1, | 95 20 * SK_Scalar1, |
96 20 * SK_Scalar1, | 96 20 * SK_Scalar1, |
97 titlePaint); | 97 titlePaint); |
98 | 98 |
99 SkLCGRandom rand; | 99 SkRandom rand; |
100 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); | 100 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); |
101 canvas->save(); | 101 canvas->save(); |
102 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); | 102 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); |
103 canvas->save(); | 103 canvas->save(); |
104 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { | 104 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { |
105 if (0 < cap) { | 105 if (0 < cap) { |
106 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); | 106 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); |
107 } | 107 } |
108 canvas->save(); | 108 canvas->save(); |
109 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { | 109 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 sk_tool_utils::set_portable_typeface(&titlePaint); | 238 sk_tool_utils::set_portable_typeface(&titlePaint); |
239 titlePaint.setLCDRenderText(true); | 239 titlePaint.setLCDRenderText(true); |
240 titlePaint.setTextSize(15 * SK_Scalar1); | 240 titlePaint.setTextSize(15 * SK_Scalar1); |
241 const char title[] = "Quad Closed Drawn Into Rectangle Clips With " | 241 const char title[] = "Quad Closed Drawn Into Rectangle Clips With " |
242 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; | 242 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; |
243 canvas->drawText(title, strlen(title), | 243 canvas->drawText(title, strlen(title), |
244 20 * SK_Scalar1, | 244 20 * SK_Scalar1, |
245 20 * SK_Scalar1, | 245 20 * SK_Scalar1, |
246 titlePaint); | 246 titlePaint); |
247 | 247 |
248 SkLCGRandom rand; | 248 SkRandom rand; |
249 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); | 249 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); |
250 canvas->save(); | 250 canvas->save(); |
251 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); | 251 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); |
252 canvas->save(); | 252 canvas->save(); |
253 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { | 253 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { |
254 if (0 < cap) { | 254 if (0 < cap) { |
255 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); | 255 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); |
256 } | 256 } |
257 canvas->save(); | 257 canvas->save(); |
258 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { | 258 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 310 |
311 ////////////////////////////////////////////////////////////////////////////// | 311 ////////////////////////////////////////////////////////////////////////////// |
312 | 312 |
313 static GM* QuadPathFactory(void*) { return new QuadPathGM; } | 313 static GM* QuadPathFactory(void*) { return new QuadPathGM; } |
314 static GMRegistry regQuadPath(QuadPathFactory); | 314 static GMRegistry regQuadPath(QuadPathFactory); |
315 | 315 |
316 static GM* QuadClosePathFactory(void*) { return new QuadClosePathGM; } | 316 static GM* QuadClosePathFactory(void*) { return new QuadClosePathGM; } |
317 static GMRegistry regQuadClosePath(QuadClosePathFactory); | 317 static GMRegistry regQuadClosePath(QuadClosePathFactory); |
318 | 318 |
319 } | 319 } |
OLD | NEW |