diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-09 14:11:33 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-09 14:11:33 +0000 |
commit | c4dc0ad8e252a7e30d19b47d3d0d9f2c69faf854 (patch) | |
tree | 305c63cae824c4d5ae904a7c19c9785f601a7b72 /src/gpu/GrInOrderDrawBuffer.cpp | |
parent | 6ec1abf21e752abcca33ce3f95e31bc9ac9bb9eb (diff) |
Implement filling a path with nv_path_rendering cover
Implement filling a path with nv_path_rendering cover functionality.
The nv_path_rendering cover can be used if the fill is non-inverted
and the draw operation does not require use of vertex shaders.
Moves code for the inverted fill from GrStencilAndCoverPathRenderer
down to GrGpuGL.
R=bsalomon@google.com, markkilgard@gmail.com, cdalton@nvidia.com
Author: kkinnunen@nvidia.com
Review URL: https://codereview.chromium.org/22686002
git-svn-id: http://skia.googlecode.com/svn/trunk@11667 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrInOrderDrawBuffer.cpp')
-rw-r--r-- | src/gpu/GrInOrderDrawBuffer.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp index 8c8fbfc4ce..dbbdf163e6 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(); |