Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Unified Diff: src/gpu/GrClipMaskManager.cpp

Issue 678843003: Revert of Clip mask manager sets stencil on draw type (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrClipMaskManager.h ('k') | src/gpu/GrDrawState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrClipMaskManager.cpp
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 0738108ab8b6cd015776a60e09359d10a920e51c..349d51e311586103bf14c9f67f08e33a4a1b7a36 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -17,12 +17,12 @@
#include "GrRenderTarget.h"
#include "GrStencilBuffer.h"
#include "GrSWMaskHelper.h"
+#include "effects/GrTextureDomain.h"
+#include "effects/GrConvexPolyEffect.h"
+#include "effects/GrRRectEffect.h"
#include "SkRasterClip.h"
#include "SkStrokeRec.h"
#include "SkTLazy.h"
-#include "effects/GrTextureDomain.h"
-#include "effects/GrConvexPolyEffect.h"
-#include "effects/GrRRectEffect.h"
#define GR_AA_CLIP 1
@@ -212,7 +212,6 @@
// scissor, or entirely software
bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn,
GrDrawState::AutoRestoreEffects* are,
- GrDrawState::AutoRestoreStencil* asr,
const SkRect* devBounds) {
fCurrClipMaskType = kNone_ClipMaskType;
@@ -229,6 +228,7 @@
SkASSERT(rt);
bool ignoreClip = !drawState->isClipState() || clipDataIn->fClipStack->isWideOpen();
+
if (!ignoreClip) {
SkIRect clipSpaceRTIBounds = SkIRect::MakeWH(rt->width(), rt->height());
clipSpaceRTIBounds.offset(clipDataIn->fOrigin);
@@ -250,7 +250,7 @@
if (ignoreClip) {
fGpu->disableScissor();
- this->setDrawStateStencil(asr);
+ this->setGpuStencil();
return true;
}
@@ -275,7 +275,7 @@
} else {
fGpu->disableScissor();
}
- this->setDrawStateStencil(asr);
+ this->setGpuStencil();
return true;
}
}
@@ -307,7 +307,7 @@
are->set(fGpu->drawState());
setup_drawstate_aaclip(fGpu, result, rtSpaceMaskBounds);
fGpu->disableScissor();
- this->setDrawStateStencil(asr);
+ this->setGpuStencil();
return true;
}
// if alpha clip mask creation fails fall through to the non-AA code paths
@@ -335,7 +335,7 @@
SkIRect scissorSpaceIBounds(clipSpaceIBounds);
scissorSpaceIBounds.offset(clipSpaceToStencilSpaceOffset);
fGpu->enableScissor(scissorSpaceIBounds);
- this->setDrawStateStencil(asr);
+ this->setGpuStencil();
return true;
}
@@ -400,11 +400,11 @@
// TODO: Do rects directly to the accumulator using a aa-rect GrProcessor that covers
// the entire mask bounds and writes 0 outside the rect.
if (element->isAA()) {
- this->getContext()->getAARectRenderer()->fillAARect(fGpu,
- fGpu,
- element->getRect(),
- SkMatrix::I(),
- element->getRect());
+ getContext()->getAARectRenderer()->fillAARect(fGpu,
+ fGpu,
+ element->getRect(),
+ SkMatrix::I(),
+ element->getRect());
} else {
fGpu->drawSimpleRect(element->getRect());
}
@@ -707,6 +707,7 @@
}
if (stencilBuffer->mustRenderClip(elementsGenID, clipSpaceIBounds, clipSpaceToStencilOffset)) {
+
stencilBuffer->setLastClip(elementsGenID, clipSpaceIBounds, clipSpaceToStencilOffset);
// Set the matrix so that rendered clip elements are transformed from clip to stencil space.
@@ -902,7 +903,7 @@
}
}
-void GrClipMaskManager::setDrawStateStencil(GrDrawState::AutoRestoreStencil* ars) {
+void GrClipMaskManager::setGpuStencil() {
// We make two copies of the StencilSettings here (except in the early
// exit scenario. One copy from draw state to the stack var. Then another
// from the stack var to the gpu. We could make this class hold a ptr to
@@ -932,6 +933,7 @@
if (GrClipMaskManager::kRespectClip_StencilClipMode == clipMode) {
settings = basic_apply_stencil_clip_settings();
} else {
+ fGpu->disableStencil();
return;
}
} else {
@@ -940,7 +942,8 @@
// TODO: dynamically attach a stencil buffer
int stencilBits = 0;
- GrStencilBuffer* stencilBuffer = drawState.getRenderTarget()->getStencilBuffer();
+ GrStencilBuffer* stencilBuffer =
+ drawState.getRenderTarget()->getStencilBuffer();
if (stencilBuffer) {
stencilBits = stencilBuffer->bits();
}
@@ -948,8 +951,7 @@
SkASSERT(fGpu->caps()->stencilWrapOpsSupport() || !settings.usesWrapOp());
SkASSERT(fGpu->caps()->twoSidedStencilSupport() || !settings.isTwoSided());
this->adjustStencilParams(&settings, clipMode, stencilBits);
- ars->set(fGpu->drawState());
- fGpu->drawState()->setStencil(settings);
+ fGpu->setStencilSettings(settings);
}
void GrClipMaskManager::adjustStencilParams(GrStencilSettings* settings,
« no previous file with comments | « src/gpu/GrClipMaskManager.h ('k') | src/gpu/GrDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698