aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-10-27 06:42:50 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-10-27 06:42:50 -0700
commite91f7b5ceca22e2e68e252b55d59804d1ce8ae4d (patch)
treedc1d1a3c7c8324d17cd9af6291a37f8d668108d9 /src/gpu
parent4d8762f8b055b9211a465bf67f136f496c5d182a (diff)
Move scissor state to GrAppliedClip
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrClipMaskManager.cpp7
-rw-r--r--src/gpu/GrClipMaskManager.h3
-rw-r--r--src/gpu/GrDrawTarget.cpp17
3 files changed, 11 insertions, 16 deletions
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 2596a06080..4c651f7fad 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -209,7 +209,6 @@ bool GrClipMaskManager::getAnalyticClipProcessor(const GrReducedClip::ElementLis
// scissor, or entirely software
bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
GrPipelineBuilder::AutoRestoreStencil* ars,
- GrScissorState* scissorState,
const SkRect* devBounds,
GrAppliedClip* out) {
if (kRespectClip_StencilClipMode == fClipMode) {
@@ -242,7 +241,7 @@ bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
case GrClip::kIRect_ClipType: {
SkIRect scissor = clip.irect();
if (scissor.intersect(clipSpaceRTIBounds)) {
- scissorState->set(scissor);
+ out->fScissorState.set(scissor);
this->setPipelineBuilderStencil(pipelineBuilder, ars);
return true;
}
@@ -293,7 +292,7 @@ bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
scissorSpaceIBounds.offset(-clip.origin());
if (nullptr == devBounds ||
!SkRect::Make(scissorSpaceIBounds).contains(*devBounds)) {
- scissorState->set(scissorSpaceIBounds);
+ out->fScissorState.set(scissorSpaceIBounds);
}
this->setPipelineBuilderStencil(pipelineBuilder, ars);
out->fClipCoverageFP.reset(clipFP);
@@ -353,7 +352,7 @@ bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
// use both stencil and scissor test to the bounds for the final draw.
SkIRect scissorSpaceIBounds(clipSpaceIBounds);
scissorSpaceIBounds.offset(clipSpaceToStencilSpaceOffset);
- scissorState->set(scissorSpaceIBounds);
+ out->fScissorState.set(scissorSpaceIBounds);
this->setPipelineBuilderStencil(pipelineBuilder, ars);
return true;
}
diff --git a/src/gpu/GrClipMaskManager.h b/src/gpu/GrClipMaskManager.h
index 3ce3e72bf1..9b5607eff2 100644
--- a/src/gpu/GrClipMaskManager.h
+++ b/src/gpu/GrClipMaskManager.h
@@ -34,9 +34,11 @@ class GrAppliedClip : public SkNoncopyable {
public:
GrAppliedClip() {}
const GrFragmentProcessor* clipCoverageFragmentProcessor() const { return fClipCoverageFP; }
+ const GrScissorState& scissorState() const { return fScissorState; }
private:
SkAutoTUnref<const GrFragmentProcessor> fClipCoverageFP;
+ GrScissorState fScissorState;
friend class GrClipMaskManager;
typedef SkNoncopyable INHERITED;
@@ -63,7 +65,6 @@ public:
*/
bool setupClipping(const GrPipelineBuilder&,
GrPipelineBuilder::AutoRestoreStencil*,
- GrScissorState*,
const SkRect* devBounds,
GrAppliedClip*);
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 1dc26bc8c6..5a3feccc17 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -211,11 +211,9 @@ void GrDrawTarget::reset() {
void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBatch* batch) {
// Setup clip
- GrScissorState scissorState;
GrPipelineBuilder::AutoRestoreStencil ars;
GrAppliedClip clip;
- if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &scissorState, &batch->bounds(),
- &clip)) {
+ if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &batch->bounds(), &clip)) {
return;
}
GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
@@ -225,7 +223,7 @@ void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBat
}
GrPipeline::CreateArgs args;
- if (!this->installPipelineInDrawBatch(&pipelineBuilder, &scissorState, batch)) {
+ if (!this->installPipelineInDrawBatch(&pipelineBuilder, &clip.scissorState(), batch)) {
return;
}
@@ -276,10 +274,9 @@ void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder,
SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
// Setup clip
- GrScissorState scissorState;
GrPipelineBuilder::AutoRestoreStencil ars;
GrAppliedClip clip;
- if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &scissorState, nullptr, &clip)) {
+ if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, nullptr, &clip)) {
return;
}
@@ -297,7 +294,7 @@ void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder,
GrBatch* batch = GrStencilPathBatch::Create(viewMatrix,
pipelineBuilder.isHWAntialias(),
- stencilSettings, scissorState,
+ stencilSettings, clip.scissorState(),
pipelineBuilder.getRenderTarget(),
path);
this->recordBatch(batch);
@@ -338,11 +335,9 @@ void GrDrawTarget::drawPathBatch(const GrPipelineBuilder& pipelineBuilder,
// handling stencil settings WRT interactions between pipeline(builder), clipmaskmanager, and
// batches.
- GrScissorState scissorState;
GrPipelineBuilder::AutoRestoreStencil ars;
GrAppliedClip clip;
- if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &scissorState, &batch->bounds(),
- &clip)) {
+ if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &batch->bounds(), &clip)) {
return;
}
@@ -360,7 +355,7 @@ void GrDrawTarget::drawPathBatch(const GrPipelineBuilder& pipelineBuilder,
batch->setStencilSettings(stencilSettings);
GrPipeline::CreateArgs args;
- if (!this->installPipelineInDrawBatch(&pipelineBuilder, &scissorState, batch)) {
+ if (!this->installPipelineInDrawBatch(&pipelineBuilder, &clip.scissorState(), batch)) {
return;
}