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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 PathAndName path; | 123 PathAndName path; |
124 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1); | 124 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1); |
125 path.fPath.cubicTo(40*SK_Scalar1, 20*SK_Scalar1, | 125 path.fPath.cubicTo(40*SK_Scalar1, 20*SK_Scalar1, |
126 60*SK_Scalar1, 20*SK_Scalar1, | 126 60*SK_Scalar1, 20*SK_Scalar1, |
127 75*SK_Scalar1, 10*SK_Scalar1); | 127 75*SK_Scalar1, 10*SK_Scalar1); |
128 path.fName = "moveTo-cubic"; | 128 path.fName = "moveTo-cubic"; |
129 | 129 |
130 SkPaint titlePaint; | 130 SkPaint titlePaint; |
131 titlePaint.setColor(SK_ColorBLACK); | 131 titlePaint.setColor(SK_ColorBLACK); |
132 titlePaint.setAntiAlias(true); | 132 titlePaint.setAntiAlias(true); |
| 133 sk_tool_utils::set_portable_typeface(&titlePaint); |
133 titlePaint.setLCDRenderText(true); | 134 titlePaint.setLCDRenderText(true); |
134 titlePaint.setTextSize(15 * SK_Scalar1); | 135 titlePaint.setTextSize(15 * SK_Scalar1); |
135 const char title[] = "Cubic Drawn Into Rectangle Clips With " | 136 const char title[] = "Cubic Drawn Into Rectangle Clips With " |
136 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; | 137 "Indicated Style, Fill and Linecaps, with stroke wi
dth 10"; |
137 canvas->drawText(title, strlen(title), | 138 canvas->drawText(title, strlen(title), |
138 20 * SK_Scalar1, | 139 20 * SK_Scalar1, |
139 20 * SK_Scalar1, | 140 20 * SK_Scalar1, |
140 titlePaint); | 141 titlePaint); |
141 | 142 |
142 SkLCGRandom rand; | 143 SkLCGRandom rand; |
(...skipping 24 matching lines...) Expand all Loading... |
167 SkPaint rectPaint; | 168 SkPaint rectPaint; |
168 rectPaint.setColor(SK_ColorBLACK); | 169 rectPaint.setColor(SK_ColorBLACK); |
169 rectPaint.setStyle(SkPaint::kStroke_Style); | 170 rectPaint.setStyle(SkPaint::kStroke_Style); |
170 rectPaint.setStrokeWidth(-1); | 171 rectPaint.setStrokeWidth(-1); |
171 rectPaint.setAntiAlias(true); | 172 rectPaint.setAntiAlias(true); |
172 canvas->drawRect(rect, rectPaint); | 173 canvas->drawRect(rect, rectPaint); |
173 | 174 |
174 SkPaint labelPaint; | 175 SkPaint labelPaint; |
175 labelPaint.setColor(color); | 176 labelPaint.setColor(color); |
176 labelPaint.setAntiAlias(true); | 177 labelPaint.setAntiAlias(true); |
| 178 sk_tool_utils::set_portable_typeface(&labelPaint); |
177 labelPaint.setLCDRenderText(true); | 179 labelPaint.setLCDRenderText(true); |
178 labelPaint.setTextSize(10 * SK_Scalar1); | 180 labelPaint.setTextSize(10 * SK_Scalar1); |
179 canvas->drawText(gStyles[style].fName, | 181 canvas->drawText(gStyles[style].fName, |
180 strlen(gStyles[style].fName), | 182 strlen(gStyles[style].fName), |
181 0, rect.height() + 12 * SK_Scalar1, | 183 0, rect.height() + 12 * SK_Scalar1, |
182 labelPaint); | 184 labelPaint); |
183 canvas->drawText(gFills[fill].fName, | 185 canvas->drawText(gFills[fill].fName, |
184 strlen(gFills[fill].fName), | 186 strlen(gFills[fill].fName), |
185 0, rect.height() + 24 * SK_Scalar1, | 187 0, rect.height() + 24 * SK_Scalar1, |
186 labelPaint); | 188 labelPaint); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 349 |
348 private: | 350 private: |
349 typedef skiagm::GM INHERITED; | 351 typedef skiagm::GM INHERITED; |
350 }; | 352 }; |
351 | 353 |
352 ////////////////////////////////////////////////////////////////////////////// | 354 ////////////////////////////////////////////////////////////////////////////// |
353 | 355 |
354 DEF_GM( return new CubicPathGM; ) | 356 DEF_GM( return new CubicPathGM; ) |
355 DEF_GM( return new CubicClosePathGM; ) | 357 DEF_GM( return new CubicClosePathGM; ) |
356 DEF_GM( return new ClippedCubicGM; ) | 358 DEF_GM( return new ClippedCubicGM; ) |
OLD | NEW |