+ apply formatting
This commit is contained in:
parent
918174c127
commit
6d0caf88f5
1 changed files with 256 additions and 256 deletions
84
deps/agg/include/agg_conv_clipper.h
vendored
84
deps/agg/include/agg_conv_clipper.h
vendored
|
@ -22,18 +22,18 @@
|
||||||
|
|
||||||
namespace agg
|
namespace agg
|
||||||
{
|
{
|
||||||
enum clipper_op_e { clipper_or,
|
enum clipper_op_e { clipper_or,
|
||||||
clipper_and, clipper_xor, clipper_a_minus_b, clipper_b_minus_a };
|
clipper_and, clipper_xor, clipper_a_minus_b, clipper_b_minus_a };
|
||||||
enum clipper_PolyFillType {clipper_even_odd, clipper_non_zero, clipper_positive, clipper_negative};
|
enum clipper_PolyFillType {clipper_even_odd, clipper_non_zero, clipper_positive, clipper_negative};
|
||||||
|
|
||||||
template<class VSA, class VSB> class conv_clipper
|
template<class VSA, class VSB> class conv_clipper
|
||||||
{
|
{
|
||||||
enum status { status_move_to, status_line_to, status_stop };
|
enum status { status_move_to, status_line_to, status_stop };
|
||||||
typedef VSA source_a_type;
|
typedef VSA source_a_type;
|
||||||
typedef VSB source_b_type;
|
typedef VSB source_b_type;
|
||||||
typedef conv_clipper<source_a_type, source_b_type> self_type;
|
typedef conv_clipper<source_a_type, source_b_type> self_type;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
source_a_type* m_src_a;
|
source_a_type* m_src_a;
|
||||||
source_b_type* m_src_b;
|
source_b_type* m_src_b;
|
||||||
status m_status;
|
status m_status;
|
||||||
|
@ -56,7 +56,7 @@ namespace agg
|
||||||
if ((val < 0)) return (int)(val - 0.5); else return (int)(val + 0.5);
|
if ((val < 0)) return (int)(val - 0.5); else return (int)(val + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
conv_clipper(source_a_type &a, source_b_type &b,
|
conv_clipper(source_a_type &a, source_b_type &b,
|
||||||
clipper_op_e op = clipper_or,
|
clipper_op_e op = clipper_or,
|
||||||
clipper_PolyFillType subjFillType = clipper_even_odd,
|
clipper_PolyFillType subjFillType = clipper_even_odd,
|
||||||
|
@ -149,22 +149,22 @@ namespace agg
|
||||||
}
|
}
|
||||||
end_contour(p);
|
end_contour(p);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
template<class VSA, class VSB>
|
template<class VSA, class VSB>
|
||||||
void conv_clipper<VSA, VSB>::start_extracting()
|
void conv_clipper<VSA, VSB>::start_extracting()
|
||||||
{
|
{
|
||||||
m_status = status_move_to;
|
m_status = status_move_to;
|
||||||
m_contour = -1;
|
m_contour = -1;
|
||||||
m_vertex = -1;
|
m_vertex = -1;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
template<class VSA, class VSB>
|
template<class VSA, class VSB>
|
||||||
void conv_clipper<VSA, VSB>::rewind(unsigned path_id)
|
void conv_clipper<VSA, VSB>::rewind(unsigned path_id)
|
||||||
{
|
{
|
||||||
m_src_a->rewind( path_id );
|
m_src_a->rewind( path_id );
|
||||||
m_src_b->rewind( path_id );
|
m_src_b->rewind( path_id );
|
||||||
|
|
||||||
|
@ -227,12 +227,12 @@ namespace agg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
start_extracting();
|
start_extracting();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
template<class VSA, class VSB>
|
template<class VSA, class VSB>
|
||||||
void conv_clipper<VSA, VSB>::end_contour( ClipperLib::Polygons &p)
|
void conv_clipper<VSA, VSB>::end_contour( ClipperLib::Polygons &p)
|
||||||
{
|
{
|
||||||
unsigned i, len;
|
unsigned i, len;
|
||||||
|
|
||||||
if( m_vertex_accumulator.size() < 3 ) return;
|
if( m_vertex_accumulator.size() < 3 ) return;
|
||||||
|
@ -242,46 +242,46 @@ namespace agg
|
||||||
for( i = 0 ; i < m_vertex_accumulator.size() ; i++ )
|
for( i = 0 ; i < m_vertex_accumulator.size() ; i++ )
|
||||||
p[len][i] = m_vertex_accumulator[i];
|
p[len][i] = m_vertex_accumulator[i];
|
||||||
m_vertex_accumulator.remove_all();
|
m_vertex_accumulator.remove_all();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
template<class VSA, class VSB>
|
template<class VSA, class VSB>
|
||||||
void conv_clipper<VSA, VSB>::add_vertex_(double &x, double &y)
|
void conv_clipper<VSA, VSB>::add_vertex_(double &x, double &y)
|
||||||
{
|
{
|
||||||
ClipperLib::IntPoint v;
|
ClipperLib::IntPoint v;
|
||||||
|
|
||||||
v.X = Round(x * m_scaling_factor);
|
v.X = Round(x * m_scaling_factor);
|
||||||
v.Y = Round(y * m_scaling_factor);
|
v.Y = Round(y * m_scaling_factor);
|
||||||
m_vertex_accumulator.add( v );
|
m_vertex_accumulator.add( v );
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
template<class VSA, class VSB>
|
template<class VSA, class VSB>
|
||||||
bool conv_clipper<VSA, VSB>::next_contour()
|
bool conv_clipper<VSA, VSB>::next_contour()
|
||||||
{
|
{
|
||||||
m_contour++;
|
m_contour++;
|
||||||
if(m_contour >= (int)m_result.size()) return false;
|
if(m_contour >= (int)m_result.size()) return false;
|
||||||
m_vertex =-1;
|
m_vertex =-1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
template<class VSA, class VSB>
|
template<class VSA, class VSB>
|
||||||
bool conv_clipper<VSA, VSB>::next_vertex(double *x, double *y)
|
bool conv_clipper<VSA, VSB>::next_vertex(double *x, double *y)
|
||||||
{
|
{
|
||||||
m_vertex++;
|
m_vertex++;
|
||||||
if(m_vertex >= (int)m_result[m_contour].size()) return false;
|
if(m_vertex >= (int)m_result[m_contour].size()) return false;
|
||||||
*x = (double)m_result[ m_contour ][ m_vertex ].X / m_scaling_factor;
|
*x = (double)m_result[ m_contour ][ m_vertex ].X / m_scaling_factor;
|
||||||
*y = (double)m_result[ m_contour ][ m_vertex ].Y / m_scaling_factor;
|
*y = (double)m_result[ m_contour ][ m_vertex ].Y / m_scaling_factor;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
if( m_status == status_move_to )
|
if( m_status == status_move_to )
|
||||||
{
|
{
|
||||||
if( next_contour() )
|
if( next_contour() )
|
||||||
|
@ -318,7 +318,7 @@ namespace agg
|
||||||
return path_cmd_end_poly | path_flags_close;
|
return path_cmd_end_poly | path_flags_close;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue