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
diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h
index ca6af3f..b9e5ca8 100644
--- a/src/gpu/GrInOrderDrawBuffer.h
+++ b/src/gpu/GrInOrderDrawBuffer.h
@@ -87,6 +87,7 @@
kSetClip_Cmd = 4,
kClear_Cmd = 5,
kCopySurface_Cmd = 6,
+ kFillPath_Cmd = 7,
};
class DrawRecord : public DrawInfo {
@@ -104,6 +105,15 @@
SkPath::FillType fFill;
};
+ struct FillPath : public ::SkNoncopyable {
+ FillPath();
+
+ SkAutoTUnref<const GrPath> fPath;
+ SkStrokeRec fStroke;
+ SkPath::FillType fFill;
+ GrDeviceCoordTexture fDstCopy;
+ };
+
struct Clear : public ::SkNoncopyable {
Clear() : fRenderTarget(NULL) {}
~Clear() { SkSafeUnref(fRenderTarget); }
@@ -127,6 +137,8 @@
const SkRect* localRect,
const SkMatrix* localMatrix) SK_OVERRIDE;
virtual void onStencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath::FillType) SK_OVERRIDE;
+ virtual void onFillPath(const GrPath*, const SkStrokeRec& stroke, SkPath::FillType,
+ const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE;
virtual bool onReserveVertexSpace(size_t vertexSize,
int vertexCount,
void** vertices) SK_OVERRIDE;
@@ -169,6 +181,7 @@
void recordClip();
DrawRecord* recordDraw(const DrawInfo&);
StencilPath* recordStencilPath();
+ FillPath* recordFillPath();
Clear* recordClear();
CopySurface* recordCopySurface();
@@ -177,6 +190,7 @@
kCmdPreallocCnt = 32,
kDrawPreallocCnt = 8,
kStencilPathPreallocCnt = 8,
+ kFillPathPreallocCnt = 8,
kStatePreallocCnt = 8,
kClipPreallocCnt = 8,
kClearPreallocCnt = 4,
@@ -187,6 +201,7 @@
SkSTArray<kCmdPreallocCnt, uint8_t, true> fCmds;
GrSTAllocator<kDrawPreallocCnt, DrawRecord> fDraws;
GrSTAllocator<kStatePreallocCnt, StencilPath> fStencilPaths;
+ GrSTAllocator<kStatePreallocCnt, FillPath> fFillPaths;
GrSTAllocator<kStatePreallocCnt, GrDrawState::DeferredState> fStates;
GrSTAllocator<kClearPreallocCnt, Clear> fClears;
GrSTAllocator<kCopySurfacePreallocCnt, CopySurface> fCopySurfaces;