Use preservesAxisAlignment instead of scaleTranslate for clip simplification
This lets more matrix types pre-convert rects and rrects to device space.
Since the clip geometry isn't itself shaded, we can apply the matrix
without worrying about preserving local vs. device coordinates.
Bug: skia:10730
Change-Id: I61ae3e13eec66f0e5eb83a6504dcb8004620b151
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320222
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/GrClipStack.cpp b/src/gpu/GrClipStack.cpp
index 0072727..5eb97dc 100644
--- a/src/gpu/GrClipStack.cpp
+++ b/src/gpu/GrClipStack.cpp
@@ -125,7 +125,7 @@
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()) {
+ } else if (bToDevice.isIdentity() && aToDevice.preservesAxisAlignment()) {
// Optimize the common case of draws (B, with identity matrix) and axis-aligned shapes,
// instead of checking the four corners separately.
SkRect bInA = b;
@@ -543,7 +543,7 @@
// Except for axis-aligned clip rects, upgrade to AA when forced. We skip axis-aligned clip
// rects because a non-AA axis aligned rect can always be set as just a scissor test or window
// rect, avoiding an expensive stencil mask generation.
- if (forceAA && !(fShape.isRect() && fLocalToDevice.isScaleTranslate())) {
+ if (forceAA && !(fShape.isRect() && fLocalToDevice.preservesAxisAlignment())) {
fAA = GrAA::kYes;
}
@@ -551,7 +551,7 @@
// mapped bounds of the shape.
fOuterBounds = GrClip::GetPixelIBounds(outer, fAA, BoundsType::kExterior);
- if (fLocalToDevice.isScaleTranslate()) {
+ if (fLocalToDevice.preservesAxisAlignment()) {
if (fShape.isRect()) {
// The actual geometry can be updated to the device-intersected bounds and we can
// know the inner bounds