Chromium Code Reviews| Index: src/gpu/GrDrawTarget.h |
| diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h |
| index 1b6651716c3f2f0fcc54f58f8f8159b01e63ca32..89ebe3d9c5244efdfe8fd7c9410f8b0efdc6deea 100644 |
| --- a/src/gpu/GrDrawTarget.h |
| +++ b/src/gpu/GrDrawTarget.h |
| @@ -31,6 +31,7 @@ class GrClipData; |
| class GrDrawTargetCaps; |
| class GrPath; |
| class GrPathRange; |
| +class GrPipeline; |
| class GrDrawTarget : public SkRefCnt { |
| public: |
| @@ -678,9 +679,54 @@ protected: |
| // but couldn't be made. Otherwise, returns true. This method needs to be protected because it |
| // needs to be accessed by GLPrograms to setup a correct drawstate |
| bool setupDstReadIfNecessary(const GrPipelineBuilder&, |
| + const GrProcOptInfo& colorPOI, |
| + const GrProcOptInfo& coveragePOI, |
| GrDeviceCoordTexture* dstCopy, |
| const SkRect* drawBounds); |
| + struct PipelineInfo { |
| + PipelineInfo(GrPipelineBuilder* pipelineBuilder, GrScissorState* scissor, |
|
bsalomon
2015/02/12 21:39:26
can we bury these constructors in the cpp?
|
| + const GrPrimitiveProcessor* primProc, const SkRect* devBounds, |
| + GrDrawTarget* target) |
| + : fPipelineBuilder(pipelineBuilder) |
| + , fScissor(scissor) { |
| + fColorPOI = fPipelineBuilder->colorProcInfo(primProc); |
| + fCoveragePOI = fPipelineBuilder->coverageProcInfo(primProc); |
| + if (!target->setupDstReadIfNecessary(*fPipelineBuilder, fColorPOI, fCoveragePOI, |
| + &fDstCopy, devBounds)) { |
| + fPipelineBuilder = NULL; |
| + } |
| + } |
| + |
| + PipelineInfo(GrPipelineBuilder* pipelineBuilder, GrScissorState* scissor, |
| + const GrBatch* batch, const SkRect* devBounds, |
| + GrDrawTarget* target) |
| + : fPipelineBuilder(pipelineBuilder) |
| + , fScissor(scissor) { |
| + fColorPOI = fPipelineBuilder->colorProcInfo(batch); |
| + fCoveragePOI = fPipelineBuilder->coverageProcInfo(batch); |
| + if (!target->setupDstReadIfNecessary(*fPipelineBuilder, fColorPOI, fCoveragePOI, |
| + &fDstCopy, devBounds)) { |
| + fPipelineBuilder = NULL; |
| + } |
| + } |
| + |
| + bool willBlendWithDst(const GrPrimitiveProcessor* primProc) const { |
| + return fPipelineBuilder->willBlendWithDst(primProc); |
| + } |
| + private: |
| + friend class GrDrawTarget; |
| + |
| + bool mustSkipDraw() const { return (NULL == fPipelineBuilder); } |
| + |
| + GrPipelineBuilder* fPipelineBuilder; |
| + GrScissorState* fScissor; |
| + GrProcOptInfo fColorPOI; |
| + GrProcOptInfo fCoveragePOI; |
| + GrDeviceCoordTexture fDstCopy; |
| + }; |
| + |
| + void setupPipeline(const PipelineInfo& pipelineInfo, GrPipeline* pipeline); |
| private: |
|
bsalomon
2015/02/12 21:39:26
\n
|
| /** |
| * This will be called before allocating a texture as a dst for copySurface. This function |
| @@ -717,14 +763,11 @@ private: |
| virtual void geometrySourceWillPush() = 0; |
| virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) = 0; |
| // subclass called to perform drawing |
| - virtual void onDraw(const GrPipelineBuilder&, |
| - const GrGeometryProcessor*, |
| + virtual void onDraw(const GrGeometryProcessor*, |
| const DrawInfo&, |
| - const GrScissorState&) = 0; |
| + const PipelineInfo&) = 0; |
| virtual void onDrawBatch(GrBatch*, |
| - const GrPipelineBuilder&, |
| - const GrScissorState&, |
| - const SkRect* devBounds) = 0; |
| + const PipelineInfo&) = 0; |
| // TODO copy in order drawbuffer onDrawRect to here |
| virtual void onDrawRect(GrPipelineBuilder*, |
| GrColor color, |
| @@ -738,23 +781,19 @@ private: |
| const GrPath*, |
| const GrScissorState&, |
| const GrStencilSettings&) = 0; |
| - virtual void onDrawPath(const GrPipelineBuilder&, |
| - const GrPathProcessor*, |
| + virtual void onDrawPath(const GrPathProcessor*, |
| const GrPath*, |
| - const GrScissorState&, |
| const GrStencilSettings&, |
| - const SkRect* devBounds) = 0; |
| - virtual void onDrawPaths(const GrPipelineBuilder&, |
| - const GrPathProcessor*, |
| + const PipelineInfo&) = 0; |
| + virtual void onDrawPaths(const GrPathProcessor*, |
| const GrPathRange*, |
| const void* indices, |
| PathIndexType, |
| const float transformValues[], |
| PathTransformType, |
| int count, |
| - const GrScissorState&, |
| const GrStencilSettings&, |
| - const SkRect* devBounds) = 0; |
| + const PipelineInfo&) = 0; |
| virtual void onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect, |
| GrRenderTarget* renderTarget) = 0; |