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
diff --git a/src/core/SkEdgeBuilder.h b/src/core/SkEdgeBuilder.h
index ae21f05..714e2b9 100644
--- a/src/core/SkEdgeBuilder.h
+++ b/src/core/SkEdgeBuilder.h
@@ -20,19 +20,32 @@
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