From 428e568fd8b0555688f8520c0b57291fbbbb3b69 Mon Sep 17 00:00:00 2001 From: Chris Dalton Date: Tue, 7 Nov 2017 18:24:06 +0000 Subject: 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 > Commit-Queue: Chris Dalton 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 Commit-Queue: Chris Dalton --- gm/windowrectangles.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'gm/windowrectangles.cpp') diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp index 6a3f2a1eb0..b4f6562985 100644 --- a/gm/windowrectangles.cpp +++ b/gm/windowrectangles.cpp @@ -12,7 +12,7 @@ #if SK_SUPPORT_GPU # include "GrAppliedClip.h" -# include "GrStencilClip.h" +# include "GrFixedClip.h" # include "GrReducedClip.h" # include "GrRenderTargetContext.h" # include "GrRenderTargetContextPriv.h" @@ -166,10 +166,15 @@ private: }; /** - * Makes a clip object that enforces the stencil clip bit. Used to visualize the stencil mask. + * This class clips a cover by the stencil clip bit. We use it to visualize the stencil mask. */ -static GrStencilClip make_stencil_only_clip() { - return GrStencilClip(SkClipStack::kEmptyGenID); +class StencilOnlyClip final : public MaskOnlyClipBase { +private: + bool apply(GrContext*, GrRenderTargetContext*, bool, bool, GrAppliedClip* out, + SkRect* bounds) const override { + out->addStencilClip(SkClipStack::kEmptyGenID); + return true; + } }; void WindowRectanglesMaskGM::onCoverClipStack(const SkClipStack& stack, SkCanvas* canvas) { @@ -210,7 +215,7 @@ void WindowRectanglesMaskGM::visualizeAlphaMask(GrContext* ctx, GrRenderTargetCo // the clip mask generation. this->stencilCheckerboard(maskRTC.get(), true); maskRTC->clear(nullptr, GrColorPackA4(0xff), true); - maskRTC->priv().drawAndStencilRect(make_stencil_only_clip(), &GrUserStencilSettings::kUnused, + maskRTC->priv().drawAndStencilRect(StencilOnlyClip(), &GrUserStencilSettings::kUnused, SkRegion::kDifference_Op, false, GrAA::kNo, SkMatrix::I(), SkRect::MakeIWH(maskRTC->width(), maskRTC->height())); reducedClip.drawAlphaClipMask(maskRTC.get()); @@ -237,7 +242,7 @@ void WindowRectanglesMaskGM::visualizeStencilMask(GrContext* ctx, GrRenderTarget // Now visualize the stencil mask by covering the entire render target. The regions inside // window rectangles or outside the scissor should still have the initial checkerboard intact. // (This verifies we didn't spend any time modifying those pixels in the mask.) - rtc->drawPaint(make_stencil_only_clip(), std::move(paint), SkMatrix::I()); + rtc->drawPaint(StencilOnlyClip(), std::move(paint), SkMatrix::I()); } void WindowRectanglesMaskGM::stencilCheckerboard(GrRenderTargetContext* rtc, bool flip) { -- cgit v1.2.3