diff options
author | 2012-08-02 14:26:43 +0000 | |
---|---|---|
committer | 2012-08-02 14:26:43 +0000 | |
commit | c8d640b1788822a8697816b645c327383a1d1f20 (patch) | |
tree | b921a8de02e02fccf240404a9fcf7fb78b8885e4 /src/core/SkEdgeBuilder.h | |
parent | bc7ef5a783c612d8bc391b8fa90767bb1d1c59e2 (diff) |
special-case edge-building for polygons (paths with only lines)
makes the dashing bench faster (from 13.4 -> 11.5 ticks)
Review URL: https://codereview.appspot.com/6449080
git-svn-id: http://skia.googlecode.com/svn/trunk@4916 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkEdgeBuilder.h')
-rw-r--r-- | src/core/SkEdgeBuilder.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/core/SkEdgeBuilder.h b/src/core/SkEdgeBuilder.h index ae21f05b31..714e2b9c86 100644 --- a/src/core/SkEdgeBuilder.h +++ b/src/core/SkEdgeBuilder.h @@ -20,19 +20,32 @@ class SkEdgeBuilder { public: SkEdgeBuilder(); + // returns the number of built edges. The array of those edge pointers + // is returned from edgeList(). int build(const SkPath& path, const SkIRect* clip, int shiftUp); - - SkEdge** edgeList() { return fList.begin(); } - + + SkEdge** edgeList() { return fEdgeList; } + private: SkChunkAlloc fAlloc; SkTDArray<SkEdge*> fList; - int fShiftUp; + + /* + * If we're in general mode, we allcoate the pointers in fList, and this + * will point at fList.begin(). If we're in polygon mode, fList will be + * empty, as we will have preallocated room for the pointers in fAlloc's + * block, and fEdgeList will point into that. + */ + SkEdge** fEdgeList; + int fShiftUp; + void addLine(const SkPoint pts[]); void addQuad(const SkPoint pts[]); void addCubic(const SkPoint pts[]); void addClipper(SkEdgeClipper*); + + int buildPoly(const SkPath& path, const SkIRect* clip, int shiftUp); }; #endif |