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 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPathPriv.h" | 10 #include "SkPathPriv.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 DEF_SIMPLE_GM_BG_NAME(strokefill, canvas, 640, 480, SK_ColorWHITE, | 252 DEF_SIMPLE_GM_BG_NAME(strokefill, canvas, 640, 480, SK_ColorWHITE, |
253 SkString("stroke-fill")) { | 253 SkString("stroke-fill")) { |
254 SkScalar x = SkIntToScalar(100); | 254 SkScalar x = SkIntToScalar(100); |
255 SkScalar y = SkIntToScalar(88); | 255 SkScalar y = SkIntToScalar(88); |
256 | 256 |
257 SkPaint paint; | 257 SkPaint paint; |
258 paint.setAntiAlias(true); | 258 paint.setAntiAlias(true); |
259 paint.setTextSize(SkIntToScalar(100)); | 259 paint.setTextSize(SkIntToScalar(100)); |
260 paint.setStrokeWidth(SkIntToScalar(5)); | 260 paint.setStrokeWidth(SkIntToScalar(5)); |
261 | 261 |
262 // use paths instead of text to test the path data on all platforms, sin
ce the | 262 // use paths instead of text to test the path data on all platforms, sin
ce the |
263 // Mac-specific font may change or is not available everywhere | 263 // Mac-specific font may change or is not available everywhere |
264 path_bold(canvas, papyrus_hello(), paint); | 264 path_bold(canvas, papyrus_hello(), paint); |
265 path_bold(canvas, hiragino_maru_gothic_pro_dash(), paint); | 265 path_bold(canvas, hiragino_maru_gothic_pro_dash(), paint); |
266 | 266 |
267 // use the portable typeface to generically test the fake bold code ever
ywhere | 267 // use the portable typeface to generically test the fake bold code ever
ywhere |
268 // (as long as the freetype option to do the bolding itself isn't enable
d) | 268 // (as long as the freetype option to do the bolding itself isn't enable
d) |
269 sk_tool_utils::set_portable_typeface(&paint, "serif"); | 269 sk_tool_utils::set_portable_typeface(&paint, "serif"); |
270 const unsigned char hiThere[] = "Hi There"; | 270 const unsigned char hiThere[] = "Hi There"; |
271 show_bold(canvas, hiThere, SK_ARRAY_COUNT(hiThere), x + SkIntToScalar(43
0), y, paint); | 271 show_bold(canvas, hiThere, SK_ARRAY_COUNT(hiThere), x + SkIntToScalar(43
0), y, paint); |
272 | 272 |
273 paint.setStyle(SkPaint::kStrokeAndFill_Style); | 273 paint.setStyle(SkPaint::kStrokeAndFill_Style); |
274 | 274 |
275 SkPath path; | 275 SkPath path; |
276 path.setFillType(SkPath::kWinding_FillType); | 276 path.setFillType(SkPath::kWinding_FillType); |
(...skipping 20 matching lines...) Expand all Loading... |
297 | 297 |
298 SkRect r = SkRect::MakeXYWH(x - SkIntToScalar(50), y + SkIntToScalar(280
), | 298 SkRect r = SkRect::MakeXYWH(x - SkIntToScalar(50), y + SkIntToScalar(280
), |
299 SkIntToScalar(100), SkIntToScalar(100)); | 299 SkIntToScalar(100), SkIntToScalar(100)); |
300 SkPath path3; | 300 SkPath path3; |
301 path3.setFillType(SkPath::kWinding_FillType); | 301 path3.setFillType(SkPath::kWinding_FillType); |
302 path3.addRect(r, SkPath::kCW_Direction); | 302 path3.addRect(r, SkPath::kCW_Direction); |
303 r.inset(SkIntToScalar(10), SkIntToScalar(10)); | 303 r.inset(SkIntToScalar(10), SkIntToScalar(10)); |
304 path3.addRect(r, SkPath::kCCW_Direction); | 304 path3.addRect(r, SkPath::kCCW_Direction); |
305 canvas->drawPath(path3, paint); | 305 canvas->drawPath(path3, paint); |
306 | 306 |
307 r = SkRect::MakeXYWH(x + SkIntToScalar(70), y + SkIntToScalar(280), | 307 r = SkRect::MakeXYWH(x + SkIntToScalar(70), y + SkIntToScalar(280), |
308 SkIntToScalar(100), SkIntToScalar(100)); | 308 SkIntToScalar(100), SkIntToScalar(100)); |
309 SkPath path4; | 309 SkPath path4; |
310 path4.setFillType(SkPath::kWinding_FillType); | 310 path4.setFillType(SkPath::kWinding_FillType); |
311 path4.addRect(r, SkPath::kCCW_Direction); | 311 path4.addRect(r, SkPath::kCCW_Direction); |
312 r.inset(SkIntToScalar(10), SkIntToScalar(10)); | 312 r.inset(SkIntToScalar(10), SkIntToScalar(10)); |
313 path4.addRect(r, SkPath::kCW_Direction); | 313 path4.addRect(r, SkPath::kCW_Direction); |
314 canvas->drawPath(path4, paint); | 314 canvas->drawPath(path4, paint); |
315 | 315 |
316 r = SkRect::MakeXYWH(x + SkIntToScalar(190), y + SkIntToScalar(280), | 316 r = SkRect::MakeXYWH(x + SkIntToScalar(190), y + SkIntToScalar(280), |
317 SkIntToScalar(100), SkIntToScalar(100)); | 317 SkIntToScalar(100), SkIntToScalar(100)); |
318 path4.reset(); | 318 path4.reset(); |
319 SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, nullptr)); | 319 SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, nullptr)); |
320 path4.addRect(r, SkPath::kCCW_Direction); | 320 path4.addRect(r, SkPath::kCCW_Direction); |
321 SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCCW_First
Direction)); | 321 SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCCW_First
Direction)); |
322 path4.moveTo(0, 0); // test for crbug.com/247770 | 322 path4.moveTo(0, 0); // test for crbug.com/247770 |
323 canvas->drawPath(path4, paint); | 323 canvas->drawPath(path4, paint); |
324 | 324 |
325 r = SkRect::MakeXYWH(x + SkIntToScalar(310), y + SkIntToScalar(280), | 325 r = SkRect::MakeXYWH(x + SkIntToScalar(310), y + SkIntToScalar(280), |
326 SkIntToScalar(100), SkIntToScalar(100)); | 326 SkIntToScalar(100), SkIntToScalar(100)); |
327 path4.reset(); | 327 path4.reset(); |
328 SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, nullptr)); | 328 SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, nullptr)); |
329 path4.addRect(r, SkPath::kCW_Direction); | 329 path4.addRect(r, SkPath::kCW_Direction); |
330 SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCW_FirstD
irection)); | 330 SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCW_FirstD
irection)); |
331 path4.moveTo(0, 0); // test for crbug.com/247770 | 331 path4.moveTo(0, 0); // test for crbug.com/247770 |
332 canvas->drawPath(path4, paint); | 332 canvas->drawPath(path4, paint); |
333 } | 333 } |
334 | 334 |
335 DEF_SIMPLE_GM(bug339297, canvas, 640, 480) { | 335 DEF_SIMPLE_GM(bug339297, canvas, 640, 480) { |
(...skipping 14 matching lines...) Expand all Loading... |
350 paint.setAntiAlias(true); | 350 paint.setAntiAlias(true); |
351 paint.setColor(SK_ColorBLACK); | 351 paint.setColor(SK_ColorBLACK); |
352 paint.setStyle(SkPaint::kFill_Style); | 352 paint.setStyle(SkPaint::kFill_Style); |
353 canvas->drawPath(path, paint); | 353 canvas->drawPath(path, paint); |
354 | 354 |
355 paint.setColor(SK_ColorRED); | 355 paint.setColor(SK_ColorRED); |
356 paint.setStyle(SkPaint::kStroke_Style); | 356 paint.setStyle(SkPaint::kStroke_Style); |
357 paint.setStrokeWidth(1); | 357 paint.setStrokeWidth(1); |
358 canvas->drawPath(path, paint); | 358 canvas->drawPath(path, paint); |
359 } | 359 } |
OLD | NEW |