Index: src/gpu/GrInOrderDrawBuffer.cpp |
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp |
index 8c8fbfc4cec19bf2683324b897f8fe8b919d493c..dffdff5d4b48819b32d444efb8a79165c87b0cd6 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,22 @@ void GrInOrderDrawBuffer::onStencilPath(const GrPath* path, const SkStrokeRec& s |
sp->fStroke = stroke; |
} |
+void GrInOrderDrawBuffer::onFillPath(const GrPath* path, const SkStrokeRec& stroke, |
+ SkPath::FillType fill) { |
+ 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; |
+} |
+ |
void GrInOrderDrawBuffer::clear(const SkIRect* rect, GrColor color, GrRenderTarget* renderTarget) { |
SkIRect r; |
if (NULL == renderTarget) { |
@@ -436,6 +453,7 @@ void GrInOrderDrawBuffer::reset() { |
fCmds.reset(); |
fDraws.reset(); |
fStencilPaths.reset(); |
+ fFillPaths.reset(); |
fStates.reset(); |
fClears.reset(); |
fVertexPool.reset(); |
@@ -480,6 +498,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 +520,12 @@ void GrInOrderDrawBuffer::flush() { |
++currStencilPath; |
break; |
} |
+ case kFillPath_Cmd: { |
+ const FillPath& cp = fFillPaths[currFillPath]; |
+ fDstGpu->fillPath(cp.fPath.get(), cp.fStroke, cp.fFill); |
+ ++currFillPath; |
+ break; |
+ } |
case kSetState_Cmd: |
fStates[currState].restoreTo(&playbackState); |
++currState; |
@@ -810,6 +835,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(); |