GrClipStack::contains, add fast path for axis-aligned paths
This seems to address the performance regressions seen in the new GrClipStack for the Missouri seal svg. An alternative was to just always transform paths to device space, but this hurt other benchmarks. This CL leaves us with a more efficient contains and but still keeps the lazy transformation to device space. Bug: skia:10730 Change-Id: I4494cd24efbce767b2cc981d8942aafe8328dfb8 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317858 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
parent
a9be76de8b
commit
84a008fa55
@ -125,6 +125,15 @@ static bool shape_contains_rect(
|
||||
if (!mixedAAMode && aToDevice == bToDevice) {
|
||||
// A and B are in the same coordinate space, so don't bother mapping
|
||||
return a.conservativeContains(b);
|
||||
} else if (bToDevice.isIdentity() && aToDevice.isScaleTranslate()) {
|
||||
// Optimize the common case of draws (B, with identity matrix) and axis-aligned shapes,
|
||||
// instead of checking the four corners separately.
|
||||
SkRect bInA = b;
|
||||
if (mixedAAMode) {
|
||||
bInA.outset(0.5f, 0.5f);
|
||||
}
|
||||
SkAssertResult(deviceToA.mapRect(&bInA));
|
||||
return a.conservativeContains(bInA);
|
||||
}
|
||||
|
||||
// Test each corner for contains; since a is convex, if all 4 corners of b's bounds are
|
||||
|
Loading…
Reference in New Issue
Block a user