Don't do clear or round rect optimizations when a rect has stencil
Change-Id: Ib506c0cc3c46d1bf514b35a8ba78d31d3e84f22c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268666
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 665de5e..001f041 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -685,7 +685,8 @@
if (clipRRect.isRect()) {
// No rounded corners, so the kClear and kExplicitClip optimizations are possible
if (GrQuadUtils::CropToRect(clipBounds, clipAA, &newFlags, deviceQuad, localQuad)) {
- if (constColor && deviceQuad->quadType() == GrQuad::Type::kAxisAligned) {
+ if (!stencilSettings && constColor &&
+ deviceQuad->quadType() == GrQuad::Type::kAxisAligned) {
// Clear optimization is possible
drawBounds = deviceQuad->bounds();
if (drawBounds.contains(rtRect)) {
@@ -722,7 +723,7 @@
// the clip entirely
return QuadOptimization::kCropped;
}
- } else if (constColor) {
+ } else if (!stencilSettings && constColor) {
// Rounded corners and constant filled color (limit ourselves to solid colors because
// there is no way to use custom local coordinates with drawRRect).
if (GrQuadUtils::CropToRect(clipBounds, clipAA, &newFlags, deviceQuad, localQuad) &&