diff options
author | Chris Dalton <csmartdalton@google.com> | 2017-11-07 13:35:22 -0700 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-07 21:30:44 +0000 |
commit | bbfd5161ed08710de6106101e64e3417ab32d2db (patch) | |
tree | 387cb49ad153fce7e685f2dbad13ffbb7b1238d9 /gm/windowrectangles.cpp | |
parent | cbba29ed4764b9a9da58710aed18aec6f3bd0ce0 (diff) |
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: I44140a5823f8683ec08244bdf9d369f51fa05dd9
Reviewed-on: https://skia-review.googlesource.com/68362
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'gm/windowrectangles.cpp')
-rw-r--r-- | gm/windowrectangles.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp index b4f6562985..6a3f2a1eb0 100644 --- a/gm/windowrectangles.cpp +++ b/gm/windowrectangles.cpp @@ -12,7 +12,7 @@ #if SK_SUPPORT_GPU # include "GrAppliedClip.h" -# include "GrFixedClip.h" +# include "GrStencilClip.h" # include "GrReducedClip.h" # include "GrRenderTargetContext.h" # include "GrRenderTargetContextPriv.h" @@ -166,15 +166,10 @@ private: }; /** - * This class clips a cover by the stencil clip bit. We use it to visualize the stencil mask. + * Makes a clip object that enforces the stencil clip bit. Used to visualize the stencil mask. */ -class StencilOnlyClip final : public MaskOnlyClipBase { -private: - bool apply(GrContext*, GrRenderTargetContext*, bool, bool, GrAppliedClip* out, - SkRect* bounds) const override { - out->addStencilClip(SkClipStack::kEmptyGenID); - return true; - } +static GrStencilClip make_stencil_only_clip() { + return GrStencilClip(SkClipStack::kEmptyGenID); }; void WindowRectanglesMaskGM::onCoverClipStack(const SkClipStack& stack, SkCanvas* canvas) { @@ -215,7 +210,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(StencilOnlyClip(), &GrUserStencilSettings::kUnused, + maskRTC->priv().drawAndStencilRect(make_stencil_only_clip(), &GrUserStencilSettings::kUnused, SkRegion::kDifference_Op, false, GrAA::kNo, SkMatrix::I(), SkRect::MakeIWH(maskRTC->width(), maskRTC->height())); reducedClip.drawAlphaClipMask(maskRTC.get()); @@ -242,7 +237,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(StencilOnlyClip(), std::move(paint), SkMatrix::I()); + rtc->drawPaint(make_stencil_only_clip(), std::move(paint), SkMatrix::I()); } void WindowRectanglesMaskGM::stencilCheckerboard(GrRenderTargetContext* rtc, bool flip) { |