diff options
Diffstat (limited to 'third_party/agg23/agg_curves.cpp')
-rw-r--r-- | third_party/agg23/agg_curves.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/third_party/agg23/agg_curves.cpp b/third_party/agg23/agg_curves.cpp index b86cf630c3..4bfe457817 100644 --- a/third_party/agg23/agg_curves.cpp +++ b/third_party/agg23/agg_curves.cpp @@ -25,12 +25,12 @@ namespace agg { -const FX_FLOAT curve_collinearity_epsilon = 1e-30f; +const float curve_collinearity_epsilon = 1e-30f; enum curve_recursion_limit_e { curve_recursion_limit = 16 }; -void curve4_div::init(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x3, FX_FLOAT y3, - FX_FLOAT x4, FX_FLOAT y4) +void curve4_div::init(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { m_points.remove_all(); m_distance_tolerance_square = 1.0f / 4; @@ -38,31 +38,31 @@ void curve4_div::init(FX_FLOAT x1, FX_FLOAT y1, bezier(x1, y1, x2, y2, x3, y3, x4, y4); m_count = 0; } -void curve4_div::recursive_bezier(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x3, FX_FLOAT y3, - FX_FLOAT x4, FX_FLOAT y4, +void curve4_div::recursive_bezier(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4, unsigned level) { if(level > curve_recursion_limit) { return; } - FX_FLOAT x12 = (x1 + x2) / 2; - FX_FLOAT y12 = (y1 + y2) / 2; - FX_FLOAT x23 = (x2 + x3) / 2; - FX_FLOAT y23 = (y2 + y3) / 2; - FX_FLOAT x34 = (x3 + x4) / 2; - FX_FLOAT y34 = (y3 + y4) / 2; - FX_FLOAT x123 = (x12 + x23) / 2; - FX_FLOAT y123 = (y12 + y23) / 2; - FX_FLOAT x234 = (x23 + x34) / 2; - FX_FLOAT y234 = (y23 + y34) / 2; - FX_FLOAT x1234 = (x123 + x234) / 2; - FX_FLOAT y1234 = (y123 + y234) / 2; - FX_FLOAT dx = x4 - x1; - FX_FLOAT dy = y4 - y1; - FX_FLOAT d2 = FXSYS_fabs(((x2 - x4) * dy) - ((y2 - y4) * dx)); - FX_FLOAT d3 = FXSYS_fabs(((x3 - x4) * dy) - ((y3 - y4) * dx)); + float x12 = (x1 + x2) / 2; + float y12 = (y1 + y2) / 2; + float x23 = (x2 + x3) / 2; + float y23 = (y2 + y3) / 2; + float x34 = (x3 + x4) / 2; + float y34 = (y3 + y4) / 2; + float x123 = (x12 + x23) / 2; + float y123 = (y12 + y23) / 2; + float x234 = (x23 + x34) / 2; + float y234 = (y23 + y34) / 2; + float x1234 = (x123 + x234) / 2; + float y1234 = (y123 + y234) / 2; + float dx = x4 - x1; + float dy = y4 - y1; + float d2 = FXSYS_fabs(((x2 - x4) * dy) - ((y2 - y4) * dx)); + float d3 = FXSYS_fabs(((x3 - x4) * dy) - ((y3 - y4) * dx)); switch((int(d2 > curve_collinearity_epsilon) << 1) + int(d3 > curve_collinearity_epsilon)) { case 0: @@ -99,10 +99,10 @@ void curve4_div::recursive_bezier(FX_FLOAT x1, FX_FLOAT y1, recursive_bezier(x1, y1, x12, y12, x123, y123, x1234, y1234, level + 1); recursive_bezier(x1234, y1234, x234, y234, x34, y34, x4, y4, level + 1); } -void curve4_div::bezier(FX_FLOAT x1, FX_FLOAT y1, - FX_FLOAT x2, FX_FLOAT y2, - FX_FLOAT x3, FX_FLOAT y3, - FX_FLOAT x4, FX_FLOAT y4) +void curve4_div::bezier(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { m_points.add(point_type(x1, y1)); recursive_bezier(x1, y1, x2, y2, x3, y3, x4, y4, 0); |