| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 PathAndName path; | 117 PathAndName path; |
| 118 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1); | 118 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1); |
| 119 path.fPath.cubicTo(40*SK_Scalar1, 20*SK_Scalar1, | 119 path.fPath.cubicTo(40*SK_Scalar1, 20*SK_Scalar1, |
| 120 60*SK_Scalar1, 20*SK_Scalar1, | 120 60*SK_Scalar1, 20*SK_Scalar1, |
| 121 75*SK_Scalar1, 10*SK_Scalar1); | 121 75*SK_Scalar1, 10*SK_Scalar1); |
| 122 path.fName = "moveTo-cubic"; | 122 path.fName = "moveTo-cubic"; |
| 123 | 123 |
| 124 SkPaint titlePaint; | 124 SkPaint titlePaint; |
| 125 titlePaint.setColor(SK_ColorBLACK); | 125 titlePaint.setColor(SK_ColorBLACK); |
| 126 titlePaint.setAntiAlias(true); | 126 titlePaint.setAntiAlias(true); |
| 127 sk_tool_utils::set_portable_typeface(&titlePaint); | 127 sk_tool_utils::set_portable_typeface_always(&titlePaint); |
| 128 titlePaint.setLCDRenderText(true); | |
| 129 titlePaint.setTextSize(15 * SK_Scalar1); | 128 titlePaint.setTextSize(15 * SK_Scalar1); |
| 130 const char title[] = "Cubic Drawn Into Rectangle Clips With " | 129 const char title[] = "Cubic Drawn Into Rectangle Clips With " |
| 131 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; | 130 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; |
| 132 canvas->drawText(title, strlen(title), | 131 canvas->drawText(title, strlen(title), |
| 133 20 * SK_Scalar1, | 132 20 * SK_Scalar1, |
| 134 20 * SK_Scalar1, | 133 20 * SK_Scalar1, |
| 135 titlePaint); | 134 titlePaint); |
| 136 | 135 |
| 137 SkRandom rand; | 136 SkRandom rand; |
| 138 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); | 137 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 162 SkPaint rectPaint; | 161 SkPaint rectPaint; |
| 163 rectPaint.setColor(SK_ColorBLACK); | 162 rectPaint.setColor(SK_ColorBLACK); |
| 164 rectPaint.setStyle(SkPaint::kStroke_Style); | 163 rectPaint.setStyle(SkPaint::kStroke_Style); |
| 165 rectPaint.setStrokeWidth(-1); | 164 rectPaint.setStrokeWidth(-1); |
| 166 rectPaint.setAntiAlias(true); | 165 rectPaint.setAntiAlias(true); |
| 167 canvas->drawRect(rect, rectPaint); | 166 canvas->drawRect(rect, rectPaint); |
| 168 | 167 |
| 169 SkPaint labelPaint; | 168 SkPaint labelPaint; |
| 170 labelPaint.setColor(color); | 169 labelPaint.setColor(color); |
| 171 labelPaint.setAntiAlias(true); | 170 labelPaint.setAntiAlias(true); |
| 172 sk_tool_utils::set_portable_typeface(&labelPaint); | 171 sk_tool_utils::set_portable_typeface_always(&labelPaint); |
| 173 labelPaint.setLCDRenderText(true); | |
| 174 labelPaint.setTextSize(10 * SK_Scalar1); | 172 labelPaint.setTextSize(10 * SK_Scalar1); |
| 175 canvas->drawText(gStyles[style].fName, | 173 canvas->drawText(gStyles[style].fName, |
| 176 strlen(gStyles[style].fName), | 174 strlen(gStyles[style].fName), |
| 177 0, rect.height() + 12 * SK_Scalar1, | 175 0, rect.height() + 12 * SK_Scalar1, |
| 178 labelPaint); | 176 labelPaint); |
| 179 canvas->drawText(gFills[fill].fName, | 177 canvas->drawText(gFills[fill].fName, |
| 180 strlen(gFills[fill].fName), | 178 strlen(gFills[fill].fName), |
| 181 0, rect.height() + 24 * SK_Scalar1, | 179 0, rect.height() + 24 * SK_Scalar1, |
| 182 labelPaint); | 180 labelPaint); |
| 183 canvas->drawText(gCaps[cap].fName, | 181 canvas->drawText(gCaps[cap].fName, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1); | 262 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1); |
| 265 path.fPath.cubicTo(40*SK_Scalar1, 20*SK_Scalar1, | 263 path.fPath.cubicTo(40*SK_Scalar1, 20*SK_Scalar1, |
| 266 60*SK_Scalar1, 20*SK_Scalar1, | 264 60*SK_Scalar1, 20*SK_Scalar1, |
| 267 75*SK_Scalar1, 10*SK_Scalar1); | 265 75*SK_Scalar1, 10*SK_Scalar1); |
| 268 path.fPath.close(); | 266 path.fPath.close(); |
| 269 path.fName = "moveTo-cubic-close"; | 267 path.fName = "moveTo-cubic-close"; |
| 270 | 268 |
| 271 SkPaint titlePaint; | 269 SkPaint titlePaint; |
| 272 titlePaint.setColor(SK_ColorBLACK); | 270 titlePaint.setColor(SK_ColorBLACK); |
| 273 titlePaint.setAntiAlias(true); | 271 titlePaint.setAntiAlias(true); |
| 274 sk_tool_utils::set_portable_typeface(&titlePaint); | 272 sk_tool_utils::set_portable_typeface_always(&titlePaint); |
| 275 titlePaint.setLCDRenderText(true); | |
| 276 titlePaint.setTextSize(15 * SK_Scalar1); | 273 titlePaint.setTextSize(15 * SK_Scalar1); |
| 277 const char title[] = "Cubic Closed Drawn Into Rectangle Clips With " | 274 const char title[] = "Cubic Closed Drawn Into Rectangle Clips With " |
| 278 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; | 275 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; |
| 279 canvas->drawText(title, strlen(title), | 276 canvas->drawText(title, strlen(title), |
| 280 20 * SK_Scalar1, | 277 20 * SK_Scalar1, |
| 281 20 * SK_Scalar1, | 278 20 * SK_Scalar1, |
| 282 titlePaint); | 279 titlePaint); |
| 283 | 280 |
| 284 SkRandom rand; | 281 SkRandom rand; |
| 285 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); | 282 SkRect rect = SkRect::MakeWH(100*SK_Scalar1, 30*SK_Scalar1); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 309 SkPaint rectPaint; | 306 SkPaint rectPaint; |
| 310 rectPaint.setColor(SK_ColorBLACK); | 307 rectPaint.setColor(SK_ColorBLACK); |
| 311 rectPaint.setStyle(SkPaint::kStroke_Style); | 308 rectPaint.setStyle(SkPaint::kStroke_Style); |
| 312 rectPaint.setStrokeWidth(-1); | 309 rectPaint.setStrokeWidth(-1); |
| 313 rectPaint.setAntiAlias(true); | 310 rectPaint.setAntiAlias(true); |
| 314 canvas->drawRect(rect, rectPaint); | 311 canvas->drawRect(rect, rectPaint); |
| 315 | 312 |
| 316 SkPaint labelPaint; | 313 SkPaint labelPaint; |
| 317 labelPaint.setColor(color); | 314 labelPaint.setColor(color); |
| 318 labelPaint.setAntiAlias(true); | 315 labelPaint.setAntiAlias(true); |
| 319 sk_tool_utils::set_portable_typeface(&labelPaint); | 316 sk_tool_utils::set_portable_typeface_always(&labelPaint); |
| 320 labelPaint.setLCDRenderText(true); | |
| 321 labelPaint.setTextSize(10 * SK_Scalar1); | 317 labelPaint.setTextSize(10 * SK_Scalar1); |
| 322 canvas->drawText(gStyles[style].fName, | 318 canvas->drawText(gStyles[style].fName, |
| 323 strlen(gStyles[style].fName), | 319 strlen(gStyles[style].fName), |
| 324 0, rect.height() + 12 * SK_Scalar1, | 320 0, rect.height() + 12 * SK_Scalar1, |
| 325 labelPaint); | 321 labelPaint); |
| 326 canvas->drawText(gFills[fill].fName, | 322 canvas->drawText(gFills[fill].fName, |
| 327 strlen(gFills[fill].fName), | 323 strlen(gFills[fill].fName), |
| 328 0, rect.height() + 24 * SK_Scalar1, | 324 0, rect.height() + 24 * SK_Scalar1, |
| 329 labelPaint); | 325 labelPaint); |
| 330 canvas->drawText(gCaps[cap].fName, | 326 canvas->drawText(gCaps[cap].fName, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 342 | 338 |
| 343 private: | 339 private: |
| 344 typedef skiagm::GM INHERITED; | 340 typedef skiagm::GM INHERITED; |
| 345 }; | 341 }; |
| 346 | 342 |
| 347 ////////////////////////////////////////////////////////////////////////////// | 343 ////////////////////////////////////////////////////////////////////////////// |
| 348 | 344 |
| 349 DEF_GM( return new CubicPathGM; ) | 345 DEF_GM( return new CubicPathGM; ) |
| 350 DEF_GM( return new CubicClosePathGM; ) | 346 DEF_GM( return new CubicClosePathGM; ) |
| 351 DEF_GM( return new ClippedCubicGM; ) | 347 DEF_GM( return new ClippedCubicGM; ) |
| OLD | NEW |