// scissor, or entirely software
bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
GrPipelineBuilder::AutoRestoreStencil* ars,
- GrScissorState* scissorState,
const SkRect* devBounds,
GrAppliedClip* out) {
if (kRespectClip_StencilClipMode == fClipMode) {
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;
}
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);
// 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;
}
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;
*/
bool setupClipping(const GrPipelineBuilder&,
GrPipelineBuilder::AutoRestoreStencil*,
- GrScissorState*,
const SkRect* devBounds,
GrAppliedClip*);
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;
}
GrPipeline::CreateArgs args;
- if (!this->installPipelineInDrawBatch(&pipelineBuilder, &scissorState, batch)) {
+ if (!this->installPipelineInDrawBatch(&pipelineBuilder, &clip.scissorState(), batch)) {
return;
}
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;
}
GrBatch* batch = GrStencilPathBatch::Create(viewMatrix,
pipelineBuilder.isHWAntialias(),
- stencilSettings, scissorState,
+ stencilSettings, clip.scissorState(),
pipelineBuilder.getRenderTarget(),
path);
this->recordBatch(batch);
// 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;
}
batch->setStencilSettings(stencilSettings);
GrPipeline::CreateArgs args;
- if (!this->installPipelineInDrawBatch(&pipelineBuilder, &scissorState, batch)) {
+ if (!this->installPipelineInDrawBatch(&pipelineBuilder, &clip.scissorState(), batch)) {
return;
}