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 "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "SkParse.h" | 10 #include "SkParse.h" |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
561 build_big_path(&path, SkToBool(doReducedCase)); | 561 build_big_path(&path, SkToBool(doReducedCase)); |
562 | 562 |
563 SkPaint paint; | 563 SkPaint paint; |
564 for (int doAA = 0; doAA <= 1; ++doAA) { | 564 for (int doAA = 0; doAA <= 1; ++doAA) { |
565 paint.setAntiAlias(SkToBool(doAA)); | 565 paint.setAntiAlias(SkToBool(doAA)); |
566 surface->getCanvas()->drawPath(path, paint); | 566 surface->getCanvas()->drawPath(path, paint); |
567 } | 567 } |
568 } | 568 } |
569 } | 569 } |
570 | 570 |
571 static void dump_if_ne(skiatest::Reporter* reporter, const SkRect& expected, con st SkRect& bounds) { | |
572 if (expected != bounds) { | |
573 ERRORF(reporter, "path.getBounds() returned [%g %g %g %g], but expected [%g %g %g %g]", | |
574 bounds.left(), bounds.top(), bounds.right(), bounds.bottom(), | |
575 expected.left(), expected.top(), expected.right(), expected.botto m()); | |
576 } | |
577 } | |
578 | |
571 static void test_bounds_crbug_513799(skiatest::Reporter* reporter) { | 579 static void test_bounds_crbug_513799(skiatest::Reporter* reporter) { |
572 SkPath path; | 580 SkPath path; |
573 | 581 #if 0 |
582 // As written these tests were failing on LLVM 4.2 MacMini Release mysteriou sly, so we've | |
mtklein
2015/07/29 15:34:14
I don't think this is an llvm-gcc-4.2 bot. We hav
| |
583 // rewritten them to avoid this (compiler-bug?). | |
574 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(0, 0, 0, 0) == path.getBounds()); | 584 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(0, 0, 0, 0) == path.getBounds()); |
575 | 585 |
576 path.moveTo(-5, -8); | 586 path.moveTo(-5, -8); |
577 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(-5, -8, -5, -8) == path.getBounds ()); | 587 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(-5, -8, -5, -8) == path.getBounds ()); |
578 | 588 |
579 path.addRect(SkRect::MakeLTRB(1, 2, 3, 4)); | 589 path.addRect(SkRect::MakeLTRB(1, 2, 3, 4)); |
580 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(-5, -8, 3, 4) == path.getBounds() ); | 590 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(-5, -8, 3, 4) == path.getBounds() ); |
581 | 591 |
582 path.moveTo(1, 2); | 592 path.moveTo(1, 2); |
583 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(-5, -8, 3, 4) == path.getBounds() ); | 593 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(-5, -8, 3, 4) == path.getBounds() ); |
594 #else | |
595 dump_if_ne(reporter, SkRect::MakeLTRB(0, 0, 0, 0), path.getBounds()); | |
596 | |
597 path.moveTo(-5, -8); // should set the bounds | |
598 dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, -5, -8), path.getBounds()); | |
599 | |
600 path.addRect(SkRect::MakeLTRB(1, 2, 3, 4)); // should extend the bounds | |
601 dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, 3, 4), path.getBounds()); | |
602 | |
603 path.moveTo(1, 2); // don't expect this to have changed the bounds | |
604 dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, 3, 4), path.getBounds()); | |
605 #endif | |
584 } | 606 } |
585 | 607 |
586 // Inspired by http://ie.microsoft.com/testdrive/Performance/Chalkboard/ | 608 // Inspired by http://ie.microsoft.com/testdrive/Performance/Chalkboard/ |
587 // which triggered an assert, from a tricky cubic. This test replicates that | 609 // which triggered an assert, from a tricky cubic. This test replicates that |
588 // example, so we can ensure that we handle it (in SkEdge.cpp), and don't | 610 // example, so we can ensure that we handle it (in SkEdge.cpp), and don't |
589 // assert in the SK_DEBUG build. | 611 // assert in the SK_DEBUG build. |
590 static void test_tricky_cubic() { | 612 static void test_tricky_cubic() { |
591 const SkPoint pts[] = { | 613 const SkPoint pts[] = { |
592 { SkDoubleToScalar(18.8943768), SkDoubleToScalar(129.121277) }, | 614 { SkDoubleToScalar(18.8943768), SkDoubleToScalar(129.121277) }, |
593 { SkDoubleToScalar(18.8937435), SkDoubleToScalar(129.121689) }, | 615 { SkDoubleToScalar(18.8937435), SkDoubleToScalar(129.121689) }, |
(...skipping 3264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3858 test_contains(reporter); | 3880 test_contains(reporter); |
3859 PathTest_Private::TestPathTo(reporter); | 3881 PathTest_Private::TestPathTo(reporter); |
3860 PathRefTest_Private::TestPathRef(reporter); | 3882 PathRefTest_Private::TestPathRef(reporter); |
3861 test_dump(reporter); | 3883 test_dump(reporter); |
3862 test_path_crbug389050(reporter); | 3884 test_path_crbug389050(reporter); |
3863 test_path_crbugskia2820(reporter); | 3885 test_path_crbugskia2820(reporter); |
3864 test_skbug_3469(reporter); | 3886 test_skbug_3469(reporter); |
3865 test_skbug_3239(reporter); | 3887 test_skbug_3239(reporter); |
3866 test_bounds_crbug_513799(reporter); | 3888 test_bounds_crbug_513799(reporter); |
3867 } | 3889 } |
OLD | NEW |