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

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: fix a comment Created 7 years, 2 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
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.h ('k') | src/gpu/GrStencilAndCoverPathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.h ('k') | src/gpu/GrStencilAndCoverPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698