| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 sk_tool_utils::set_portable_typeface(&titlePaint); | 88 sk_tool_utils::set_portable_typeface(&titlePaint); |
| 89 titlePaint.setLCDRenderText(true); | 89 titlePaint.setLCDRenderText(true); |
| 90 titlePaint.setTextSize(15 * SK_Scalar1); | 90 titlePaint.setTextSize(15 * SK_Scalar1); |
| 91 const char title[] = "Line Drawn Into Rectangle Clips With " | 91 const char title[] = "Line Drawn Into Rectangle Clips With " |
| 92 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; | 92 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; |
| 93 canvas->drawText(title, strlen(title), | 93 canvas->drawText(title, strlen(title), |
| 94 20 * SK_Scalar1, | 94 20 * SK_Scalar1, |
| 95 20 * SK_Scalar1, | 95 20 * SK_Scalar1, |
| 96 titlePaint); | 96 titlePaint); |
| 97 | 97 |
| 98 SkLCGRandom rand; | 98 SkRandom rand; |
| 99 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); | 99 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); |
| 100 canvas->save(); | 100 canvas->save(); |
| 101 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); | 101 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); |
| 102 canvas->save(); | 102 canvas->save(); |
| 103 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { | 103 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { |
| 104 if (0 < cap) { | 104 if (0 < cap) { |
| 105 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); | 105 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); |
| 106 } | 106 } |
| 107 canvas->save(); | 107 canvas->save(); |
| 108 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { | 108 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 sk_tool_utils::set_portable_typeface(&titlePaint); | 232 sk_tool_utils::set_portable_typeface(&titlePaint); |
| 233 titlePaint.setLCDRenderText(true); | 233 titlePaint.setLCDRenderText(true); |
| 234 titlePaint.setTextSize(15 * SK_Scalar1); | 234 titlePaint.setTextSize(15 * SK_Scalar1); |
| 235 const char title[] = "Line Closed Drawn Into Rectangle Clips With " | 235 const char title[] = "Line Closed Drawn Into Rectangle Clips With " |
| 236 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; | 236 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; |
| 237 canvas->drawText(title, strlen(title), | 237 canvas->drawText(title, strlen(title), |
| 238 20 * SK_Scalar1, | 238 20 * SK_Scalar1, |
| 239 20 * SK_Scalar1, | 239 20 * SK_Scalar1, |
| 240 titlePaint); | 240 titlePaint); |
| 241 | 241 |
| 242 SkLCGRandom rand; | 242 SkRandom rand; |
| 243 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); | 243 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); |
| 244 canvas->save(); | 244 canvas->save(); |
| 245 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); | 245 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1); |
| 246 canvas->save(); | 246 canvas->save(); |
| 247 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { | 247 for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) { |
| 248 if (0 < cap) { | 248 if (0 < cap) { |
| 249 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); | 249 canvas->translate((rect.width() + 40 * SK_Scalar1) * SK_ARRAY_CO
UNT(gStyles), 0); |
| 250 } | 250 } |
| 251 canvas->save(); | 251 canvas->save(); |
| 252 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { | 252 for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 304 |
| 305 ////////////////////////////////////////////////////////////////////////////// | 305 ////////////////////////////////////////////////////////////////////////////// |
| 306 | 306 |
| 307 static GM* LinePathFactory(void*) { return new LinePathGM; } | 307 static GM* LinePathFactory(void*) { return new LinePathGM; } |
| 308 static GMRegistry regLinePath(LinePathFactory); | 308 static GMRegistry regLinePath(LinePathFactory); |
| 309 | 309 |
| 310 static GM* LineClosePathFactory(void*) { return new LineClosePathGM; } | 310 static GM* LineClosePathFactory(void*) { return new LineClosePathGM; } |
| 311 static GMRegistry regLineClosePath(LineClosePathFactory); | 311 static GMRegistry regLineClosePath(LineClosePathFactory); |
| 312 | 312 |
| 313 } | 313 } |
| OLD | NEW |