micro simplification/speed-up to walk_edges
- quads (conics) are more common than cubics, so check that first
- don't need to track in_internval, so remove it
Don't expect any pixel differences
Bug: skia:
Change-Id: I6a6ce3f8a0b260da66ba27bb0b0d578fb8478cea
Reviewed-on: https://skia-review.googlesource.com/c/175590
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp
index f14559a..7fdef96 100644
--- a/src/core/SkScan_Path.cpp
+++ b/src/core/SkScan_Path.cpp
@@ -109,7 +109,6 @@
for (;;) {
int w = 0;
int left SK_INIT_TO_AVOID_WARNING;
- bool in_interval = false;
SkEdge* currE = prevHead->fNext;
SkFixed prevX = prevHead->fX;
@@ -123,32 +122,34 @@
SkASSERT(currE->fLastY >= curr_y);
int x = SkFixedRoundToInt(currE->fX);
+
+ if ((w & windingMask) == 0) { // we're starting interval
+ left = x;
+ }
+
w += currE->fWinding;
+
if ((w & windingMask) == 0) { // we finished an interval
- SkASSERT(in_interval);
int width = x - left;
SkASSERT(width >= 0);
- if (width)
+ if (width > 0) {
blitter->blitH(left, curr_y, width);
- in_interval = false;
- } else if (!in_interval) {
- left = x;
- in_interval = true;
+ }
}
SkEdge* next = currE->fNext;
SkFixed newX;
if (currE->fLastY == curr_y) { // are we done with this edge?
- if (currE->fCurveCount < 0) {
- if (((SkCubicEdge*)currE)->updateCubic()) {
- SkASSERT(currE->fFirstY == curr_y + 1);
-
+ if (currE->fCurveCount > 0) {
+ if (((SkQuadraticEdge*)currE)->updateQuadratic()) {
newX = currE->fX;
goto NEXT_X;
}
- } else if (currE->fCurveCount > 0) {
- if (((SkQuadraticEdge*)currE)->updateQuadratic()) {
+ } else if (currE->fCurveCount < 0) {
+ if (((SkCubicEdge*)currE)->updateCubic()) {
+ SkASSERT(currE->fFirstY == curr_y + 1);
+
newX = currE->fX;
goto NEXT_X;
}
@@ -169,8 +170,7 @@
SkASSERT(currE);
}
- // was our right-edge culled away?
- if (in_interval) {
+ if ((w & windingMask) != 0) { // was our right-edge culled away?
int width = rightClip - left;
if (width > 0) {
blitter->blitH(left, curr_y, width);
@@ -219,14 +219,9 @@
SkEdge* riteE = leftE->fNext;
SkEdge* currE = riteE->fNext;
-#if 0
- int local_top = leftE->fFirstY;
- SkASSERT(local_top == riteE->fFirstY);
-#else
// our edge choppers for curves can result in the initial edges
// not lining up, so we take the max.
int local_top = SkMax32(leftE->fFirstY, riteE->fFirstY);
-#endif
SkASSERT(local_top >= start_y);
for (;;) {