Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Unified Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 22686002: Implement path cover with nv_path_rendering (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebased to issue 23537028 Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698