Don't use strokerect op with reduced shader mode.
Bug: skia:11844
Change-Id: I8a5fdd6b074ba070022b6da3e31d8642b2f35181
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420896
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrSurfaceDrawContext.cpp b/src/gpu/GrSurfaceDrawContext.cpp
index de18ac6..b3af050 100644
--- a/src/gpu/GrSurfaceDrawContext.cpp
+++ b/src/gpu/GrSurfaceDrawContext.cpp
@@ -725,7 +725,9 @@
return;
} else if ((stroke.getStyle() == SkStrokeRec::kStroke_Style ||
stroke.getStyle() == SkStrokeRec::kHairline_Style) &&
- (rect.width() && rect.height())) {
+ rect.width() &&
+ rect.height() &&
+ !this->caps()->reducedShaderMode()) {
// Only use the StrokeRectOp for non-empty rectangles. Empty rectangles will be processed by
// GrStyledShape to handle stroke caps and dashing properly.
GrAAType aaType = (fCanUseDynamicMSAA) ? GrAAType::kCoverage : this->chooseAAType(aa);
@@ -1709,8 +1711,10 @@
}
this->drawRRect(clip, std::move(*paint), aa, viewMatrix, rrect, shape.style());
return true;
- } else if (GrAAType::kCoverage == aaType && shape.style().isSimpleFill() &&
- viewMatrix.rectStaysRect()) {
+ } else if (GrAAType::kCoverage == aaType &&
+ shape.style().isSimpleFill() &&
+ viewMatrix.rectStaysRect() &&
+ !this->caps()->reducedShaderMode()) {
// TODO: the rectStaysRect restriction could be lifted if we were willing to apply the
// matrix to all the points individually rather than just to the rect
SkRect rects[2];
diff --git a/src/gpu/ops/GrStrokeRectOp.cpp b/src/gpu/ops/GrStrokeRectOp.cpp
index b120195..174fa4a 100644
--- a/src/gpu/ops/GrStrokeRectOp.cpp
+++ b/src/gpu/ops/GrStrokeRectOp.cpp
@@ -833,6 +833,7 @@
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkStrokeRec& stroke) {
+ SkASSERT(!context->priv().caps()->reducedShaderMode());
if (aaType == GrAAType::kCoverage) {
// The AA op only supports axis-aligned rectangles
if (!viewMatrix.rectStaysRect()) {