+ initialize x,y for close_path commands

This commit is contained in:
artemp 2013-02-22 15:02:10 +00:00
parent 1b3b598b80
commit 21c618ccc5

View file

@ -48,6 +48,8 @@ namespace agg
ClipperLib::Clipper m_clipper; ClipperLib::Clipper m_clipper;
clipper_PolyFillType m_subjFillType; clipper_PolyFillType m_subjFillType;
clipper_PolyFillType m_clipFillType; clipper_PolyFillType m_clipFillType;
double start_x_;
double start_y_;
int Round(double val) int Round(double val)
{ {
@ -67,7 +69,9 @@ namespace agg
m_contour(-1), m_contour(-1),
m_operation(op), m_operation(op),
m_subjFillType(subjFillType), m_subjFillType(subjFillType),
m_clipFillType(clipFillType) m_clipFillType(clipFillType),
start_x_(0),
start_y_(0)
{ {
m_scaling_factor = std::max(std::min(scaling_factor, 6),0); m_scaling_factor = std::max(std::min(scaling_factor, 6),0);
m_scaling_factor = Round(std::pow((double)10, m_scaling_factor)); m_scaling_factor = Round(std::pow((double)10, m_scaling_factor));
@ -84,7 +88,9 @@ namespace agg
m_contour(-1), m_contour(-1),
m_operation(op), m_operation(op),
m_subjFillType(subjFillType), m_subjFillType(subjFillType),
m_clipFillType(clipFillType) m_clipFillType(clipFillType),
start_x_(0),
start_y_(0)
{ {
m_scaling_factor = std::max(std::min(scaling_factor, 6),0); m_scaling_factor = std::max(std::min(scaling_factor, 6),0);
m_scaling_factor = Round(std::pow((double)10, m_scaling_factor)); m_scaling_factor = Round(std::pow((double)10, m_scaling_factor));
@ -271,6 +277,8 @@ namespace agg
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
//------------------------------------------------------------------------------
template<class VSA, class VSB> template<class VSA, class VSB>
unsigned conv_clipper<VSA, VSB>::vertex(double *x, double *y) unsigned conv_clipper<VSA, VSB>::vertex(double *x, double *y)
{ {
@ -281,10 +289,14 @@ namespace agg
if( next_vertex( x, y ) ) if( next_vertex( x, y ) )
{ {
m_status =status_line_to; m_status =status_line_to;
start_x_ = *x;
start_y_ = *y;
return path_cmd_move_to; return path_cmd_move_to;
} }
else else
{ {
*x = start_x_;
*y = start_y_;
m_status = status_stop; m_status = status_stop;
return path_cmd_end_poly | path_flags_close; return path_cmd_end_poly | path_flags_close;
} }
@ -301,6 +313,8 @@ namespace agg
else else
{ {
m_status = status_move_to; m_status = status_move_to;
*x = start_x_;
*y = start_y_;
return path_cmd_end_poly | path_flags_close; return path_cmd_end_poly | path_flags_close;
} }
} }