Index: src/gpu/GrInOrderDrawBuffer.cpp |
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp |
index 1cd04d9e1b41dd996d0b2d179bf81531e3d4763d..5f07296ab2a92318fc5fa4777cf488e02be29d4a 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::DrawPath::DrawPath() : 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::onDrawPath(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(); |
+ } |
+ DrawPath* cp = this->recordDrawPath(); |
+ 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(); |
+ fDrawPaths.reset(); |
fStates.reset(); |
fClears.reset(); |
fVertexPool.reset(); |
@@ -480,6 +498,7 @@ void GrInOrderDrawBuffer::flush() { |
int currClear = 0; |
int currDraw = 0; |
int currStencilPath = 0; |
+ int currDrawPath = 0; |
int currCopySurface = 0; |
for (int c = 0; c < numCmds; ++c) { |
@@ -501,6 +520,12 @@ void GrInOrderDrawBuffer::flush() { |
++currStencilPath; |
break; |
} |
+ case kDrawPath_Cmd: { |
+ const DrawPath& cp = fDrawPaths[currDrawPath]; |
+ fDstGpu->drawPath(cp.fPath.get(), cp.fStroke, cp.fFill); |
+ ++currDrawPath; |
+ break; |
+ } |
case kSetState_Cmd: |
fStates[currState].restoreTo(&playbackState); |
++currState; |
@@ -811,6 +836,11 @@ GrInOrderDrawBuffer::StencilPath* GrInOrderDrawBuffer::recordStencilPath() { |
return &fStencilPaths.push_back(); |
} |
+GrInOrderDrawBuffer::DrawPath* GrInOrderDrawBuffer::recordDrawPath() { |
+ fCmds.push_back(kDrawPath_Cmd); |
+ return &fDrawPaths.push_back(); |
+} |
+ |
GrInOrderDrawBuffer::Clear* GrInOrderDrawBuffer::recordClear() { |
fCmds.push_back(kClear_Cmd); |
return &fClears.push_back(); |