| 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkGeometry.h" | 9 #include "SkGeometry.h" |
| 10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 static void make_path_crbug364224_simplified(SkPath* path) { | 93 static void make_path_crbug364224_simplified(SkPath* path) { |
| 94 path->moveTo(3.747501373f, 2.724499941f); | 94 path->moveTo(3.747501373f, 2.724499941f); |
| 95 path->cubicTo(3.648251295f, 0.5194999576f, 3.575501442f, 0.4999999702f, 3.49
7501373f, 0.4999999702f); | 95 path->cubicTo(3.648251295f, 0.5194999576f, 3.575501442f, 0.4999999702f, 3.49
7501373f, 0.4999999702f); |
| 96 path->close(); | 96 path->close(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 static void test_path_crbug364224() { | 99 static void test_path_crbug364224() { |
| 100 SkPath path; | 100 SkPath path; |
| 101 SkPaint paint; | 101 SkPaint paint; |
| 102 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(84, 88)); | 102 auto surface(SkSurface::MakeRasterN32Premul(84, 88)); |
| 103 SkCanvas* canvas = surface->getCanvas(); | 103 SkCanvas* canvas = surface->getCanvas(); |
| 104 | 104 |
| 105 make_path_crbug364224_simplified(&path); | 105 make_path_crbug364224_simplified(&path); |
| 106 canvas->drawPath(path, paint); | 106 canvas->drawPath(path, paint); |
| 107 | 107 |
| 108 make_path_crbug364224(&path); | 108 make_path_crbug364224(&path); |
| 109 canvas->drawPath(path, paint); | 109 canvas->drawPath(path, paint); |
| 110 } | 110 } |
| 111 | 111 |
| 112 /** | 112 /** |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 // This used to assert in the debug build, as the edges did not all line-up. | 286 // This used to assert in the debug build, as the edges did not all line-up. |
| 287 static void test_bad_cubic_crbug234190() { | 287 static void test_bad_cubic_crbug234190() { |
| 288 SkPath path; | 288 SkPath path; |
| 289 path.moveTo(13.8509f, 3.16858f); | 289 path.moveTo(13.8509f, 3.16858f); |
| 290 path.cubicTo(-2.35893e+08f, -4.21044e+08f, | 290 path.cubicTo(-2.35893e+08f, -4.21044e+08f, |
| 291 -2.38991e+08f, -4.26573e+08f, | 291 -2.38991e+08f, -4.26573e+08f, |
| 292 -2.41016e+08f, -4.30188e+08f); | 292 -2.41016e+08f, -4.30188e+08f); |
| 293 | 293 |
| 294 SkPaint paint; | 294 SkPaint paint; |
| 295 paint.setAntiAlias(true); | 295 paint.setAntiAlias(true); |
| 296 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(84, 88)); | 296 auto surface(SkSurface::MakeRasterN32Premul(84, 88)); |
| 297 surface->getCanvas()->drawPath(path, paint); | 297 surface->getCanvas()->drawPath(path, paint); |
| 298 } | 298 } |
| 299 | 299 |
| 300 static void test_bad_cubic_crbug229478() { | 300 static void test_bad_cubic_crbug229478() { |
| 301 const SkPoint pts[] = { | 301 const SkPoint pts[] = { |
| 302 { 4595.91064f, -11596.9873f }, | 302 { 4595.91064f, -11596.9873f }, |
| 303 { 4597.2168f, -11595.9414f }, | 303 { 4597.2168f, -11595.9414f }, |
| 304 { 4598.52344f, -11594.8955f }, | 304 { 4598.52344f, -11594.8955f }, |
| 305 { 4599.83008f, -11593.8496f }, | 305 { 4599.83008f, -11593.8496f }, |
| 306 }; | 306 }; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 } | 405 } |
| 406 | 406 |
| 407 // This used to assert in the SK_DEBUG build, as the clip step would fail with | 407 // This used to assert in the SK_DEBUG build, as the clip step would fail with |
| 408 // too-few interations in our cubic-line intersection code. That code now runs | 408 // too-few interations in our cubic-line intersection code. That code now runs |
| 409 // 24 interations (instead of 16). | 409 // 24 interations (instead of 16). |
| 410 static void test_crbug_170666() { | 410 static void test_crbug_170666() { |
| 411 SkPath path; | 411 SkPath path; |
| 412 SkPaint paint; | 412 SkPaint paint; |
| 413 paint.setAntiAlias(true); | 413 paint.setAntiAlias(true); |
| 414 | 414 |
| 415 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(1000, 1000)); | 415 auto surface(SkSurface::MakeRasterN32Premul(1000, 1000)); |
| 416 | 416 |
| 417 build_path_simple_170666(path); | 417 build_path_simple_170666(path); |
| 418 surface->getCanvas()->drawPath(path, paint); | 418 surface->getCanvas()->drawPath(path, paint); |
| 419 | 419 |
| 420 build_path_170666(path); | 420 build_path_170666(path); |
| 421 surface->getCanvas()->drawPath(path, paint); | 421 surface->getCanvas()->drawPath(path, paint); |
| 422 } | 422 } |
| 423 | 423 |
| 424 | 424 |
| 425 static void test_tiny_path_convexity(skiatest::Reporter* reporter, const char* p
athBug, | 425 static void test_tiny_path_convexity(skiatest::Reporter* reporter, const char* p
athBug, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 path->quadTo(577198, 1972, 577238, 1971.31f); | 546 path->quadTo(577198, 1972, 577238, 1971.31f); |
| 547 path->quadTo(577277, 1970.62f, 577317, 1971.45f); | 547 path->quadTo(577277, 1970.62f, 577317, 1971.45f); |
| 548 path->quadTo(577330, 1971.72f, 577341, 1972.11f); | 548 path->quadTo(577330, 1971.72f, 577341, 1972.11f); |
| 549 path->cubicTo(10.7082f, -116.596f, 262.057f, 45.6468f, 294.694f, 1.96237
f); | 549 path->cubicTo(10.7082f, -116.596f, 262.057f, 45.6468f, 294.694f, 1.96237
f); |
| 550 path->moveTo(306.718f, -32.912f); | 550 path->moveTo(306.718f, -32.912f); |
| 551 path->cubicTo(30.531f, 10.0005f, 1502.47f, 13.2804f, 84.3088f, 9.99601f)
; | 551 path->cubicTo(30.531f, 10.0005f, 1502.47f, 13.2804f, 84.3088f, 9.99601f)
; |
| 552 } | 552 } |
| 553 } | 553 } |
| 554 | 554 |
| 555 static void test_clipped_cubic() { | 555 static void test_clipped_cubic() { |
| 556 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480)); | 556 auto surface(SkSurface::MakeRasterN32Premul(640, 480)); |
| 557 | 557 |
| 558 // This path used to assert, because our cubic-chopping code incorrectly | 558 // This path used to assert, because our cubic-chopping code incorrectly |
| 559 // moved control points after the chop. This test should be run in SK_DEBUG | 559 // moved control points after the chop. This test should be run in SK_DEBUG |
| 560 // mode to ensure that we no long assert. | 560 // mode to ensure that we no long assert. |
| 561 SkPath path; | 561 SkPath path; |
| 562 for (int doReducedCase = 0; doReducedCase <= 1; ++doReducedCase) { | 562 for (int doReducedCase = 0; doReducedCase <= 1; ++doReducedCase) { |
| 563 build_big_path(&path, SkToBool(doReducedCase)); | 563 build_big_path(&path, SkToBool(doReducedCase)); |
| 564 | 564 |
| 565 SkPaint paint; | 565 SkPaint paint; |
| 566 for (int doAA = 0; doAA <= 1; ++doAA) { | 566 for (int doAA = 0; doAA <= 1; ++doAA) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 { SkDoubleToScalar(18.5030727), SkDoubleToScalar(129.13121) }, | 619 { SkDoubleToScalar(18.5030727), SkDoubleToScalar(129.13121) }, |
| 620 }; | 620 }; |
| 621 | 621 |
| 622 SkPath path; | 622 SkPath path; |
| 623 path.moveTo(pts[0]); | 623 path.moveTo(pts[0]); |
| 624 path.cubicTo(pts[1], pts[2], pts[3]); | 624 path.cubicTo(pts[1], pts[2], pts[3]); |
| 625 | 625 |
| 626 SkPaint paint; | 626 SkPaint paint; |
| 627 paint.setAntiAlias(true); | 627 paint.setAntiAlias(true); |
| 628 | 628 |
| 629 SkSurface* surface = SkSurface::NewRasterN32Premul(19, 130); | 629 SkSurface::MakeRasterN32Premul(19, 130)->getCanvas()->drawPath(path, paint); |
| 630 surface->getCanvas()->drawPath(path, paint); | |
| 631 surface->unref(); | |
| 632 } | 630 } |
| 633 | 631 |
| 634 // Inspired by http://code.google.com/p/chromium/issues/detail?id=141651 | 632 // Inspired by http://code.google.com/p/chromium/issues/detail?id=141651 |
| 635 // | 633 // |
| 636 static void test_isfinite_after_transform(skiatest::Reporter* reporter) { | 634 static void test_isfinite_after_transform(skiatest::Reporter* reporter) { |
| 637 SkPath path; | 635 SkPath path; |
| 638 path.quadTo(157, 366, 286, 208); | 636 path.quadTo(157, 366, 286, 208); |
| 639 path.arcTo(37, 442, 315, 163, 957494590897113.0f); | 637 path.arcTo(37, 442, 315, 163, 957494590897113.0f); |
| 640 | 638 |
| 641 SkMatrix matrix; | 639 SkMatrix matrix; |
| (...skipping 3455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4097 PathTest_Private::TestPathTo(reporter); | 4095 PathTest_Private::TestPathTo(reporter); |
| 4098 PathRefTest_Private::TestPathRef(reporter); | 4096 PathRefTest_Private::TestPathRef(reporter); |
| 4099 PathTest_Private::TestPathrefListeners(reporter); | 4097 PathTest_Private::TestPathrefListeners(reporter); |
| 4100 test_dump(reporter); | 4098 test_dump(reporter); |
| 4101 test_path_crbug389050(reporter); | 4099 test_path_crbug389050(reporter); |
| 4102 test_path_crbugskia2820(reporter); | 4100 test_path_crbugskia2820(reporter); |
| 4103 test_skbug_3469(reporter); | 4101 test_skbug_3469(reporter); |
| 4104 test_skbug_3239(reporter); | 4102 test_skbug_3239(reporter); |
| 4105 test_bounds_crbug_513799(reporter); | 4103 test_bounds_crbug_513799(reporter); |
| 4106 } | 4104 } |
| OLD | NEW |