| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 }; | 284 }; |
| 285 static const CapAndName gCaps[] = { | 285 static const CapAndName gCaps[] = { |
| 286 {SkPaint::kButt_Cap, SkPaint::kBevel_Join, "Butt"}, | 286 {SkPaint::kButt_Cap, SkPaint::kBevel_Join, "Butt"}, |
| 287 {SkPaint::kRound_Cap, SkPaint::kRound_Join, "Round"}, | 287 {SkPaint::kRound_Cap, SkPaint::kRound_Join, "Round"}, |
| 288 {SkPaint::kSquare_Cap, SkPaint::kBevel_Join, "Square"} | 288 {SkPaint::kSquare_Cap, SkPaint::kBevel_Join, "Square"} |
| 289 }; | 289 }; |
| 290 | 290 |
| 291 SkPaint titlePaint; | 291 SkPaint titlePaint; |
| 292 titlePaint.setColor(SK_ColorBLACK); | 292 titlePaint.setColor(SK_ColorBLACK); |
| 293 titlePaint.setAntiAlias(true); | 293 titlePaint.setAntiAlias(true); |
| 294 sk_tool_utils::set_portable_typeface(&titlePaint); |
| 294 titlePaint.setLCDRenderText(true); | 295 titlePaint.setLCDRenderText(true); |
| 295 titlePaint.setTextSize(15 * SK_Scalar1); | 296 titlePaint.setTextSize(15 * SK_Scalar1); |
| 296 const char title[] = "Random Paths Drawn Into Rectangle Clips With " | 297 const char title[] = "Random Paths Drawn Into Rectangle Clips With " |
| 297 "Indicated Style, Fill and Linecaps, " | 298 "Indicated Style, Fill and Linecaps, " |
| 298 "with Stroke width 6"; | 299 "with Stroke width 6"; |
| 299 canvas->drawText(title, strlen(title), | 300 canvas->drawText(title, strlen(title), |
| 300 20 * SK_Scalar1, | 301 20 * SK_Scalar1, |
| 301 20 * SK_Scalar1, | 302 20 * SK_Scalar1, |
| 302 titlePaint); | 303 titlePaint); |
| 303 | 304 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 SkPaint rectPaint; | 345 SkPaint rectPaint; |
| 345 rectPaint.setColor(SK_ColorBLACK); | 346 rectPaint.setColor(SK_ColorBLACK); |
| 346 rectPaint.setStyle(SkPaint::kStroke_Style); | 347 rectPaint.setStyle(SkPaint::kStroke_Style); |
| 347 rectPaint.setStrokeWidth(-1); | 348 rectPaint.setStrokeWidth(-1); |
| 348 rectPaint.setAntiAlias(true); | 349 rectPaint.setAntiAlias(true); |
| 349 canvas->drawRect(rect, rectPaint); | 350 canvas->drawRect(rect, rectPaint); |
| 350 | 351 |
| 351 SkPaint labelPaint; | 352 SkPaint labelPaint; |
| 352 labelPaint.setColor(color); | 353 labelPaint.setColor(color); |
| 353 labelPaint.setAntiAlias(true); | 354 labelPaint.setAntiAlias(true); |
| 355 sk_tool_utils::set_portable_typeface(&labelPaint); |
| 354 labelPaint.setLCDRenderText(true); | 356 labelPaint.setLCDRenderText(true); |
| 355 labelPaint.setTextSize(10 * SK_Scalar1); | 357 labelPaint.setTextSize(10 * SK_Scalar1); |
| 356 canvas->drawText(style.fName, | 358 canvas->drawText(style.fName, |
| 357 strlen(style.fName), | 359 strlen(style.fName), |
| 358 0, rect.height() + 12 * SK_Scalar1, | 360 0, rect.height() + 12 * SK_Scalar1, |
| 359 labelPaint); | 361 labelPaint); |
| 360 canvas->drawText(fill.fName, | 362 canvas->drawText(fill.fName, |
| 361 strlen(fill.fName), | 363 strlen(fill.fName), |
| 362 0, rect.height() + 24 * SK_Scalar1, | 364 0, rect.height() + 24 * SK_Scalar1, |
| 363 labelPaint); | 365 labelPaint); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 private: | 397 private: |
| 396 typedef GM INHERITED; | 398 typedef GM INHERITED; |
| 397 }; | 399 }; |
| 398 | 400 |
| 399 ////////////////////////////////////////////////////////////////////////////// | 401 ////////////////////////////////////////////////////////////////////////////// |
| 400 | 402 |
| 401 static GM* MyFactory(void*) { return new DegenerateSegmentsGM; } | 403 static GM* MyFactory(void*) { return new DegenerateSegmentsGM; } |
| 402 static GMRegistry reg(MyFactory); | 404 static GMRegistry reg(MyFactory); |
| 403 | 405 |
| 404 } | 406 } |
| OLD | NEW |