aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPath.cpp
diff options
context:
space:
mode:
authorGravatar schenney@chromium.org <schenney@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-13 17:05:43 +0000
committerGravatar schenney@chromium.org <schenney@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-13 17:05:43 +0000
commit7e963605d5b8177c30afa0d8e5541b0fbe1b6e13 (patch)
treeb7fcc8a2cb6f39017a10a2e28d267ea1bc527405 /src/core/SkPath.cpp
parent761b37c0eb9ec84508cd36e20b81441cd09b4d8d (diff)
Fix the problem of rendering closePath not properly after a moveTo call in
canvas 2D interface. If there is a polyline, followed by a moveTo and a closePath, both the moveTo and the closePath should be ignored for the purposes of drawing, and the polyline should not be closed (unless force closed is true (for filling, for instance). Tested for path with both valid and degenerate content, when asked to consume degenerates and not, force closed and not. This patch also includes a uni test refactoring to reduce the amount of code to test path iteration and zero length paths. BUG=6297049 TEST=tests/PathTest.cpp, testIter method. Review URL: https://codereview.appspot.com/6300086 git-svn-id: http://skia.googlecode.com/svn/trunk@4247 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPath.cpp')
-rw-r--r--src/core/SkPath.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 7688f10f48..e2382df497 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1485,8 +1485,9 @@ void SkPath::Iter::consumeDegenerateSegments() {
break;
case kClose_Verb:
- // A close when we are in a segment is always valid
- if (fSegmentState == kAfterPrimitive_SegmentState) {
+ // A close when we are in a segment is always valid except when it
+ // follows a move which follows a segment.
+ if (fSegmentState == kAfterPrimitive_SegmentState && !lastMoveVerb) {
return;
}
// A close at any other time must be ignored