path is rect diag test is required
Removed a test that appeared to go uncalled; Ivan to the rescue, with a test case proving that it is required. R=robertphillips@google.com Bug: 824145,skia:7792 Change-Id: I7df9688072bd36b7597673148e3fe5dbbf82f5a7 Reviewed-on: https://skia-review.googlesource.com/121883 Commit-Queue: Cary Clark <caryclark@skia.org> Commit-Queue: Robert Phillips <robertphillips@google.com> Auto-Submit: Cary Clark <caryclark@skia.org> Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
21fa33f179
commit
4eb6f7a698
@ -433,7 +433,7 @@ DEF_SIMPLE_GM(rotatedcubicpath, canvas, 200, 200) {
|
||||
DEF_GM( return new PathFillGM; )
|
||||
DEF_GM( return new PathInverseFillGM; )
|
||||
|
||||
DEF_SIMPLE_GM(bug7792, canvas, 600, 800) {
|
||||
DEF_SIMPLE_GM(bug7792, canvas, 800, 800) {
|
||||
// from skbug.com/7792 bug description
|
||||
SkPaint p;
|
||||
SkPath path;
|
||||
@ -568,4 +568,12 @@ DEF_SIMPLE_GM(bug7792, canvas, 600, 800) {
|
||||
path.moveTo(75, 75);
|
||||
path.lineTo(75, 75);
|
||||
canvas->drawPath(path, p);
|
||||
// from skbug.com/7792#c39
|
||||
canvas->translate(200, -200 * 3);
|
||||
path.reset();
|
||||
path.moveTo(150, 75);
|
||||
path.lineTo(150, 150);
|
||||
path.lineTo(75, 150);
|
||||
path.lineTo(75, 100);
|
||||
canvas->drawPath(path, p);
|
||||
}
|
||||
|
@ -564,6 +564,9 @@ addMissingClose:
|
||||
// If autoClose, check if close generates diagonal
|
||||
bool result = 4 == corners && (closeXY.isZero() || (autoClose && (!closeXY.fX || !closeXY.fY)));
|
||||
if (!result) {
|
||||
if (closeXY.fX && closeXY.fY) {
|
||||
return false; // we're diagonal, abort
|
||||
}
|
||||
// check if we are just an incomplete rectangle, in which case we can
|
||||
// return true, but not claim to be closed.
|
||||
// e.g.
|
||||
|
@ -5018,4 +5018,10 @@ DEF_TEST(Path_isRect, reporter) {
|
||||
SkPoint points36[] = { {75, 75}, {150, 75}, {150, 150}, {10, 150}, {75, 75}, {75, 75} };
|
||||
path = makePath2(points36, verbs36, SK_ARRAY_COUNT(verbs36));
|
||||
REPORTER_ASSERT(reporter, !path.isRect(&rect, nullptr, nullptr));
|
||||
// isolated from skbug.com/7792#c39
|
||||
SkPath::Verb verbs39[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
|
||||
SkPath::kLine_Verb };
|
||||
SkPoint points39[] = { {150, 75}, {150, 150}, {75, 150}, {75, 100} };
|
||||
path = makePath2(points39, verbs39, SK_ARRAY_COUNT(verbs39));
|
||||
REPORTER_ASSERT(reporter, !path.isRect(&rect, nullptr, nullptr));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user