aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar cdalton <cdalton@nvidia.com>2016-05-13 10:25:00 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-13 10:25:00 -0700
commit846c051a4800b3cea341a0195db24297d6d9047f (patch)
tree7dadb5396d2dad36a45686c9c10ada5bc2e76f01 /src/gpu
parent670f01f2fc88f02ec9a6f1b47af29daeadc3b301 (diff)
Convert GrClip to an abstract base class
Converts GrClip to an abstract base class and adds a "GrFixedClip" implementation. GrFixedClip denotes a clip implemented with fixed- function hardware. GrFixedClip allows us to remove the stateful "fClipMode" member from GrClipMaskManager, and in the future will be able to nicely encapsulate window rectangles. After this change GrClipMaskManager is just a wrapper around GrDrawTarget. We may want to consider removing it altogether. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1971343002 Review-Url: https://codereview.chromium.org/1971343002
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrBlurUtils.cpp4
-rw-r--r--src/gpu/GrClip.cpp110
-rw-r--r--src/gpu/GrClipMaskManager.cpp94
-rw-r--r--src/gpu/GrClipMaskManager.h44
-rw-r--r--src/gpu/GrContext.cpp6
-rw-r--r--src/gpu/GrDrawContext.cpp12
-rw-r--r--src/gpu/GrDrawContextPriv.h5
-rw-r--r--src/gpu/GrDrawTarget.cpp14
-rw-r--r--src/gpu/GrTextureParamsAdjuster.cpp2
-rw-r--r--src/gpu/GrTextureToYUVPlanes.cpp2
-rw-r--r--src/gpu/GrYUVProvider.cpp2
-rw-r--r--src/gpu/SkGpuDevice.cpp2
-rw-r--r--src/gpu/SkGpuDevice.h2
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp6
14 files changed, 134 insertions, 171 deletions
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 40bd6f973b..1e85b87dcf 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -125,8 +125,8 @@ static sk_sp<GrTexture> create_mask_GPU(GrContext* context,
tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op);
// setup new clip
- const SkRect clipRect = SkRect::MakeIWH(maskRect.width(), maskRect.height());
- GrClip clip(clipRect);
+ const SkIRect clipRect = SkIRect::MakeWH(maskRect.width(), maskRect.height());
+ GrFixedClip clip(clipRect);
// Draw the mask into maskTexture with the path's integerized top-left at
// the origin using tempPaint.
diff --git a/src/gpu/GrClip.cpp b/src/gpu/GrClip.cpp
index 5c4a27ccad..15065aa484 100644
--- a/src/gpu/GrClip.cpp
+++ b/src/gpu/GrClip.cpp
@@ -7,47 +7,83 @@
#include "GrClip.h"
-#include "GrSurface.h"
-#include "SkRect.h"
+#include "GrClipMaskManager.h"
-///////////////////////////////////////////////////////////////////////////////
+void GrNoClip::getConservativeBounds(int width, int height, SkIRect* devResult,
+ bool* isIntersectionOfRects) const {
+ devResult->setXYWH(0, 0, width, height);
+ if (isIntersectionOfRects) {
+ *isIntersectionOfRects = true;
+ }
+}
-/**
- * getConservativeBounds returns the conservative bounding box of the clip
- * in device (as opposed to canvas) coordinates. If the bounding box is
- * the result of purely intersections of rects (with an initial replace)
- * isIntersectionOfRects will be set to true.
- */
-void GrClip::getConservativeBounds(int width, int height, SkIRect* devResult,
- bool* isIntersectionOfRects) const {
- switch (fClipType) {
- case kWideOpen_ClipType: {
- devResult->setLTRB(0, 0, width, height);
- if (isIntersectionOfRects) {
- *isIntersectionOfRects = true;
- }
- } break;
- case kIRect_ClipType: {
- *devResult = this->irect();
- if (isIntersectionOfRects) {
- *isIntersectionOfRects = true;
- }
- } break;
- case kClipStack_ClipType: {
- SkRect devBounds;
- this->clipStack()->getConservativeBounds(-this->origin().fX,
- -this->origin().fY,
- width,
- height,
- &devBounds,
- isIntersectionOfRects);
- devBounds.roundOut(devResult);
- } break;
+bool GrFixedClip::quickContains(const SkRect& rect) const {
+ if (fHasStencilClip) {
+ return false;
+ }
+ if (!fScissorState.enabled()) {
+ return true;
+ }
+ return fScissorState.rect().contains(rect);
+}
+
+void GrFixedClip::getConservativeBounds(int width, int height, SkIRect* devResult,
+ bool* isIntersectionOfRects) const {
+ devResult->setXYWH(0, 0, width, height);
+ if (fScissorState.enabled()) {
+ if (!devResult->intersect(fScissorState.rect())) {
+ devResult->setEmpty();
+ }
+ }
+ if (isIntersectionOfRects) {
+ *isIntersectionOfRects = true;
+ }
+}
+
+bool GrFixedClip::apply(GrClipMaskManager*, const GrPipelineBuilder& pipelineBuilder,
+ const SkRect* devBounds, GrAppliedClip* out) const {
+ if (fScissorState.enabled()) {
+ const GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
+ SkIRect tightScissor;
+ if (!tightScissor.intersect(fScissorState.rect(),
+ SkIRect::MakeWH(rt->width(), rt->height()))) {
+ return false;
+ }
+ if (devBounds && !devBounds->intersects(SkRect::Make(tightScissor))) {
+ return false;
+ }
+ out->fScissorState.set(tightScissor);
+ }
+ out->fHasStencilClip = fHasStencilClip;
+ return true;
+}
+
+bool GrClipStackClip::quickContains(const SkRect& rect) const {
+ if (!fStack) {
+ return true;
+ }
+ return fStack->quickContains(rect.makeOffset(SkIntToScalar(fOrigin.x()),
+ SkIntToScalar(fOrigin.y())));
+}
+void GrClipStackClip::getConservativeBounds(int width, int height, SkIRect* devResult,
+ bool* isIntersectionOfRects) const {
+ if (!fStack) {
+ devResult->setXYWH(0, 0, width, height);
+ if (isIntersectionOfRects) {
+ *isIntersectionOfRects = true;
+ }
+ return;
}
+ SkRect devBounds;
+ fStack->getConservativeBounds(-fOrigin.x(), -fOrigin.y(), width, height, &devBounds,
+ isIntersectionOfRects);
+ devBounds.roundOut(devResult);
}
-const GrClip& GrClip::WideOpen() {
- static const GrClip clip;
- return clip;
+bool GrClipStackClip::apply(GrClipMaskManager* clipMaskManager,
+ const GrPipelineBuilder& pipelineBuilder, const SkRect* devBounds,
+ GrAppliedClip* out) const {
+ // TODO: Collapse ClipMaskManager into this class.(?)
+ return clipMaskManager->setupClipping(pipelineBuilder, *this, devBounds, out);
}
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index da128fb5c0..0d2d5b073e 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -137,11 +137,6 @@ GrPathRenderer* GrClipMaskManager::GetPathRenderer(GrContext* context,
return pr;
}
-GrClipMaskManager::GrClipMaskManager(GrDrawTarget* drawTarget)
- : fDrawTarget(drawTarget)
- , fClipMode(kIgnoreClip_StencilClipMode) {
-}
-
GrContext* GrClipMaskManager::getContext() {
return fDrawTarget->cmmAccess().context();
}
@@ -288,11 +283,11 @@ bool GrClipMaskManager::getAnalyticClipProcessor(const GrReducedClip::ElementLis
// sort out what kind of clip mask needs to be created: alpha, stencil,
// scissor, or entirely software
bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
- const GrClip& clip,
+ const GrClipStackClip& clip,
const SkRect* devBounds,
GrAppliedClip* out) {
- if (kRespectClip_StencilClipMode == fClipMode) {
- fClipMode = kIgnoreClip_StencilClipMode;
+ if (!clip.clipStack() || clip.clipStack()->isWideOpen()) {
+ return true;
}
GrReducedClip::ElementList elements;
@@ -306,59 +301,36 @@ bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
SkASSERT(rt);
SkIRect clipSpaceRTIBounds = SkIRect::MakeWH(rt->width(), rt->height());
- if (clip.isWideOpen(clipSpaceRTIBounds)) {
- return true;
- }
+ clipSpaceRTIBounds.offset(clip.origin());
- // The clip mask manager always draws with a single IRect so we special case that logic here
- // Image filters just use a rect, so we also special case that logic
- switch (clip.clipType()) {
- case GrClip::kWideOpen_ClipType:
- SkFAIL("Should have caught this with clip.isWideOpen()");
- return true;
- case GrClip::kIRect_ClipType: {
- SkIRect scissor = clip.irect();
- if (scissor.intersect(clipSpaceRTIBounds)) {
- out->fScissorState.set(scissor);
- out->fHasStencilClip = kIgnoreClip_StencilClipMode != fClipMode;
+ SkIRect clipSpaceReduceQueryBounds;
+#define DISABLE_DEV_BOUNDS_FOR_CLIP_REDUCTION 0
+ if (devBounds && !DISABLE_DEV_BOUNDS_FOR_CLIP_REDUCTION) {
+ SkIRect devIBounds = devBounds->roundOut();
+ devIBounds.offset(clip.origin());
+ if (!clipSpaceReduceQueryBounds.intersect(clipSpaceRTIBounds, devIBounds)) {
+ return false;
+ }
+ } else {
+ clipSpaceReduceQueryBounds = clipSpaceRTIBounds;
+ }
+ GrReducedClip::ReduceClipStack(*clip.clipStack(),
+ clipSpaceReduceQueryBounds,
+ &elements,
+ &genID,
+ &initialState,
+ &clipSpaceIBounds,
+ &requiresAA);
+ if (elements.isEmpty()) {
+ if (GrReducedClip::kAllIn_InitialState == initialState) {
+ if (clipSpaceIBounds == clipSpaceRTIBounds) {
return true;
}
+ } else {
return false;
}
- case GrClip::kClipStack_ClipType: {
- clipSpaceRTIBounds.offset(clip.origin());
- SkIRect clipSpaceReduceQueryBounds;
-#define DISABLE_DEV_BOUNDS_FOR_CLIP_REDUCTION 0
- if (devBounds && !DISABLE_DEV_BOUNDS_FOR_CLIP_REDUCTION) {
- SkIRect devIBounds = devBounds->roundOut();
- devIBounds.offset(clip.origin());
- if (!clipSpaceReduceQueryBounds.intersect(clipSpaceRTIBounds, devIBounds)) {
- return false;
- }
- } else {
- clipSpaceReduceQueryBounds = clipSpaceRTIBounds;
- }
- GrReducedClip::ReduceClipStack(*clip.clipStack(),
- clipSpaceReduceQueryBounds,
- &elements,
- &genID,
- &initialState,
- &clipSpaceIBounds,
- &requiresAA);
- if (elements.isEmpty()) {
- if (GrReducedClip::kAllIn_InitialState == initialState) {
- if (clipSpaceIBounds == clipSpaceRTIBounds) {
- return true;
- }
- } else {
- return false;
- }
- }
- } break;
}
- SkASSERT(kIgnoreClip_StencilClipMode == fClipMode); // TODO: Remove fClipMode.
-
// An element count of 4 was chosen because of the common pattern in Blink of:
// isect RR
// diff RR
@@ -452,13 +424,12 @@ bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
SkIRect scissorSpaceIBounds(clipSpaceIBounds);
scissorSpaceIBounds.offset(clipSpaceToStencilSpaceOffset);
out->fScissorState.set(scissorSpaceIBounds);
- SkASSERT(kRespectClip_StencilClipMode == fClipMode); // TODO: Remove fClipMode.
out->fHasStencilClip = true;
return true;
}
static bool stencil_element(GrDrawContext* dc,
- const GrClip& clip,
+ const GrFixedClip& clip,
const GrUserStencilSettings* ss,
const SkMatrix& viewMatrix,
const SkClipStack::Element* element) {
@@ -603,7 +574,7 @@ GrTexture* GrClipMaskManager::CreateAlphaClipMask(GrContext* context,
}
#endif
- GrClip clip(maskSpaceIBounds);
+ GrFixedClip clip(maskSpaceIBounds);
// draw directly into the result with the stencil set to make the pixels affected
// by the clip shape be non-zero.
@@ -645,7 +616,7 @@ GrTexture* GrClipMaskManager::CreateAlphaClipMask(GrContext* context,
paint.setAntiAlias(element->isAA());
paint.setCoverageSetOpXPFactory(op, false);
- draw_element(dc.get(), GrClip::WideOpen(), paint, translate, element);
+ draw_element(dc.get(), GrNoClip(), paint, translate, element);
}
}
@@ -681,7 +652,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
// We set the current clip to the bounds so that our recursive draws are scissored to them.
SkIRect stencilSpaceIBounds(clipSpaceIBounds);
stencilSpaceIBounds.offset(clipSpaceToStencilOffset);
- GrClip clip(stencilSpaceIBounds);
+ GrFixedClip clip(stencilSpaceIBounds);
fDrawTarget->cmmAccess().clearStencilClip(stencilSpaceIBounds,
GrReducedClip::kAllIn_InitialState == initialState, rt);
@@ -703,7 +674,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
bool fillInverted = false;
// enabled at bottom of loop
- fClipMode = kIgnoreClip_StencilClipMode;
+ clip.enableStencilClip(false);
// This will be used to determine whether the clip shape can be rendered into the
// stencil with arbitrary stencil settings.
@@ -801,7 +772,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
// now we modify the clip bit by rendering either the clip
// element directly or a bounding rect of the entire clip.
- fClipMode = kModifyClip_StencilClipMode;
+ clip.enableStencilClip(true);
for (GrUserStencilSettings const* const* pass = stencilPasses; *pass; ++pass) {
pipelineBuilder.setUserStencil(*pass);
@@ -832,7 +803,6 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
}
}
}
- fClipMode = kRespectClip_StencilClipMode;
return true;
}
diff --git a/src/gpu/GrClipMaskManager.h b/src/gpu/GrClipMaskManager.h
index 2b70f02e38..ef5fbc14d0 100644
--- a/src/gpu/GrClipMaskManager.h
+++ b/src/gpu/GrClipMaskManager.h
@@ -17,7 +17,8 @@
#include "SkTLList.h"
#include "SkTypes.h"
-class GrClip;
+class GrAppliedClip;
+class GrClipStackClip;
class GrDrawTarget;
class GrPathRenderer;
class GrPathRendererChain;
@@ -26,28 +27,6 @@ class GrTexture;
class SkPath;
/**
- * Produced by GrClipMaskManager. It provides a set of modifications to the drawing state that
- * are used to create the final GrPipeline for a GrBatch. This is a work in progress. It will
- * eventually encapsulate all mechanisms for modifying the scissor, shaders, and stencil state
- * to implement clipping.
- */
-class GrAppliedClip : public SkNoncopyable {
-public:
- GrAppliedClip() : fHasStencilClip(false) {}
- const GrFragmentProcessor* clipCoverageFragmentProcessor() const { return fClipCoverageFP; }
- const GrScissorState& scissorState() const { return fScissorState; }
- bool hasStencilClip() const { return fHasStencilClip; }
-
-private:
- SkAutoTUnref<const GrFragmentProcessor> fClipCoverageFP;
- GrScissorState fScissorState;
- bool fHasStencilClip;
- friend class GrClipMaskManager;
-
- typedef SkNoncopyable INHERITED;
-};
-
-/**
* The clip mask creator handles the generation of the clip mask. If anti
* aliasing is requested it will (in the future) generate a single channel
* (8bit) mask. If no anti aliasing is requested it will generate a 1-bit
@@ -57,7 +36,7 @@ private:
*/
class GrClipMaskManager : SkNoncopyable {
public:
- GrClipMaskManager(GrDrawTarget* owner);
+ GrClipMaskManager(GrDrawTarget* owner) : fDrawTarget(owner) {}
/**
* Creates a clip mask if necessary as a stencil buffer or alpha texture
@@ -65,7 +44,7 @@ public:
* then the draw can be skipped. devBounds is optional but can help optimize
* clipping.
*/
- bool setupClipping(const GrPipelineBuilder&, const GrClip&, const SkRect* devBounds,
+ bool setupClipping(const GrPipelineBuilder&, const GrClipStackClip&, const SkRect* devBounds,
GrAppliedClip*);
private:
@@ -85,20 +64,6 @@ private:
const SkMatrix& viewMatrix,
const SkClipStack::Element* element);
- /**
- * Informs the helper function adjustStencilParams() about how the stencil
- * buffer clip is being used.
- */
- enum StencilClipMode {
- // Draw to the clip bit of the stencil buffer
- kModifyClip_StencilClipMode,
- // Clip against the existing representation of the clip in the high bit
- // of the stencil buffer.
- kRespectClip_StencilClipMode,
- // Neither writing to nor clipping against the clip bit.
- kIgnoreClip_StencilClipMode,
- };
-
// Attempts to install a series of coverage effects to implement the clip. Return indicates
// whether the element list was successfully converted to processors. *fp may be nullptr even
// when the function succeeds because all the elements were ignored. TODO: Make clip reduction
@@ -146,7 +111,6 @@ private:
static const int kMaxAnalyticElements = 4;
GrDrawTarget* fDrawTarget; // This is our owning draw target.
- StencilClipMode fClipMode;
typedef SkNoncopyable INHERITED;
};
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 4235ae8552..39916b9728 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -373,7 +373,7 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
paint.addColorFragmentProcessor(fp);
paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
- drawContext->drawRect(GrClip::WideOpen(), paint, matrix, rect, nullptr);
+ drawContext->drawRect(GrNoClip(), paint, matrix, rect, nullptr);
if (kFlushWrites_PixelOp & pixelOpsFlags) {
this->flushSurfaceWrites(surface);
@@ -487,7 +487,7 @@ bool GrContext::readSurfacePixels(GrSurface* src,
SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
sk_sp<GrDrawContext> drawContext(
this->drawContext(sk_ref_sp(temp->asRenderTarget())));
- drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect, nullptr);
+ drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), rect, nullptr);
surfaceToRead.reset(SkRef(temp.get()));
left = 0;
top = 0;
@@ -559,7 +559,7 @@ bool GrContext::applyGamma(GrRenderTarget* dst, GrTexture* src, SkScalar gamma){
SkRect rect;
src->getBoundsRect(&rect);
- drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect);
+ drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), rect);
this->flushSurfaceWrites(dst);
return true;
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 3db04491e6..549e5ebf80 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -301,14 +301,8 @@ void GrDrawContext::drawRect(const GrClip& clip,
if (width < 0) {
SkRect rtRect;
fRenderTarget->getBoundsRect(&rtRect);
- SkRect clipSpaceRTRect = rtRect;
- bool checkClip = GrClip::kWideOpen_ClipType != clip.clipType();
- if (checkClip) {
- clipSpaceRTRect.offset(SkIntToScalar(clip.origin().fX),
- SkIntToScalar(clip.origin().fY));
- }
// Does the clip contain the entire RT?
- if (!checkClip || clip.quickContains(clipSpaceRTRect)) {
+ if (clip.quickContains(rtRect)) {
SkMatrix invM;
if (!viewMatrix.invert(&invM)) {
return;
@@ -374,7 +368,7 @@ void GrDrawContext::drawRect(const GrClip& clip,
this->internalDrawPath(clip, paint, viewMatrix, path, *style);
}
-bool GrDrawContextPriv::drawAndStencilRect(const GrClip& clip,
+bool GrDrawContextPriv::drawAndStencilRect(const GrFixedClip& clip,
const GrUserStencilSettings* ss,
SkRegion::Op op,
bool invert,
@@ -839,7 +833,7 @@ void GrDrawContext::drawPath(const GrClip& clip,
this->internalDrawPath(clip, paint, viewMatrix, path, style);
}
-bool GrDrawContextPriv::drawAndStencilPath(const GrClip& clip,
+bool GrDrawContextPriv::drawAndStencilPath(const GrFixedClip& clip,
const GrUserStencilSettings* ss,
SkRegion::Op op,
bool invert,
diff --git a/src/gpu/GrDrawContextPriv.h b/src/gpu/GrDrawContextPriv.h
index 7f70f89582..2fb98ee51c 100644
--- a/src/gpu/GrDrawContextPriv.h
+++ b/src/gpu/GrDrawContextPriv.h
@@ -10,6 +10,7 @@
#include "GrDrawContext.h"
+class GrFixedClip;
struct GrUserStencilSettings;
/** Class that adds methods to GrDrawContext that are only intended for use internal to Skia.
@@ -17,7 +18,7 @@ struct GrUserStencilSettings;
data members or virtual methods. */
class GrDrawContextPriv {
public:
- bool drawAndStencilRect(const GrClip&,
+ bool drawAndStencilRect(const GrFixedClip&,
const GrUserStencilSettings*,
SkRegion::Op op,
bool invert,
@@ -25,7 +26,7 @@ public:
const SkMatrix& viewMatrix,
const SkRect&);
- bool drawAndStencilPath(const GrClip&,
+ bool drawAndStencilPath(const GrFixedClip&,
const GrUserStencilSettings*,
SkRegion::Op op,
bool invert,
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 0db31f29de..7d92ef923c 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -239,7 +239,7 @@ void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder,
GrDrawBatch* batch) {
// Setup clip
GrAppliedClip appliedClip;
- if (!fClipMaskManager->setupClipping(pipelineBuilder, clip, &batch->bounds(), &appliedClip)) {
+ if (!clip.apply(fClipMaskManager, pipelineBuilder, &batch->bounds(), &appliedClip)) {
return;
}
@@ -317,16 +317,14 @@ void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder,
// Setup clip
GrAppliedClip appliedClip;
- if (!fClipMaskManager->setupClipping(pipelineBuilder, clip, nullptr, &appliedClip)) {
+ if (!clip.apply(fClipMaskManager, pipelineBuilder, nullptr, &appliedClip)) {
return;
}
// TODO: respect fClipBatchToBounds if we ever start computing bounds here.
- GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
- if (appliedClip.clipCoverageFragmentProcessor()) {
- arfps.set(&pipelineBuilder);
- arfps.addCoverageFragmentProcessor(appliedClip.clipCoverageFragmentProcessor());
- }
+ // Coverage AA does not make sense when rendering to the stencil buffer. The caller should never
+ // attempt this in a situation that would require coverage AA.
+ SkASSERT(!appliedClip.clipCoverageFragmentProcessor());
GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
GrStencilAttachment* stencilAttachment = fResourceProvider->attachStencilAttachment(rt);
@@ -378,7 +376,7 @@ void GrDrawTarget::clear(const SkIRect* rect,
SkAutoTUnref<GrDrawBatch> batch(
GrRectBatchFactory::CreateNonAAFill(color, SkMatrix::I(), scalarRect,
nullptr, nullptr));
- this->drawBatch(pipelineBuilder, GrClip::WideOpen(), batch);
+ this->drawBatch(pipelineBuilder, GrNoClip(), batch);
} else {
GrBatch* batch = new GrClearBatch(*rect, color, renderTarget);
this->recordBatch(batch);
diff --git a/src/gpu/GrTextureParamsAdjuster.cpp b/src/gpu/GrTextureParamsAdjuster.cpp
index 3c4769b96e..a91ba8a5e3 100644
--- a/src/gpu/GrTextureParamsAdjuster.cpp
+++ b/src/gpu/GrTextureParamsAdjuster.cpp
@@ -119,7 +119,7 @@ static GrTexture* copy_on_gpu(GrTexture* inputTexture, const SkIRect* subset,
}
SkRect dstRect = SkRect::MakeWH(SkIntToScalar(rtDesc.fWidth), SkIntToScalar(rtDesc.fHeight));
- drawContext->fillRectToRect(GrClip::WideOpen(), paint, SkMatrix::I(), dstRect, localRect);
+ drawContext->fillRectToRect(GrNoClip(), paint, SkMatrix::I(), dstRect, localRect);
return copy.release();
}
diff --git a/src/gpu/GrTextureToYUVPlanes.cpp b/src/gpu/GrTextureToYUVPlanes.cpp
index 14ebf3c272..42156026a3 100644
--- a/src/gpu/GrTextureToYUVPlanes.cpp
+++ b/src/gpu/GrTextureToYUVPlanes.cpp
@@ -43,7 +43,7 @@ static bool convert_texture(GrTexture* src, GrDrawContext* dst, int dstW, int ds
GrPaint paint;
paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
paint.addColorFragmentProcessor(fp);
- dst->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), SkRect::MakeIWH(dstW, dstH));
+ dst->drawRect(GrNoClip(), paint, SkMatrix::I(), SkRect::MakeIWH(dstW, dstH));
return true;
}
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index 970644d0f4..a7281da27b 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -147,7 +147,7 @@ sk_sp<GrTexture> GrYUVProvider::refAsTexture(GrContext* ctx,
const SkRect r = SkRect::MakeIWH(yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY].fWidth,
yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY].fHeight);
- drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), r);
+ drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), r);
return drawContext->asTexture();
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index a0f81e7ed9..a5af472cbb 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -341,7 +341,7 @@ void SkGpuDevice::prepareDraw(const SkDraw& draw) {
SkASSERT(draw.fClipStack && draw.fClipStack == fClipStack);
- fClip.setClipStack(fClipStack, &this->getOrigin());
+ fClip.reset(fClipStack, &this->getOrigin());
}
GrRenderTarget* SkGpuDevice::accessRenderTarget() {
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index 1e025670ef..e940159b22 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -153,7 +153,7 @@ private:
SkAutoTUnref<const SkClipStack> fClipStack;
SkIPoint fClipOrigin;
- GrClip fClip;;
+ GrClipStackClip fClip;
// remove when our clients don't rely on accessBitmap()
SkBitmap fLegacyBitmap;
bool fOpaque;
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 6b43606bb5..99a4884f0f 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -232,7 +232,7 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
break;
}
- readDrawContext->fillRectToRect(GrClip::WideOpen(),
+ readDrawContext->fillRectToRect(GrNoClip(),
paint1,
SkMatrix::I(),
kDstRect,
@@ -249,7 +249,7 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
failed = true;
break;
}
- tempDrawContext->fillRectToRect(GrClip::WideOpen(),
+ tempDrawContext->fillRectToRect(GrNoClip(),
paint2,
SkMatrix::I(),
kDstRect,
@@ -264,7 +264,7 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
break;
}
- readDrawContext->fillRectToRect(GrClip::WideOpen(),
+ readDrawContext->fillRectToRect(GrNoClip(),
paint3,
SkMatrix::I(),
kDstRect,