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 static void make_path_crbugskia2820(SkPath* path, skiatest::Reporter* reporter) { | |
reed1
2014/08/20 14:47:11
Seems like a brief comment would help. e.g.
/* Th
Rémi Piotaix
2014/08/20 18:18:08
Done.
| |
68 float rdi = 1./4096.; | |
reed1
2014/08/20 14:47:10
All of these literals will generate double->float
Rémi Piotaix
2014/08/20 18:18:08
Done.
| |
69 | |
70 SkPoint orig, p1, p2, p3; | |
71 orig = SkPoint::Make(1., 1.); | |
72 p1 = SkPoint::Make(1.-rdi, 1.); | |
73 p2 = SkPoint::Make(1., 1.+rdi); | |
74 p3 = SkPoint::Make(2., 2.); | |
75 | |
76 REPORTER_ASSERT(reporter, SkPath::IsLineDegenerate(orig, p1)); | |
reed1
2014/08/20 14:47:10
I don't see why these checks should be in the test
Rémi Piotaix
2014/08/20 18:18:08
These are assertions on the data (orig+p1-3) used
| |
77 REPORTER_ASSERT(reporter, SkPath::IsLineDegenerate(orig, p2)); | |
78 REPORTER_ASSERT(reporter, !SkPath::IsLineDegenerate(p1, p2)); | |
79 REPORTER_ASSERT(reporter, !SkPath::IsLineDegenerate(p2, p3)); | |
80 | |
81 path->reset(); | |
82 path->moveTo(1, 1); | |
83 path->cubicTo(p1, p2, p3); | |
84 path->close(); | |
85 } | |
86 | |
87 static void test_path_crbugskia2820(skiatest::Reporter* reporter) {//GrContext* context) { | |
88 SkPath path; | |
89 make_path_crbugskia2820(&path, reporter); | |
90 | |
91 SkStrokeRec stroke(SkStrokeRec::kFill_InitStyle); | |
92 stroke.setStrokeStyle(2 * SK_Scalar1); | |
93 stroke.applyToPath(&path, path); | |
94 } | |
95 | |
67 static void make_path0(SkPath* path) { | 96 static void make_path0(SkPath* path) { |
68 // from * https://code.google.com/p/skia/issues/detail?id=1706 | 97 // from * https://code.google.com/p/skia/issues/detail?id=1706 |
69 | 98 |
70 path->moveTo(146.939f, 1012.84f); | 99 path->moveTo(146.939f, 1012.84f); |
71 path->lineTo(181.747f, 1009.18f); | 100 path->lineTo(181.747f, 1009.18f); |
72 path->lineTo(182.165f, 1013.16f); | 101 path->lineTo(182.165f, 1013.16f); |
73 path->lineTo(147.357f, 1016.82f); | 102 path->lineTo(147.357f, 1016.82f); |
74 path->lineTo(146.939f, 1012.84f); | 103 path->lineTo(146.939f, 1012.84f); |
75 path->close(); | 104 path->close(); |
76 } | 105 } |
(...skipping 3469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3546 test_addPathMode(reporter, true, true); | 3575 test_addPathMode(reporter, true, true); |
3547 test_extendClosedPath(reporter); | 3576 test_extendClosedPath(reporter); |
3548 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode); | 3577 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode); |
3549 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); | 3578 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); |
3550 test_conicTo_special_case(reporter); | 3579 test_conicTo_special_case(reporter); |
3551 test_get_point(reporter); | 3580 test_get_point(reporter); |
3552 test_contains(reporter); | 3581 test_contains(reporter); |
3553 PathTest_Private::TestPathTo(reporter); | 3582 PathTest_Private::TestPathTo(reporter); |
3554 PathRefTest_Private::TestPathRef(reporter); | 3583 PathRefTest_Private::TestPathRef(reporter); |
3555 test_dump(reporter); | 3584 test_dump(reporter); |
3585 test_path_crbugskia2820(reporter); | |
3556 } | 3586 } |
OLD | NEW |