Undo drawRRect+clipRRect merging outside of Android framework
See linked bugs, but there were mixed results on whether this was a
performance win. My guess is that for simple, easy-to-analyze clips
that satisfied a round rect clipped to itself it was a win, but when
the clip stack was large or not actually a round rect, it slowed down
the analysis.
This undoes that optimization that was turned on as part of
https://skia.googlesource.com/skia/+show/4e3cab7919258df8d6fd884298e28b20e4288060
to see if that's the cause.
Bug: skia:10462
Bug: chromium:1101513
Change-Id: I11e75a7a643337850766ed51956608b76a4a0501
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305681
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index e68bbb1..1c835e8 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -1101,6 +1101,11 @@
// clip can be ignored. The following test attempts to mitigate the stencil clip cost but only
// works for axis-aligned round rects. This also only works for filled rrects since the stroke
// width outsets beyond the rrect itself.
+ // TODO: skbug.com/10462 - There was mixed performance wins and regressions when this
+ // optimization was turned on outside of Android Framework. I (michaelludwig) believe this is
+ // do to the overhead in determining if an SkClipStack is just a rrect. Once that is improved,
+ // re-enable this and see if we avoid the regressions.
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
SkRRect devRRect;
if (clip && stroke.getStyle() == SkStrokeRec::kFill_Style &&
rrect.transform(viewMatrix, &devRRect)) {
@@ -1118,11 +1123,7 @@
if (result.fIsRRect && result.fRRect == devRRect) {
// NOTE: On the android framework, we allow this optimization even when the clip
// is non-AA and the draw is AA.
-#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
if (result.fAA == aa || (result.fAA == GrAA::kNo && aa == GrAA::kYes)) {
-#else
- if (result.fAA == aa) {
-#endif
clip = nullptr;
}
}
@@ -1131,6 +1132,7 @@
SkUNREACHABLE;
}
}
+#endif
AutoCheckFlush acf(this->drawingManager());