aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrReducedClip.cpp
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-11-07 18:24:06 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-07 18:24:15 +0000
commit428e568fd8b0555688f8520c0b57291fbbbb3b69 (patch)
tree639ffe4f6597b00b6cbee0d93eaec672f49cce6e /src/gpu/GrReducedClip.cpp
parent777dc2ef81282883e05d71efb4f4a1b93eec29b0 (diff)
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>
Diffstat (limited to 'src/gpu/GrReducedClip.cpp')
-rw-r--r--src/gpu/GrReducedClip.cpp45
1 files changed, 41 insertions, 4 deletions
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index d37c83f11a..bc3286bdf0 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 @@ bool GrReducedClip::drawAlphaClipMask(GrRenderTargetContext* rtc) const {
////////////////////////////////////////////////////////////////////////////////
// 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();