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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(84, 88)); | 57 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(84, 88)); |
58 SkCanvas* canvas = surface->getCanvas(); | 58 SkCanvas* canvas = surface->getCanvas(); |
59 | 59 |
60 make_path_crbug364224_simplified(&path); | 60 make_path_crbug364224_simplified(&path); |
61 canvas->drawPath(path, paint); | 61 canvas->drawPath(path, paint); |
62 | 62 |
63 make_path_crbug364224(&path); | 63 make_path_crbug364224(&path); |
64 canvas->drawPath(path, paint); | 64 canvas->drawPath(path, paint); |
65 } | 65 } |
66 | 66 |
67 /** | |
68 * In debug mode, this path is causing an assertion to fail in | |
69 * SkPathStroker::preJoinTo() and, in Release, the use of an unitialized value. | |
70 */ | |
71 static void make_path_crbugskia2820(SkPath* path, skiatest::Reporter* reporter) { | |
72 SkPoint orig, p1, p2, p3; | |
73 orig = SkPoint::Make(SkIntToScalar(1), SkIntToScalar(1)); | |
reed1
2014/08/20 19:07:18
:)
I find this very hard to read. Looking right b
Rémi Piotaix
2014/08/20 19:21:08
Done.
| |
74 p1 = SkPoint::Make(SkIntToScalar(1)-SK_ScalarNearlyZero, SkIntToScalar(1)); | |
75 p2 = SkPoint::Make(SkIntToScalar(1), SkIntToScalar(1)+SK_ScalarNearlyZero); | |
76 p3 = SkPoint::Make(SkIntToScalar(2), SkIntToScalar(2)); | |
77 | |
78 REPORTER_ASSERT(reporter, SkPath::IsLineDegenerate(orig, p1)); | |
reed1
2014/08/20 19:07:18
These lines are testing some aspect of IsLineDegen
Rémi Piotaix
2014/08/20 19:21:09
Done.
| |
79 REPORTER_ASSERT(reporter, SkPath::IsLineDegenerate(orig, p2)); | |
80 REPORTER_ASSERT(reporter, !SkPath::IsLineDegenerate(p1, p2)); | |
81 REPORTER_ASSERT(reporter, !SkPath::IsLineDegenerate(p2, p3)); | |
82 | |
83 path->reset(); | |
84 path->moveTo(SkIntToScalar(1), SkIntToScalar(1)); | |
85 path->cubicTo(p1, p2, p3); | |
86 path->close(); | |
87 } | |
88 | |
89 static void test_path_crbugskia2820(skiatest::Reporter* reporter) {//GrContext* context) { | |
90 SkPath path; | |
91 make_path_crbugskia2820(&path, reporter); | |
92 | |
93 SkStrokeRec stroke(SkStrokeRec::kFill_InitStyle); | |
94 stroke.setStrokeStyle(2 * SK_Scalar1); | |
95 stroke.applyToPath(&path, path); | |
96 } | |
97 | |
67 static void make_path0(SkPath* path) { | 98 static void make_path0(SkPath* path) { |
68 // from * https://code.google.com/p/skia/issues/detail?id=1706 | 99 // from * https://code.google.com/p/skia/issues/detail?id=1706 |
69 | 100 |
70 path->moveTo(146.939f, 1012.84f); | 101 path->moveTo(146.939f, 1012.84f); |
71 path->lineTo(181.747f, 1009.18f); | 102 path->lineTo(181.747f, 1009.18f); |
72 path->lineTo(182.165f, 1013.16f); | 103 path->lineTo(182.165f, 1013.16f); |
73 path->lineTo(147.357f, 1016.82f); | 104 path->lineTo(147.357f, 1016.82f); |
74 path->lineTo(146.939f, 1012.84f); | 105 path->lineTo(146.939f, 1012.84f); |
75 path->close(); | 106 path->close(); |
76 } | 107 } |
(...skipping 3469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3546 test_addPathMode(reporter, true, true); | 3577 test_addPathMode(reporter, true, true); |
3547 test_extendClosedPath(reporter); | 3578 test_extendClosedPath(reporter); |
3548 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode); | 3579 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode); |
3549 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); | 3580 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); |
3550 test_conicTo_special_case(reporter); | 3581 test_conicTo_special_case(reporter); |
3551 test_get_point(reporter); | 3582 test_get_point(reporter); |
3552 test_contains(reporter); | 3583 test_contains(reporter); |
3553 PathTest_Private::TestPathTo(reporter); | 3584 PathTest_Private::TestPathTo(reporter); |
3554 PathRefTest_Private::TestPathRef(reporter); | 3585 PathRefTest_Private::TestPathRef(reporter); |
3555 test_dump(reporter); | 3586 test_dump(reporter); |
3587 test_path_crbugskia2820(reporter); | |
3556 } | 3588 } |
OLD | NEW |