aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPath.cpp
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2018-04-18 12:25:08 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-18 17:46:03 +0000
commitb120e9291a7d43347ebce89de522a15771cd9dea (patch)
tree77a2153ecda21fadfba3f13d90a888e44a43d587 /src/core/SkPath.cpp
parent1ccaa6e056296db61eb1af2668a23995fe98e6b3 (diff)
fix path is rect flaw exposed by gold
One of the path is rect bug fixes changed the behavior of zero-length strokes which showed up as a change in Gold. The bug is if a rect is defined by a series of colinear movetos, the bounds did not work out if the rect started and stopped in the middle of a side. R=robertphillips@google.com Bug: 824145,skia:7792 Change-Id: I226545efeda03dedd928eebc120d2508b428fef0 Reviewed-on: https://skia-review.googlesource.com/122002 Auto-Submit: Cary Clark <caryclark@skia.org> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'src/core/SkPath.cpp')
-rw-r--r--src/core/SkPath.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 7110a3086a..0bfeae1d91 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -506,6 +506,9 @@ bool SkPath::isRectContour(bool allowPartial, int* currVerb, const SkPoint** pts
closedOrMoved = autoClose;
lineStart = lineEnd;
if (directions[corners - 1] == nextDirection) {
+ if (3 == corners && kLine_Verb == verb) {
+ lastCountedPt = lastPt;
+ }
break; // colinear segment
}
if (corners >= 4) {
@@ -513,12 +516,12 @@ bool SkPath::isRectContour(bool allowPartial, int* currVerb, const SkPoint** pts
}
directions[corners++] = nextDirection;
// opposite lines must point in opposite directions; xoring them should equal 2
- if (corners == 3) {
+ if (3 == corners) {
if ((directions[0] ^ directions[2]) != 2) {
return false;
}
accumulatingRect = false;
- } else if (corners == 4) {
+ } else if (4 == corners) {
if ((directions[1] ^ directions[3]) != 2) {
return false;
}
@@ -575,7 +578,7 @@ addMissingClose:
//
int closeDirection = rect_make_dir(closeXY.fX, closeXY.fY);
// make sure the close-segment doesn't double-back on itself
- if (3 == corners || (closeDirection ^ directions[1]) == 2) {
+ if (3 == corners || 2 == (closeDirection ^ directions[1])) {
result = true;
autoClose = false; // we are not closed
}