Revert "Don't use analytic clip FPs when drawing to stencil"
This reverts commit 4c92d4aa3ed653afdff9996b90a1139ed1dc9420.
Reason for revert: Chromecast bot failure
Original change's description:
> Don't use analytic clip FPs when drawing to stencil
>
> It doesn't make sense to multiply by coverage when drawing to stencil.
> This could theoretically work with FPs that discard and/or modify
> the sample mask, but for the time being an analytic FP means one that
> calculates a coverage value.
>
> Bug: skia:7190
> Change-Id: Ic40cf6c19c377cba80bad458993582f5cc07022a
> Reviewed-on: https://skia-review.googlesource.com/67423
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
TBR=bsalomon@google.com,robertphillips@google.com,csmartdalton@google.com
Change-Id: Ie5bd4852c201e47daee0920f5644141bee2d8a46
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7190
Reviewed-on: https://skia-review.googlesource.com/68400
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index d37c83f..bc3286b 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -17,7 +17,6 @@
#include "GrFixedClip.h"
#include "GrPathRenderer.h"
#include "GrStencilSettings.h"
-#include "GrStencilClip.h"
#include "GrStyle.h"
#include "GrUserStencilSettings.h"
#include "SkClipOpPriv.h"
@@ -696,14 +695,52 @@
////////////////////////////////////////////////////////////////////////////////
// Create a 1-bit clip mask in the stencil buffer.
+class StencilClip final : public GrClip {
+public:
+ StencilClip(const SkIRect& scissorRect, uint32_t clipStackID)
+ : fFixedClip(scissorRect)
+ , fClipStackID(clipStackID) {
+ }
+
+ const GrFixedClip& fixedClip() const { return fFixedClip; }
+
+ void setWindowRectangles(const GrWindowRectangles& windows, GrWindowRectsState::Mode mode) {
+ fFixedClip.setWindowRectangles(windows, mode);
+ }
+
+private:
+ bool quickContains(const SkRect&) const override {
+ return false;
+ }
+ void getConservativeBounds(int width, int height, SkIRect* bounds, bool* iior) const override {
+ fFixedClip.getConservativeBounds(width, height, bounds, iior);
+ }
+ bool isRRect(const SkRect& rtBounds, SkRRect* rr, GrAA*) const override {
+ return false;
+ }
+ bool apply(GrContext* context, GrRenderTargetContext* renderTargetContext, bool useHWAA,
+ bool hasUserStencilSettings, GrAppliedClip* out, SkRect* bounds) const override {
+ if (!fFixedClip.apply(context, renderTargetContext, useHWAA, hasUserStencilSettings, out,
+ bounds)) {
+ return false;
+ }
+ out->addStencilClip(fClipStackID);
+ return true;
+ }
+
+ GrFixedClip fFixedClip;
+ uint32_t fClipStackID;
+
+ typedef GrClip INHERITED;
+};
+
bool GrReducedClip::drawStencilClipMask(GrContext* context,
GrRenderTargetContext* renderTargetContext) const {
// We set the current clip to the bounds so that our recursive draws are scissored to them.
- GrStencilClip stencilClip(fScissor, this->maskGenID());
+ StencilClip stencilClip(fScissor, this->maskGenID());
if (!fWindowRects.empty()) {
- stencilClip.fixedClip().setWindowRectangles(fWindowRects,
- GrWindowRectsState::Mode::kExclusive);
+ stencilClip.setWindowRectangles(fWindowRects, GrWindowRectsState::Mode::kExclusive);
}
bool initialState = InitialState::kAllIn == this->initialState();