diff options
Diffstat (limited to 'xfa/fxgraphics/cfx_path.cpp')
-rw-r--r-- | xfa/fxgraphics/cfx_path.cpp | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/xfa/fxgraphics/cfx_path.cpp b/xfa/fxgraphics/cfx_path.cpp index d56eb13f67..5ff9bffb07 100644 --- a/xfa/fxgraphics/cfx_path.cpp +++ b/xfa/fxgraphics/cfx_path.cpp @@ -39,8 +39,8 @@ void CFX_Path::BezierTo(const CFX_PointF& c1, void CFX_Path::ArcTo(const CFX_PointF& pos, const CFX_SizeF& size, - FX_FLOAT start_angle, - FX_FLOAT sweep_angle) { + float start_angle, + float sweep_angle) { CFX_SizeF new_size = size / 2.0f; ArcToInternal(CFX_PointF(pos.x + new_size.width, pos.y + new_size.height), new_size, start_angle, sweep_angle); @@ -48,16 +48,16 @@ void CFX_Path::ArcTo(const CFX_PointF& pos, void CFX_Path::ArcToInternal(const CFX_PointF& pos, const CFX_SizeF& size, - FX_FLOAT start_angle, - FX_FLOAT sweep_angle) { - FX_FLOAT x0 = FXSYS_cos(sweep_angle / 2); - FX_FLOAT y0 = FXSYS_sin(sweep_angle / 2); - FX_FLOAT tx = ((1.0f - x0) * 4) / (3 * 1.0f); - FX_FLOAT ty = y0 - ((tx * x0) / y0); + float start_angle, + float sweep_angle) { + float x0 = FXSYS_cos(sweep_angle / 2); + float y0 = FXSYS_sin(sweep_angle / 2); + float tx = ((1.0f - x0) * 4) / (3 * 1.0f); + float ty = y0 - ((tx * x0) / y0); CFX_PointF points[] = {CFX_PointF(x0 + tx, -ty), CFX_PointF(x0 + tx, ty)}; - FX_FLOAT sn = FXSYS_sin(start_angle + sweep_angle / 2); - FX_FLOAT cs = FXSYS_cos(start_angle + sweep_angle / 2); + float sn = FXSYS_sin(start_angle + sweep_angle / 2); + float cs = FXSYS_cos(start_angle + sweep_angle / 2); CFX_PointF bezier; bezier.x = pos.x + (size.width * ((points[0].x * cs) - (points[0].y * sn))); @@ -78,10 +78,7 @@ void CFX_Path::AddLine(const CFX_PointF& p1, const CFX_PointF& p2) { data_.AppendPoint(p2, FXPT_TYPE::LineTo, false); } -void CFX_Path::AddRectangle(FX_FLOAT left, - FX_FLOAT top, - FX_FLOAT width, - FX_FLOAT height) { +void CFX_Path::AddRectangle(float left, float top, float width, float height) { data_.AppendRect(left, top, left + width, top + height); } @@ -91,12 +88,12 @@ void CFX_Path::AddEllipse(const CFX_RectF& rect) { void CFX_Path::AddArc(const CFX_PointF& original_pos, const CFX_SizeF& original_size, - FX_FLOAT start_angle, - FX_FLOAT sweep_angle) { + float start_angle, + float sweep_angle) { if (sweep_angle == 0) return; - const FX_FLOAT bezier_arc_angle_epsilon = 0.01f; + const float bezier_arc_angle_epsilon = 0.01f; while (start_angle > FX_PI * 2) start_angle -= FX_PI * 2; while (start_angle < 0) @@ -112,9 +109,9 @@ void CFX_Path::AddArc(const CFX_PointF& original_pos, size.height * FXSYS_sin(start_angle)), FXPT_TYPE::MoveTo, false); - FX_FLOAT total_sweep = 0; - FX_FLOAT local_sweep = 0; - FX_FLOAT prev_sweep = 0; + float total_sweep = 0; + float local_sweep = 0; + float prev_sweep = 0; bool done = false; do { if (sweep_angle < 0) { |