Skip to content

Commit

Permalink
Reject horizontal edges in FDot6 precision
Browse files Browse the repository at this point in the history
This simplifies the slope computation because we don't have to check dy
!= 0.

BUG=skia:

Change-Id: I5c09a9217ceed65f81f9d82cb045e33a70218077
Reviewed-on: https://skia-review.googlesource.com/7180
Commit-Queue: Yuqian Li <[email protected]>
Reviewed-by: Cary Clark <[email protected]>
  • Loading branch information
liyuqian authored and Skia Commit-Bot committed Jan 18, 2017
1 parent 8461506 commit ce7e18f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/core/SkAnalyticEdge.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 147,6 @@ bool SkAnalyticEdge::setLine(const SkPoint& p0, const SkPoint& p1) {
SkFixed x1 = SkFDot6ToFixed(SkScalarToFDot6(p1.fX * multiplier)) >> accuracy;
SkFixed y1 = SnapY(SkFDot6ToFixed(SkScalarToFDot6(p1.fY * multiplier)) >> accuracy);

// are we a zero-height line?
if (y0 == y1) {
return false;
}

int winding = 1;

if (y0 > y1) {
Expand All @@ -160,12 155,19 @@ bool SkAnalyticEdge::setLine(const SkPoint& p0, const SkPoint& p1) {
winding = -1;
}

// are we a zero-height line?
#ifdef SK_SUPPORT_LEGACY_AAA
if (y0 == y1) {
return false;
}
SkFixed slope = SkFixedDiv(x1 - x0, y1 - y0);
#else
SkFDot6 dy = SkFixedToFDot6(y1 - y0);
if (dy == 0) {
return false;
}
SkFDot6 dx = SkFixedToFDot6(x1 - x0);
SkFixed slope = dy ? QuickSkFDot6Div(dx, dy) : SK_MaxS32;
SkFixed slope = QuickSkFDot6Div(dx, dy);
SkFixed absSlope = SkAbs32(slope);
#endif

Expand Down

0 comments on commit ce7e18f

Please sign in to comment.