Relax SkStrokeRec::hasEqualEffect

Ignores the miter limit if the join type is not kMiter.

Bug: skia:10419
Change-Id: Ib05895cf90c7bb0e25e9e8c3e26c13fef32f2e97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317163
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
Chris Dalton 2020-09-15 13:13:42 -06:00 committed by Skia Commit-Bot
parent a195d101f9
commit 31bf3d9bb5
2 changed files with 2 additions and 2 deletions

View File

@ -127,7 +127,7 @@ public:
return this->getStyle() == other.getStyle();
}
return fWidth == other.fWidth &&
fMiterLimit == other.fMiterLimit &&
(fJoin != SkPaint::kMiter_Join || fMiterLimit == other.fMiterLimit) &&
fCap == other.fCap &&
fJoin == other.fJoin &&
fStrokeAndFill == other.fStrokeAndFill;

View File

@ -148,7 +148,7 @@ static void test_strokerec_equality(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, s1.hasEqualEffect(s2));
s2.setStrokeParams(SkPaint::kButt_Cap, SkPaint::kRound_Join, 2.1f);
REPORTER_ASSERT(reporter, !s1.hasEqualEffect(s2));
REPORTER_ASSERT(reporter, s1.hasEqualEffect(s2)); // Miter limit not relevant to butt caps.
s2.setStrokeParams(SkPaint::kButt_Cap, SkPaint::kBevel_Join, 2.9f);
REPORTER_ASSERT(reporter, !s1.hasEqualEffect(s2));
s2.setStrokeParams(SkPaint::kRound_Cap, SkPaint::kRound_Join, 2.9f);