diff options
author | Cary Clark <caryclark@google.com> | 2018-04-10 09:16:41 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-10 14:17:21 +0000 |
commit | 58627cb8eb559670b86f06225eb87e6c1c5e8504 (patch) | |
tree | eae6ea1a216052198638725f4573b0e26d8f6933 /src | |
parent | 5c715188470e97e4f573ffe78b7ee9451aaa7612 (diff) |
one more path is rect bug
Add a check to see that the close path generated line
is horizontal or vertical when determining that path
is a rect.
Also change several tests to defer their initialization
to reduce debugging interference.
R=brianosman@google.com,robertphillips@google.com
Bug: 824145,skia:7792
Change-Id: I4a081ee4ffd3558b499a7a1aede2d6232059715e
Reviewed-on: https://skia-review.googlesource.com/120081
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkPath.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp index 57192e8f9e..284a6a716c 100644 --- a/src/core/SkPath.cpp +++ b/src/core/SkPath.cpp @@ -539,7 +539,10 @@ addMissingClose: ; } // Success if 4 corners and first point equals last - bool result = 4 == corners && (first == last || autoClose); + SkScalar closeX = first.x() - last.x(); + SkScalar closeY = first.y() - last.y(); + // If autoClose, check if close generates diagonal + bool result = 4 == corners && (first == last || (autoClose && (!closeX || !closeY))); if (!result) { // check if we are just an incomplete rectangle, in which case we can // return true, but not claim to be closed. @@ -547,8 +550,6 @@ addMissingClose: // 3 sided rectangle // 4 sided but the last edge is not long enough to reach the start // - SkScalar closeX = first.x() - last.x(); - SkScalar closeY = first.y() - last.y(); if (closeX && closeY) { return false; // we're diagonal, abort (can we ever reach this?) } |