• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Index: sgl/SkEdge.cpp
2===================================================================
3--- sgl/SkEdge.cpp	(revision 42965)
4+++ sgl/SkEdge.cpp	(working copy)
5@@ -17,6 +17,7 @@
6
7 #include "SkEdge.h"
8 #include "SkFDot6.h"
9+#include <limits>
10
11 /*
12     In setLine, setQuadratic, setCubic, the first thing we do is to convert
13@@ -76,8 +77,23 @@
14
15     fX          = SkFDot6ToFixed(x0 + SkFixedMul(slope, (32 - y0) & 63));   // + SK_Fixed1/2
16     fDX         = slope;
17-    fFirstY     = SkToS16(top);
18-    fLastY      = SkToS16(bot - 1);
19+    fFirstY     = (int16_t)(top);       // inlined skToS16()
20+    if (top != (long)fFirstY) {
21+        if (fFirstY < top) {
22+            fFirstY = std::numeric_limits<int16_t>::max();
23+        } else {
24+            fFirstY = std::numeric_limits<int16_t>::min();
25+        }
26+        fX -= fDX * (top - (long)fFirstY);
27+    }
28+    fLastY      = (int16_t)(bot - 1);   // inlined SkToS16()
29+    if (bot-1 != (long)fLastY) {
30+        if (fLastY < bot-1) {
31+            fLastY = std::numeric_limits<int16_t>::max();
32+        } else {
33+            fLastY = std::numeric_limits<int16_t>::min();
34+        }
35+    }
36     fCurveCount = 0;
37     fWinding    = SkToS8(winding);
38     fCurveShift = 0;
39