OLD | NEW |
---|---|
1 | 1 |
2 //---------------------------------------------------------------------------- | 2 //---------------------------------------------------------------------------- |
3 // Anti-Grain Geometry - Version 2.3 | 3 // Anti-Grain Geometry - Version 2.3 |
4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) | 4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) |
5 // | 5 // |
6 // Permission to copy, use, modify, sell and distribute this software | 6 // Permission to copy, use, modify, sell and distribute this software |
7 // is granted provided this copyright notice appears in all copies. | 7 // is granted provided this copyright notice appears in all copies. |
8 // This software is provided "as is" without express or implied | 8 // This software is provided "as is" without express or implied |
9 // warranty, and with no claim as to its suitability for any purpose. | 9 // warranty, and with no claim as to its suitability for any purpose. |
10 // | 10 // |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 deltax = (x1 > clip_box.x1) ? -nearzero : nearzero; | 43 deltax = (x1 > clip_box.x1) ? -nearzero : nearzero; |
44 } | 44 } |
45 FX_FLOAT xin, xout; | 45 FX_FLOAT xin, xout; |
46 if(deltax > 0) { | 46 if(deltax > 0) { |
47 xin = (FX_FLOAT)clip_box.x1; | 47 xin = (FX_FLOAT)clip_box.x1; |
48 xout = (FX_FLOAT)clip_box.x2; | 48 xout = (FX_FLOAT)clip_box.x2; |
49 } else { | 49 } else { |
50 xin = (FX_FLOAT)clip_box.x2; | 50 xin = (FX_FLOAT)clip_box.x2; |
51 xout = (FX_FLOAT)clip_box.x1; | 51 xout = (FX_FLOAT)clip_box.x1; |
52 } | 52 } |
53 FX_FLOAT tinx = FXSYS_Div(xin - x1, deltax); | 53 FX_FLOAT tinx = (xin - x1) / deltax; |
54 if(deltay == 0) { | 54 if(deltay == 0) { |
55 deltay = (y1 > clip_box.y1) ? -nearzero : nearzero; | 55 deltay = (y1 > clip_box.y1) ? -nearzero : nearzero; |
56 } | 56 } |
57 FX_FLOAT yin, yout; | 57 FX_FLOAT yin, yout; |
58 if(deltay > 0) { | 58 if(deltay > 0) { |
59 yin = (FX_FLOAT)clip_box.y1; | 59 yin = (FX_FLOAT)clip_box.y1; |
60 yout = (FX_FLOAT)clip_box.y2; | 60 yout = (FX_FLOAT)clip_box.y2; |
61 } else { | 61 } else { |
62 yin = (FX_FLOAT)clip_box.y2; | 62 yin = (FX_FLOAT)clip_box.y2; |
63 yout = (FX_FLOAT)clip_box.y1; | 63 yout = (FX_FLOAT)clip_box.y1; |
64 } | 64 } |
65 FX_FLOAT tiny = FXSYS_Div(yin - y1, deltay); | 65 FX_FLOAT tiny = (yin - y1) / deltay; |
66 FX_FLOAT tin1, tin2; | 66 FX_FLOAT tin1, tin2; |
67 if (tinx < tiny) { | 67 if (tinx < tiny) { |
68 tin1 = tinx; | 68 tin1 = tinx; |
69 tin2 = tiny; | 69 tin2 = tiny; |
70 } else { | 70 } else { |
71 tin1 = tiny; | 71 tin1 = tiny; |
72 tin2 = tinx; | 72 tin2 = tinx; |
73 } | 73 } |
74 if(tin1 <= 1.0f) { | 74 if(tin1 <= 1.0f) { |
75 if(0 < tin1) { | 75 if(0 < tin1) { |
76 *x++ = (T)xin; | 76 *x++ = (T)xin; |
77 *y++ = (T)yin; | 77 *y++ = (T)yin; |
78 ++np; | 78 ++np; |
79 } | 79 } |
80 if(tin2 <= 1.0f) { | 80 if(tin2 <= 1.0f) { |
81 FX_FLOAT toutx = FXSYS_Div(xout - x1, deltax); | 81 FX_FLOAT toutx = (xout - x1) / deltax; |
Lei Zhang
2016/02/23 20:48:21
More mixed indentation
dsinclair
2016/02/23 21:04:16
Made it not mixed, but it's still wrong. The whole
| |
82 FX_FLOAT touty = FXSYS_Div(yout - y1, deltay); | 82 FX_FLOAT touty = (yout - y1) / deltay; |
83 FX_FLOAT tout1 = (toutx < touty) ? toutx : touty; | 83 FX_FLOAT tout1 = (toutx < touty) ? toutx : touty; |
84 if(tin2 > 0 || tout1 > 0) { | 84 if(tin2 > 0 || tout1 > 0) { |
85 if(tin2 <= tout1) { | 85 if(tin2 <= tout1) { |
86 if(tin2 > 0) { | 86 if(tin2 > 0) { |
87 if(tinx > tiny) { | 87 if(tinx > tiny) { |
88 *x++ = (T)xin; | 88 *x++ = (T)xin; |
89 *y++ = (T)(y1 + (deltay * tinx)); | 89 *y++ = (T)(y1 + (deltay * tinx)); |
90 } else { | 90 } else { |
91 *x++ = (T)(x1 + (deltax * tiny)); | 91 *x++ = (T)(x1 + (deltax * tiny)); |
92 *y++ = (T)yin; | 92 *y++ = (T)yin; |
(...skipping 23 matching lines...) Expand all Loading... | |
116 } | 116 } |
117 ++np; | 117 ++np; |
118 } | 118 } |
119 } | 119 } |
120 } | 120 } |
121 } | 121 } |
122 return np; | 122 return np; |
123 } | 123 } |
124 } | 124 } |
125 #endif | 125 #endif |
OLD | NEW |