Index: src/gpu/GrInOrderDrawBuffer.cpp |
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp |
index 8c8fbfc4cec19bf2683324b897f8fe8b919d493c..dbbdf163e616cf6fdab64281d0fc8db392bde800 100644 |
--- a/src/gpu/GrInOrderDrawBuffer.cpp |
+++ b/src/gpu/GrInOrderDrawBuffer.cpp |
@@ -385,6 +385,7 @@ void GrInOrderDrawBuffer::onDraw(const DrawInfo& info) { |
} |
GrInOrderDrawBuffer::StencilPath::StencilPath() : fStroke(SkStrokeRec::kFill_InitStyle) {} |
+GrInOrderDrawBuffer::FillPath::FillPath() : fStroke(SkStrokeRec::kFill_InitStyle) {} |
void GrInOrderDrawBuffer::onStencilPath(const GrPath* path, const SkStrokeRec& stroke, |
SkPath::FillType fill) { |
@@ -402,6 +403,25 @@ void GrInOrderDrawBuffer::onStencilPath(const GrPath* path, const SkStrokeRec& s |
sp->fStroke = stroke; |
} |
+void GrInOrderDrawBuffer::onFillPath(const GrPath* path, const SkStrokeRec& stroke, |
+ SkPath::FillType fill, const GrDeviceCoordTexture* dstCopy) { |
+ if (this->needsNewClip()) { |
+ this->recordClip(); |
+ } |
+ // TODO: Only compare the subset of GrDrawState relevant to path covering? |
+ if (this->needsNewState()) { |
+ this->recordState(); |
+ } |
+ FillPath* cp = this->recordFillPath(); |
+ cp->fPath.reset(path); |
+ path->ref(); |
+ cp->fFill = fill; |
+ cp->fStroke = stroke; |
+ if (NULL != dstCopy) { |
+ cp->fDstCopy = *dstCopy; |
+ } |
+} |
+ |
void GrInOrderDrawBuffer::clear(const SkIRect* rect, GrColor color, GrRenderTarget* renderTarget) { |
SkIRect r; |
if (NULL == renderTarget) { |
@@ -436,6 +456,7 @@ void GrInOrderDrawBuffer::reset() { |
fCmds.reset(); |
fDraws.reset(); |
fStencilPaths.reset(); |
+ fFillPaths.reset(); |
fStates.reset(); |
fClears.reset(); |
fVertexPool.reset(); |
@@ -480,6 +501,7 @@ void GrInOrderDrawBuffer::flush() { |
int currClear = 0; |
int currDraw = 0; |
int currStencilPath = 0; |
+ int currFillPath = 0; |
int currCopySurface = 0; |
for (int c = 0; c < numCmds; ++c) { |
@@ -501,6 +523,13 @@ void GrInOrderDrawBuffer::flush() { |
++currStencilPath; |
break; |
} |
+ case kFillPath_Cmd: { |
+ const FillPath& cp = fFillPaths[currFillPath]; |
+ fDstGpu->executeFillPath(cp.fPath.get(), cp.fStroke, cp.fFill, |
+ NULL != cp.fDstCopy.texture() ? &cp.fDstCopy : NULL); |
+ ++currFillPath; |
+ break; |
+ } |
case kSetState_Cmd: |
fStates[currState].restoreTo(&playbackState); |
++currState; |
@@ -810,6 +839,11 @@ GrInOrderDrawBuffer::StencilPath* GrInOrderDrawBuffer::recordStencilPath() { |
return &fStencilPaths.push_back(); |
} |
+GrInOrderDrawBuffer::FillPath* GrInOrderDrawBuffer::recordFillPath() { |
+ fCmds.push_back(kFillPath_Cmd); |
+ return &fFillPaths.push_back(); |
+} |
+ |
GrInOrderDrawBuffer::Clear* GrInOrderDrawBuffer::recordClear() { |
fCmds.push_back(kClear_Cmd); |
return &fClears.push_back(); |