Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: tests/PathTest.cpp

Issue 546823002: Fallback to moveTo when unable to find the first tangent in cubicTo (Closed) Base URL: https://skia.googlesource.com/skia.git@m38_2125
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkStroke.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 was 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(1.f, 1.f);
74 p1 = SkPoint::Make(1.f - SK_ScalarNearlyZero, 1.f);
75 p2 = SkPoint::Make(1.f, 1.f + SK_ScalarNearlyZero);
76 p3 = SkPoint::Make(2.f, 2.f);
77
78 path->reset();
79 path->moveTo(orig);
80 path->cubicTo(p1, p2, p3);
81 path->close();
82 }
83
84 static void test_path_crbugskia2820(skiatest::Reporter* reporter) {//GrContext* context) {
85 SkPath path;
86 make_path_crbugskia2820(&path, reporter);
87
88 SkStrokeRec stroke(SkStrokeRec::kFill_InitStyle);
89 stroke.setStrokeStyle(2 * SK_Scalar1);
90 stroke.applyToPath(&path, path);
91 }
92
67 static void make_path0(SkPath* path) { 93 static void make_path0(SkPath* path) {
68 // from * https://code.google.com/p/skia/issues/detail?id=1706 94 // from * https://code.google.com/p/skia/issues/detail?id=1706
69 95
70 path->moveTo(146.939f, 1012.84f); 96 path->moveTo(146.939f, 1012.84f);
71 path->lineTo(181.747f, 1009.18f); 97 path->lineTo(181.747f, 1009.18f);
72 path->lineTo(182.165f, 1013.16f); 98 path->lineTo(182.165f, 1013.16f);
73 path->lineTo(147.357f, 1016.82f); 99 path->lineTo(147.357f, 1016.82f);
74 path->lineTo(146.939f, 1012.84f); 100 path->lineTo(146.939f, 1012.84f);
75 path->close(); 101 path->close();
76 } 102 }
(...skipping 3469 matching lines...) Expand 10 before | Expand all | Expand 10 after
3546 test_addPathMode(reporter, true, true); 3572 test_addPathMode(reporter, true, true);
3547 test_extendClosedPath(reporter); 3573 test_extendClosedPath(reporter);
3548 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode); 3574 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode);
3549 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); 3575 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode);
3550 test_conicTo_special_case(reporter); 3576 test_conicTo_special_case(reporter);
3551 test_get_point(reporter); 3577 test_get_point(reporter);
3552 test_contains(reporter); 3578 test_contains(reporter);
3553 PathTest_Private::TestPathTo(reporter); 3579 PathTest_Private::TestPathTo(reporter);
3554 PathRefTest_Private::TestPathRef(reporter); 3580 PathRefTest_Private::TestPathRef(reporter);
3555 test_dump(reporter); 3581 test_dump(reporter);
3582 test_path_crbugskia2820(reporter);
3556 } 3583 }
OLDNEW
« no previous file with comments | « src/core/SkStroke.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698