aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDrawTarget.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-09-09 09:48:06 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-09-09 09:48:06 -0700
commit1fcc01c4158bd68c679569e6c7cfbb302d0ce170 (patch)
tree2d3d41bf771e9433ed6a26b0e2e710f1c87a5391 /src/gpu/GrDrawTarget.cpp
parent5ca4fa3846067a47e88d35ace895df3ebe3ec2a5 (diff)
GrPathRangeBatch
Diffstat (limited to 'src/gpu/GrDrawTarget.cpp')
-rw-r--r--src/gpu/GrDrawTarget.cpp84
1 files changed, 18 insertions, 66 deletions
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 3f472d0948..0e7e6bce90 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -224,8 +224,23 @@ void GrDrawTarget::drawPath(const GrPipelineBuilder& pipelineBuilder,
SkASSERT(path);
SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
- GrDrawPathBatch* batch = GrDrawPathBatch::Create(pathProc, path);
+ GrDrawPathBatchBase* batch = GrDrawPathBatch::Create(pathProc, path);
+ this->drawPathBatch(pipelineBuilder, batch, fill);
+ batch->unref();
+}
+
+void GrDrawTarget::drawPathsFromRange(const GrPipelineBuilder& pipelineBuilder,
+ const GrPathProcessor* pathProc,
+ GrPathRangeDraw* draw,
+ GrPathRendering::FillType fill) {
+ GrDrawPathBatchBase* batch = GrDrawPathRangeBatch::Create(pathProc, draw);
+ this->drawPathBatch(pipelineBuilder, batch, fill);
+ batch->unref();
+}
+void GrDrawTarget::drawPathBatch(const GrPipelineBuilder& pipelineBuilder,
+ GrDrawPathBatchBase* batch,
+ GrPathRendering::FillType fill) {
// This looks like drawBatch() but there is an added wrinkle that stencil settings get inserted
// after setupClip() but before onDrawBatch(). TODO: Figure out a better model for handling
// stencil settings WRT interactions between pipeline(builder), clipmaskmanager, and batches.
@@ -244,11 +259,8 @@ void GrDrawTarget::drawPath(const GrPipelineBuilder& pipelineBuilder,
this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
batch->setStencilSettings(stencilSettings);
- // Don't compute a bounding box for dst copy texture, we'll opt
- // instead for it to just copy the entire dst. Realistically this is a moot
- // point, because any context that supports NV_path_rendering will also
- // support NV_blend_equation_advanced.
- GrDrawTarget::PipelineInfo pipelineInfo(&pipelineBuilder, &scissorState, batch, nullptr, this);
+ GrDrawTarget::PipelineInfo pipelineInfo(&pipelineBuilder, &scissorState, batch,
+ &batch->bounds(), this);
if (!pipelineInfo.valid()) {
return;
@@ -258,50 +270,6 @@ void GrDrawTarget::drawPath(const GrPipelineBuilder& pipelineBuilder,
}
this->onDrawBatch(batch);
- batch->unref();
-}
-
-void GrDrawTarget::drawPaths(const GrPipelineBuilder& pipelineBuilder,
- const GrPathProcessor* pathProc,
- const GrPathRange* pathRange,
- const void* indices,
- PathIndexType indexType,
- const float transformValues[],
- PathTransformType transformType,
- int count,
- GrPathRendering::FillType fill) {
- SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
- SkASSERT(pathRange);
- SkASSERT(indices);
- SkASSERT(0 == reinterpret_cast<intptr_t>(indices) %
- GrPathRange::PathIndexSizeInBytes(indexType));
- SkASSERT(transformValues);
-
- // Setup clip
- GrScissorState scissorState;
- GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
- GrPipelineBuilder::AutoRestoreStencil ars;
- if (!this->setupClip(pipelineBuilder, &arfps, &ars, &scissorState, nullptr)) {
- return;
- }
-
- // set stencil settings for path
- GrStencilSettings stencilSettings;
- GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
- GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment();
- this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
-
- // Don't compute a bounding box for dst copy texture, we'll opt
- // instead for it to just copy the entire dst. Realistically this is a moot
- // point, because any context that supports NV_path_rendering will also
- // support NV_blend_equation_advanced.
- GrDrawTarget::PipelineInfo pipelineInfo(&pipelineBuilder, &scissorState, pathProc, nullptr, this);
- if (!pipelineInfo.valid()) {
- return;
- }
-
- this->onDrawPaths(pathProc, pathRange, indices, indexType, transformValues,
- transformType, count, stencilSettings, pipelineInfo);
}
void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder,
@@ -406,22 +374,6 @@ void GrDrawTarget::copySurface(GrSurface* dst,
GrDrawTarget::PipelineInfo::PipelineInfo(const GrPipelineBuilder* pipelineBuilder,
const GrScissorState* scissor,
- const GrPrimitiveProcessor* primProc,
- const SkRect* devBounds,
- GrDrawTarget* target) {
- fArgs.fPipelineBuilder = pipelineBuilder;
- fArgs.fCaps = target->caps();
- fArgs.fScissor = scissor;
- fArgs.fColorPOI = fArgs.fPipelineBuilder->colorProcInfo(primProc);
- fArgs.fCoveragePOI = fArgs.fPipelineBuilder->coverageProcInfo(primProc);
- if (!target->setupDstReadIfNecessary(*fArgs.fPipelineBuilder, fArgs.fColorPOI,
- fArgs.fCoveragePOI, &fArgs.fDstTexture, devBounds)) {
- fArgs.fPipelineBuilder = nullptr;
- }
-}
-
-GrDrawTarget::PipelineInfo::PipelineInfo(const GrPipelineBuilder* pipelineBuilder,
- const GrScissorState* scissor,
const GrDrawBatch* batch,
const SkRect* devBounds,
GrDrawTarget* target) {