aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkEdgeBuilder.h
diff options
context:
space:
mode:
authorGravatar Yuqian Li <liyuqian@google.com>2017-08-08 14:00:52 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-09 21:05:35 +0000
commit5eb8fc585e9b3c9ccc82b0921986e1020ddaff23 (patch)
tree4ebfe1a26d0bd2fc0eb7c27e3fc8581af46777ef /src/core/SkEdgeBuilder.h
parent0f450acd76fd58a2f7464f99869ed6afbfac303c (diff)
No chop at y extrema for cubics
The new Delta AA scan converter does not need the edge to be updated with monotonic Y so chopping at y extrema is not necessary. Removing such chopping brings ~10% performance increase to chalkboard.svg which has tons of small cubics (the same is true for many svgs I saw). We didn't remove the chopping for quads because that does not bring a significant speedup. Moreover, dropping those y extremas would make our strokecircle animation look a little more wobbly (because we would have fewer divisions for the quads at the top and bottom of the circle). Bug: skia: Change-Id: I3984d2619f9f77269ed24e8cbfa9f1429ebca4a8 Reviewed-on: https://skia-review.googlesource.com/31940 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Yuqian Li <liyuqian@google.com>
Diffstat (limited to 'src/core/SkEdgeBuilder.h')
-rw-r--r--src/core/SkEdgeBuilder.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/SkEdgeBuilder.h b/src/core/SkEdgeBuilder.h
index b876fcf5e5..a549e15681 100644
--- a/src/core/SkEdgeBuilder.h
+++ b/src/core/SkEdgeBuilder.h
@@ -21,8 +21,19 @@ class SkPath;
class SkEdgeBuilder {
public:
enum EdgeType {
+ // Used in supersampling or non-AA scan coverter; it stores only integral y coordinates.
kEdge,
+
+ // Used in Analytic AA scan converter; it uses SkFixed to store fractional y.
kAnalyticEdge,
+
+ // Used in Delta AA scan converter; it's a super-light wrapper of SkPoint, which can then be
+ // used to construct SkAnalyticEdge (kAnalyticEdge) later. We use kBezier to save the memory
+ // allocation time (a SkBezier is much lighter than SkAnalyticEdge or SkEdge). Note that
+ // Delta AA only has to deal with one SkAnalyticEdge at a time (whereas Analytic AA has to
+ // deal with all SkAnalyticEdges at the same time). Thus for Delta AA, we only need to
+ // allocate memory for n SkBeziers and 1 SkAnalyticEdge. (Analytic AA need to allocate
+ // memory for n SkAnalyticEdges.)
kBezier
};
@@ -76,6 +87,8 @@ public:
void addCubic(const SkPoint pts[]);
void addClipper(SkEdgeClipper*);
+ EdgeType edgeType() const { return fEdgeType; }
+
int buildPoly(const SkPath& path, const SkIRect* clip, int shiftUp, bool clipToTheRight);
inline void addPolyLine(SkPoint pts[], char* &edge, size_t edgeSize, char** &edgePtr,