Don't attempt to rasterize ARCs with very small sweep_angles, just resort to LINETO (#4112)

This commit is contained in:
Artem Pavlenko 2020-01-21 10:30:29 +00:00
parent 0420b13055
commit 4e26d2a7d6

View file

@ -22,7 +22,6 @@
#include <math.h> #include <math.h>
#include "agg_bezier_arc.h" #include "agg_bezier_arc.h"
namespace agg namespace agg
{ {
@ -221,15 +220,15 @@ void bezier_arc_svg::init(double x0, double y0,
if(v < -1.0) v = -1.0; if(v < -1.0) v = -1.0;
if(v > 1.0) v = 1.0; if(v > 1.0) v = 1.0;
double sweep_angle = sign * std::acos(v); double sweep_angle = sign * std::acos(v);
if (std::fabs(sweep_angle) < pi * 1e-6) m_radii_ok = false;
if(!sweep_flag && sweep_angle > 0) if(!sweep_flag && sweep_angle > 0)
{ {
sweep_angle -= pi * 2.0; sweep_angle -= pi * 2.0;
} }
else else if (sweep_flag && sweep_angle < 0)
if (sweep_flag && sweep_angle < 0) {
{ sweep_angle += pi * 2.0;
sweep_angle += pi * 2.0; }
}
// We can now build and transform the resulting arc // We can now build and transform the resulting arc
//------------------------ //------------------------