| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 }; | 79 }; |
| 80 PathAndName path; | 80 PathAndName path; |
| 81 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1); | 81 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1); |
| 82 path.fPath.quadTo(50*SK_Scalar1, 20*SK_Scalar1, | 82 path.fPath.quadTo(50*SK_Scalar1, 20*SK_Scalar1, |
| 83 75*SK_Scalar1, 10*SK_Scalar1); | 83 75*SK_Scalar1, 10*SK_Scalar1); |
| 84 path.fName = "moveTo-quad"; | 84 path.fName = "moveTo-quad"; |
| 85 | 85 |
| 86 SkPaint titlePaint; | 86 SkPaint titlePaint; |
| 87 titlePaint.setColor(SK_ColorBLACK); | 87 titlePaint.setColor(SK_ColorBLACK); |
| 88 titlePaint.setAntiAlias(true); | 88 titlePaint.setAntiAlias(true); |
| 89 sk_tool_utils::set_portable_typeface(&titlePaint); |
| 89 titlePaint.setLCDRenderText(true); | 90 titlePaint.setLCDRenderText(true); |
| 90 titlePaint.setTextSize(15 * SK_Scalar1); | 91 titlePaint.setTextSize(15 * SK_Scalar1); |
| 91 const char title[] = "Quad Drawn Into Rectangle Clips With " | 92 const char title[] = "Quad Drawn Into Rectangle Clips With " |
| 92 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; | 93 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; |
| 93 canvas->drawText(title, strlen(title), | 94 canvas->drawText(title, strlen(title), |
| 94 20 * SK_Scalar1, | 95 20 * SK_Scalar1, |
| 95 20 * SK_Scalar1, | 96 20 * SK_Scalar1, |
| 96 titlePaint); | 97 titlePaint); |
| 97 | 98 |
| 98 SkLCGRandom rand; | 99 SkLCGRandom rand; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 123 SkPaint rectPaint; | 124 SkPaint rectPaint; |
| 124 rectPaint.setColor(SK_ColorBLACK); | 125 rectPaint.setColor(SK_ColorBLACK); |
| 125 rectPaint.setStyle(SkPaint::kStroke_Style); | 126 rectPaint.setStyle(SkPaint::kStroke_Style); |
| 126 rectPaint.setStrokeWidth(-1); | 127 rectPaint.setStrokeWidth(-1); |
| 127 rectPaint.setAntiAlias(true); | 128 rectPaint.setAntiAlias(true); |
| 128 canvas->drawRect(rect, rectPaint); | 129 canvas->drawRect(rect, rectPaint); |
| 129 | 130 |
| 130 SkPaint labelPaint; | 131 SkPaint labelPaint; |
| 131 labelPaint.setColor(color); | 132 labelPaint.setColor(color); |
| 132 labelPaint.setAntiAlias(true); | 133 labelPaint.setAntiAlias(true); |
| 134 sk_tool_utils::set_portable_typeface(&labelPaint); |
| 133 labelPaint.setLCDRenderText(true); | 135 labelPaint.setLCDRenderText(true); |
| 134 labelPaint.setTextSize(10 * SK_Scalar1); | 136 labelPaint.setTextSize(10 * SK_Scalar1); |
| 135 canvas->drawText(gStyles[style].fName, | 137 canvas->drawText(gStyles[style].fName, |
| 136 strlen(gStyles[style].fName), | 138 strlen(gStyles[style].fName), |
| 137 0, rect.height() + 12 * SK_Scalar1, | 139 0, rect.height() + 12 * SK_Scalar1, |
| 138 labelPaint); | 140 labelPaint); |
| 139 canvas->drawText(gFills[fill].fName, | 141 canvas->drawText(gFills[fill].fName, |
| 140 strlen(gFills[fill].fName), | 142 strlen(gFills[fill].fName), |
| 141 0, rect.height() + 24 * SK_Scalar1, | 143 0, rect.height() + 24 * SK_Scalar1, |
| 142 labelPaint); | 144 labelPaint); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 PathAndName path; | 228 PathAndName path; |
| 227 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1); | 229 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1); |
| 228 path.fPath.quadTo(50*SK_Scalar1, 20*SK_Scalar1, | 230 path.fPath.quadTo(50*SK_Scalar1, 20*SK_Scalar1, |
| 229 75*SK_Scalar1, 10*SK_Scalar1); | 231 75*SK_Scalar1, 10*SK_Scalar1); |
| 230 path.fPath.close(); | 232 path.fPath.close(); |
| 231 path.fName = "moveTo-quad-close"; | 233 path.fName = "moveTo-quad-close"; |
| 232 | 234 |
| 233 SkPaint titlePaint; | 235 SkPaint titlePaint; |
| 234 titlePaint.setColor(SK_ColorBLACK); | 236 titlePaint.setColor(SK_ColorBLACK); |
| 235 titlePaint.setAntiAlias(true); | 237 titlePaint.setAntiAlias(true); |
| 238 sk_tool_utils::set_portable_typeface(&titlePaint); |
| 236 titlePaint.setLCDRenderText(true); | 239 titlePaint.setLCDRenderText(true); |
| 237 titlePaint.setTextSize(15 * SK_Scalar1); | 240 titlePaint.setTextSize(15 * SK_Scalar1); |
| 238 const char title[] = "Quad Closed Drawn Into Rectangle Clips With " | 241 const char title[] = "Quad Closed Drawn Into Rectangle Clips With " |
| 239 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; | 242 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; |
| 240 canvas->drawText(title, strlen(title), | 243 canvas->drawText(title, strlen(title), |
| 241 20 * SK_Scalar1, | 244 20 * SK_Scalar1, |
| 242 20 * SK_Scalar1, | 245 20 * SK_Scalar1, |
| 243 titlePaint); | 246 titlePaint); |
| 244 | 247 |
| 245 SkLCGRandom rand; | 248 SkLCGRandom rand; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 270 SkPaint rectPaint; | 273 SkPaint rectPaint; |
| 271 rectPaint.setColor(SK_ColorBLACK); | 274 rectPaint.setColor(SK_ColorBLACK); |
| 272 rectPaint.setStyle(SkPaint::kStroke_Style); | 275 rectPaint.setStyle(SkPaint::kStroke_Style); |
| 273 rectPaint.setStrokeWidth(-1); | 276 rectPaint.setStrokeWidth(-1); |
| 274 rectPaint.setAntiAlias(true); | 277 rectPaint.setAntiAlias(true); |
| 275 canvas->drawRect(rect, rectPaint); | 278 canvas->drawRect(rect, rectPaint); |
| 276 | 279 |
| 277 SkPaint labelPaint; | 280 SkPaint labelPaint; |
| 278 labelPaint.setColor(color); | 281 labelPaint.setColor(color); |
| 279 labelPaint.setAntiAlias(true); | 282 labelPaint.setAntiAlias(true); |
| 283 sk_tool_utils::set_portable_typeface(&labelPaint); |
| 280 labelPaint.setLCDRenderText(true); | 284 labelPaint.setLCDRenderText(true); |
| 281 labelPaint.setTextSize(10 * SK_Scalar1); | 285 labelPaint.setTextSize(10 * SK_Scalar1); |
| 282 canvas->drawText(gStyles[style].fName, | 286 canvas->drawText(gStyles[style].fName, |
| 283 strlen(gStyles[style].fName), | 287 strlen(gStyles[style].fName), |
| 284 0, rect.height() + 12 * SK_Scalar1, | 288 0, rect.height() + 12 * SK_Scalar1, |
| 285 labelPaint); | 289 labelPaint); |
| 286 canvas->drawText(gFills[fill].fName, | 290 canvas->drawText(gFills[fill].fName, |
| 287 strlen(gFills[fill].fName), | 291 strlen(gFills[fill].fName), |
| 288 0, rect.height() + 24 * SK_Scalar1, | 292 0, rect.height() + 24 * SK_Scalar1, |
| 289 labelPaint); | 293 labelPaint); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 306 | 310 |
| 307 ////////////////////////////////////////////////////////////////////////////// | 311 ////////////////////////////////////////////////////////////////////////////// |
| 308 | 312 |
| 309 static GM* QuadPathFactory(void*) { return new QuadPathGM; } | 313 static GM* QuadPathFactory(void*) { return new QuadPathGM; } |
| 310 static GMRegistry regQuadPath(QuadPathFactory); | 314 static GMRegistry regQuadPath(QuadPathFactory); |
| 311 | 315 |
| 312 static GM* QuadClosePathFactory(void*) { return new QuadClosePathGM; } | 316 static GM* QuadClosePathFactory(void*) { return new QuadClosePathGM; } |
| 313 static GMRegistry regQuadClosePath(QuadClosePathFactory); | 317 static GMRegistry regQuadClosePath(QuadClosePathFactory); |
| 314 | 318 |
| 315 } | 319 } |
| OLD | NEW |