| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkDashPathEffect.h" | 10 #include "SkDashPathEffect.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 SkPaint paint; | 306 SkPaint paint; |
| 307 paint.setStyle(SkPaint::kStroke_Style); | 307 paint.setStyle(SkPaint::kStroke_Style); |
| 308 paint.setPathEffect(dash); | 308 paint.setPathEffect(dash); |
| 309 | 309 |
| 310 SkPath filteredPath; | 310 SkPath filteredPath; |
| 311 SkStrokeRec rec(paint); | 311 SkStrokeRec rec(paint); |
| 312 REPORTER_ASSERT(reporter, !dash->filterPath(&filteredPath, path, &rec, nullp
tr)); | 312 REPORTER_ASSERT(reporter, !dash->filterPath(&filteredPath, path, &rec, nullp
tr)); |
| 313 REPORTER_ASSERT(reporter, filteredPath.isEmpty()); | 313 REPORTER_ASSERT(reporter, filteredPath.isEmpty()); |
| 314 } | 314 } |
| 315 | 315 |
| 316 // http://crbug.com/472147 | |
| 317 // This is a simplified version from the bug. RRect radii not properly scaled. | |
| 318 static void test_crbug_472147_simple(skiatest::Reporter* reporter) { | |
| 319 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(1000, 1000)); | |
| 320 SkCanvas* canvas = surface->getCanvas(); | |
| 321 SkPaint p; | |
| 322 SkRect r = SkRect::MakeLTRB(-246.0f, 33.0f, 848.0f, 33554464.0f); | |
| 323 SkVector radii[4] = { | |
| 324 { 13.0f, 8.0f }, { 170.0f, 2.0 }, { 256.0f, 33554430.0f }, { 120.0f, 5.0
f } | |
| 325 }; | |
| 326 SkRRect rr; | |
| 327 rr.setRectRadii(r, radii); | |
| 328 canvas->drawRRect(rr, p); | |
| 329 } | |
| 330 | |
| 331 // http://crbug.com/472147 | |
| 332 // RRect radii not properly scaled. | |
| 333 static void test_crbug_472147_actual(skiatest::Reporter* reporter) { | |
| 334 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(1000, 1000)); | |
| 335 SkCanvas* canvas = surface->getCanvas(); | |
| 336 SkPaint p; | |
| 337 SkRect r = SkRect::MakeLTRB(-246.0f, 33.0f, 848.0f, 33554464.0f); | |
| 338 SkVector radii[4] = { | |
| 339 { 13.0f, 8.0f }, { 170.0f, 2.0 }, { 256.0f, 33554430.0f }, { 120.0f, 5.0
f } | |
| 340 }; | |
| 341 SkRRect rr; | |
| 342 rr.setRectRadii(r, radii); | |
| 343 canvas->clipRRect(rr, SkRegion::kIntersect_Op, false); | |
| 344 | |
| 345 SkRect r2 = SkRect::MakeLTRB(0, 33, 1102, 33554464); | |
| 346 canvas->drawRect(r2, p); | |
| 347 } | |
| 348 | |
| 349 DEF_TEST(DrawPath, reporter) { | 316 DEF_TEST(DrawPath, reporter) { |
| 350 test_giantaa(); | 317 test_giantaa(); |
| 351 test_bug533(); | 318 test_bug533(); |
| 352 test_bigcubic(); | 319 test_bigcubic(); |
| 353 test_crbug_124652(); | 320 test_crbug_124652(); |
| 354 test_crbug_140642(); | 321 test_crbug_140642(); |
| 355 test_crbug_140803(); | 322 test_crbug_140803(); |
| 356 test_inversepathwithclip(); | 323 test_inversepathwithclip(); |
| 357 // why? | 324 // why? |
| 358 if (false) test_crbug131181(); | 325 if (false) test_crbug131181(); |
| 359 test_infinite_dash(reporter); | 326 test_infinite_dash(reporter); |
| 360 test_crbug_165432(reporter); | 327 test_crbug_165432(reporter); |
| 361 test_crbug_472147_simple(reporter); | |
| 362 test_crbug_472147_actual(reporter); | |
| 363 test_big_aa_rect(reporter); | 328 test_big_aa_rect(reporter); |
| 364 test_halfway(); | 329 test_halfway(); |
| 365 } | 330 } |
| OLD | NEW |