Fix -Wdeprecated-enum-enum-conversion warnings (AGG)

This commit is contained in:
Artem Pavlenko 2022-08-04 11:25:35 +01:00
parent a9c98dff5d
commit 9627432723
16 changed files with 258 additions and 241 deletions

View file

@ -365,7 +365,7 @@ namespace agg
inline bool is_close(unsigned c)
{
return (c & ~(path_flags_cw | path_flags_ccw)) ==
(path_cmd_end_poly | path_flags_close);
(path_cmd_end_poly | static_cast<path_commands_e>(path_flags_close));
}
//------------------------------------------------------------is_next_poly

View file

@ -436,7 +436,8 @@ struct gray16
static value_type luminance(const rgba& c)
{
// Calculate grayscale value as per ITU-R BT.709.
return value_type(uround((0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b) * base_mask));
return value_type(uround((0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b)
* static_cast<double>(base_mask)));
}
static value_type luminance(const rgba16& c)
@ -537,13 +538,13 @@ struct gray16
//--------------------------------------------------------------------
static AGG_INLINE double to_double(value_type a)
{
return double(a) / base_mask;
return static_cast<double>(a) / static_cast<double>(base_mask);
}
//--------------------------------------------------------------------
static AGG_INLINE value_type from_double(double a)
{
return value_type(uround(a * base_mask));
return value_type(uround(a * static_cast<double>(base_mask)));
}
//--------------------------------------------------------------------
@ -698,7 +699,7 @@ struct gray16
self_type gradient(self_type c, double k) const
{
self_type ret;
calc_type ik = uround(k * base_scale);
calc_type ik = uround(k * static_cast<double>(base_scale));
ret.v = lerp(v, c.v, ik);
ret.a = lerp(a, c.a, ik);
return ret;
@ -949,7 +950,7 @@ struct gray32
//--------------------------------------------------------------------
static AGG_INLINE value_type mult_cover(value_type a, cover_type b)
{
return value_type(a * b / cover_mask);
return value_type(a * b / static_cast<double>(cover_mask));
}
//--------------------------------------------------------------------

View file

@ -281,10 +281,10 @@ struct rgba8T
static void convert(rgba8T<linear>& dst, const rgba& src)
{
dst.r = value_type(uround(src.r * base_mask));
dst.g = value_type(uround(src.g * base_mask));
dst.b = value_type(uround(src.b * base_mask));
dst.a = value_type(uround(src.a * base_mask));
dst.r = value_type(uround(src.r * static_cast<double>(base_mask)));
dst.g = value_type(uround(src.g * static_cast<double>(base_mask)));
dst.b = value_type(uround(src.b * static_cast<double>(base_mask)));
dst.a = value_type(uround(src.a * static_cast<double>(base_mask)));
}
static void convert(rgba8T<sRGB>& dst, const rgba& src)
@ -761,13 +761,13 @@ struct rgba16
//--------------------------------------------------------------------
static AGG_INLINE double to_double(value_type a)
{
return double(a) / base_mask;
return static_cast<double>(a) / static_cast<double>(base_mask);
}
//--------------------------------------------------------------------
static AGG_INLINE value_type from_double(double a)
{
return value_type(uround(a * base_mask));
return value_type(uround(a * static_cast<double>(base_mask)));
}
//--------------------------------------------------------------------
@ -955,7 +955,7 @@ struct rgba16
AGG_INLINE self_type gradient(const self_type& c, double k) const
{
self_type ret;
calc_type ik = uround(k * base_mask);
calc_type ik = uround(k * static_cast<double>(base_mask));
ret.r = lerp(r, c.r, ik);
ret.g = lerp(g, c.g, ik);
ret.b = lerp(b, c.b, ik);
@ -1194,7 +1194,7 @@ struct rgba32
//--------------------------------------------------------------------
static AGG_INLINE value_type mult_cover(value_type a, cover_type b)
{
return value_type(a * b / cover_mask);
return value_type(a * b / static_cast<float>(cover_mask));
}
//--------------------------------------------------------------------

View file

@ -2,8 +2,8 @@
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
@ -37,7 +37,7 @@ namespace agg
private:
conv_adaptor_vpgen(const conv_adaptor_vpgen<VertexSource, VPGen>&);
const conv_adaptor_vpgen<VertexSource, VPGen>&
const conv_adaptor_vpgen<VertexSource, VPGen>&
operator = (const conv_adaptor_vpgen<VertexSource, VPGen>&);
VertexSource* m_source;
@ -52,8 +52,8 @@ namespace agg
//------------------------------------------------------------------------
template<class VertexSource, class VPGen>
void conv_adaptor_vpgen<VertexSource, VPGen>::rewind(unsigned path_id)
{
void conv_adaptor_vpgen<VertexSource, VPGen>::rewind(unsigned path_id)
{
m_source->rewind(path_id);
m_vpgen.reset();
m_start_x = 0;
@ -84,7 +84,7 @@ namespace agg
if(m_vertices < 0)
{
if(m_vertices < -1)
if(m_vertices < -1)
{
m_vertices = 0;
return path_cmd_stop;
@ -98,12 +98,13 @@ namespace agg
cmd = m_source->vertex(&tx, &ty);
if(is_vertex(cmd))
{
if(is_move_to(cmd))
if(is_move_to(cmd))
{
if(m_vpgen.auto_close() && m_vertices > 2)
{
m_vpgen.line_to(m_start_x, m_start_y);
m_poly_flags = path_cmd_end_poly | path_flags_close;
m_poly_flags = path_cmd_end_poly
| static_cast<path_commands_e>(path_flags_close);
m_start_x = tx;
m_start_y = ty;
m_vertices = -1;
@ -114,7 +115,7 @@ namespace agg
m_start_y = ty;
m_vertices = 1;
}
else
else
{
m_vpgen.line_to(tx, ty);
++m_vertices;
@ -141,7 +142,8 @@ namespace agg
if(m_vpgen.auto_close() && m_vertices > 2)
{
m_vpgen.line_to(m_start_x, m_start_y);
m_poly_flags = path_cmd_end_poly | path_flags_close;
m_poly_flags = path_cmd_end_poly
| static_cast<path_commands_e>(path_flags_close);
m_vertices = -2;
continue;
}
@ -157,4 +159,3 @@ namespace agg
#endif

View file

@ -2,8 +2,8 @@
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
@ -22,24 +22,25 @@
#include "agg_array.h"
#include "agg_math.h"
#include <cstdint>
namespace agg
{
// See Implementation agg_image_filters.cpp
// See Implementation agg_image_filters.cpp
enum image_filter_scale_e
{
image_filter_shift = 14, //----image_filter_shift
image_filter_scale = 1 << image_filter_shift, //----image_filter_scale
image_filter_mask = image_filter_scale - 1 //----image_filter_mask
image_filter_scale = 1 << image_filter_shift, //----image_filter_scale
image_filter_mask = image_filter_scale - 1 //----image_filter_mask
};
enum image_subpixel_scale_e
{
image_subpixel_shift = 8, //----image_subpixel_shift
image_subpixel_scale = 1 << image_subpixel_shift, //----image_subpixel_scale
image_subpixel_mask = image_subpixel_scale - 1 //----image_subpixel_mask
image_subpixel_scale = 1 << image_subpixel_shift, //----image_subpixel_scale
image_subpixel_mask = image_subpixel_scale - 1 //----image_subpixel_mask
};
@ -58,12 +59,13 @@ namespace agg
{
double x = double(i) / double(image_subpixel_scale);
double y = filter.calc_weight(x);
m_weight_array[pivot + i] =
m_weight_array[pivot - i] = (int16)iround(y * image_filter_scale);
m_weight_array[pivot + i] =
m_weight_array[pivot - i] =
static_cast<std::int16_t>(iround(y * static_cast<double>(image_filter_scale)));
}
unsigned end = (diameter() << image_subpixel_shift) - 1;
m_weight_array[0] = m_weight_array[end];
if(normalization)
if(normalization)
{
normalize();
}
@ -71,7 +73,7 @@ namespace agg
image_filter_lut() : m_radius(0), m_diameter(0), m_start(0) {}
template<class FilterF> image_filter_lut(const FilterF& filter,
template<class FilterF> image_filter_lut(const FilterF& filter,
bool normalization=true)
{
calculate(filter, normalization);
@ -80,7 +82,7 @@ namespace agg
double radius() const { return m_radius; }
unsigned diameter() const { return m_diameter; }
int start() const { return m_start; }
const int16* weight_array() const { return &m_weight_array[0]; }
std::int16_t const* weight_array() const { return &m_weight_array[0]; }
void normalize();
private:
@ -91,7 +93,7 @@ namespace agg
double m_radius;
unsigned m_diameter;
int m_start;
pod_array<int16> m_weight_array;
pod_array<std::int16_t> m_weight_array;
};
@ -150,7 +152,7 @@ namespace agg
return (2.0 * x - 3.0) * x * x + 1.0;
}
};
//------------------------------------------------image_filter_quadric
struct image_filter_quadric
{
@ -177,7 +179,7 @@ namespace agg
static double calc_weight(double x)
{
return
(1.0/6.0) *
(1.0/6.0) *
(pow3(x + 2) - 4 * pow3(x + 1) + 6 * pow3(x) - 4 * pow3(x - 1));
}
};
@ -211,7 +213,7 @@ namespace agg
sum = 1.;
y = x * x / 4.;
t = y;
for(i = 2; t > epsilon; i++)
{
sum += t;
@ -298,7 +300,7 @@ namespace agg
struct image_filter_gaussian
{
static double radius() { return 2.0; }
static double calc_weight(double x)
static double calc_weight(double x)
{
return exp(-2.0 * x * x) * sqrt(2.0 / pi);
}
@ -308,7 +310,7 @@ namespace agg
//------------------------------------------------image_filter_bessel
struct image_filter_bessel
{
static double radius() { return 3.2383; }
static double radius() { return 3.2383; }
static double calc_weight(double x)
{
return (x == 0.0) ? pi / 4.0 : besj(pi * x, 1) / (2.0 * x);

View file

@ -44,13 +44,13 @@ namespace agg
//------------------------------------------------------------------line_mr
AGG_INLINE int line_mr(int x)
{
return x >> (line_subpixel_shift - line_mr_subpixel_shift);
return x >> (line_subpixel_shift - static_cast<line_subpixel_scale_e>(line_mr_subpixel_shift));
}
//-------------------------------------------------------------------line_hr
AGG_INLINE int line_hr(int x)
{
return x << (line_subpixel_shift - line_mr_subpixel_shift);
return x << (line_subpixel_shift - static_cast<line_subpixel_scale_e>(line_mr_subpixel_shift));
}
//---------------------------------------------------------------line_dbl_hr
@ -64,7 +64,7 @@ namespace agg
{
AGG_INLINE static int conv(double x)
{
return iround(x * line_subpixel_scale);
return iround(x * static_cast<double>(line_subpixel_scale));
}
};
@ -73,7 +73,7 @@ namespace agg
{
AGG_INLINE static int conv(double x)
{
return saturation<line_max_coord>::iround(x * line_subpixel_scale);
return saturation<line_max_coord>::iround(x * static_cast<double>(line_subpixel_scale));
}
};

View file

@ -2,8 +2,8 @@
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
@ -92,7 +92,7 @@ namespace agg
{
pod_allocator<T>::deallocate(
*coord_blk,
block_size * 2 +
block_size * 2 +
block_size / (sizeof(T) / sizeof(unsigned char)));
--coord_blk;
}
@ -137,7 +137,7 @@ namespace agg
//------------------------------------------------------------------------
template<class T, unsigned S, unsigned P>
const vertex_block_storage<T,S,P>&
const vertex_block_storage<T,S,P>&
vertex_block_storage<T,S,P>::operator = (const vertex_block_storage<T,S,P>& v)
{
remove_all();
@ -160,7 +160,7 @@ namespace agg
//------------------------------------------------------------------------
template<class T, unsigned S, unsigned P>
inline void vertex_block_storage<T,S,P>::add_vertex(double x, double y,
inline void vertex_block_storage<T,S,P>::add_vertex(double x, double y,
unsigned cmd)
{
T* coord_ptr = 0;
@ -172,7 +172,7 @@ namespace agg
//------------------------------------------------------------------------
template<class T, unsigned S, unsigned P>
inline void vertex_block_storage<T,S,P>::modify_vertex(unsigned idx,
inline void vertex_block_storage<T,S,P>::modify_vertex(unsigned idx,
double x, double y)
{
T* pv = m_coord_blocks[idx >> block_shift] + ((idx & block_mask) << 1);
@ -182,8 +182,8 @@ namespace agg
//------------------------------------------------------------------------
template<class T, unsigned S, unsigned P>
inline void vertex_block_storage<T,S,P>::modify_vertex(unsigned idx,
double x, double y,
inline void vertex_block_storage<T,S,P>::modify_vertex(unsigned idx,
double x, double y,
unsigned cmd)
{
unsigned block = idx >> block_shift;
@ -196,7 +196,7 @@ namespace agg
//------------------------------------------------------------------------
template<class T, unsigned S, unsigned P>
inline void vertex_block_storage<T,S,P>::modify_command(unsigned idx,
inline void vertex_block_storage<T,S,P>::modify_command(unsigned idx,
unsigned cmd)
{
m_cmd_blocks[idx >> block_shift][idx & block_mask] = (int8u)cmd;
@ -277,7 +277,7 @@ namespace agg
//------------------------------------------------------------------------
template<class T, unsigned S, unsigned P>
inline unsigned vertex_block_storage<T,S,P>::vertex(unsigned idx,
inline unsigned vertex_block_storage<T,S,P>::vertex(unsigned idx,
double* x, double* y) const
{
unsigned nb = idx >> block_shift;
@ -298,22 +298,22 @@ namespace agg
template<class T, unsigned S, unsigned P>
void vertex_block_storage<T,S,P>::allocate_block(unsigned nb)
{
if(nb >= m_max_blocks)
if(nb >= m_max_blocks)
{
T** new_coords =
T** new_coords =
pod_allocator<T*>::allocate((m_max_blocks + block_pool) * 2);
unsigned char** new_cmds =
unsigned char** new_cmds =
(unsigned char**)(new_coords + m_max_blocks + block_pool);
if(m_coord_blocks)
{
memcpy(new_coords,
m_coord_blocks,
memcpy(new_coords,
m_coord_blocks,
m_max_blocks * sizeof(T*));
memcpy(new_cmds,
m_cmd_blocks,
memcpy(new_cmds,
m_cmd_blocks,
m_max_blocks * sizeof(unsigned char*));
pod_allocator<T*>::deallocate(m_coord_blocks, m_max_blocks * 2);
@ -322,11 +322,11 @@ namespace agg
m_cmd_blocks = new_cmds;
m_max_blocks += block_pool;
}
m_coord_blocks[nb] =
pod_allocator<T>::allocate(block_size * 2 +
m_coord_blocks[nb] =
pod_allocator<T>::allocate(block_size * 2 +
block_size / (sizeof(T) / sizeof(unsigned char)));
m_cmd_blocks[nb] =
m_cmd_blocks[nb] =
(unsigned char*)(m_coord_blocks[nb] + block_size * 2);
m_total_blocks++;
@ -354,8 +354,8 @@ namespace agg
public:
typedef T value_type;
poly_plain_adaptor() :
m_data(0),
poly_plain_adaptor() :
m_data(0),
m_ptr(0),
m_end(0),
m_closed(false),
@ -363,7 +363,7 @@ namespace agg
{}
poly_plain_adaptor(const T* data, unsigned num_points, bool closed) :
m_data(data),
m_data(data),
m_ptr(data),
m_end(data + num_points * 2),
m_closed(closed),
@ -398,7 +398,8 @@ namespace agg
if(m_closed && !m_stop)
{
m_stop = true;
return path_cmd_end_poly | path_flags_close;
return path_cmd_end_poly
| static_cast<agg::path_commands_e>(path_flags_close);
}
return path_cmd_stop;
}
@ -421,15 +422,15 @@ namespace agg
public:
typedef typename Container::value_type vertex_type;
poly_container_adaptor() :
m_container(0),
poly_container_adaptor() :
m_container(0),
m_index(0),
m_closed(false),
m_stop(false)
{}
poly_container_adaptor(const Container& data, bool closed) :
m_container(&data),
m_container(&data),
m_index(0),
m_closed(closed),
m_stop(false)
@ -463,7 +464,8 @@ namespace agg
if(m_closed && !m_stop)
{
m_stop = true;
return path_cmd_end_poly | path_flags_close;
return path_cmd_end_poly
| static_cast<agg::path_commands_e>(path_flags_close);
}
return path_cmd_stop;
}
@ -483,15 +485,15 @@ namespace agg
public:
typedef typename Container::value_type vertex_type;
poly_container_reverse_adaptor() :
m_container(0),
poly_container_reverse_adaptor() :
m_container(0),
m_index(-1),
m_closed(false),
m_stop(false)
{}
poly_container_reverse_adaptor(const Container& data, bool closed) :
m_container(&data),
m_container(&data),
m_index(-1),
m_closed(closed),
m_stop(false)
@ -525,7 +527,8 @@ namespace agg
if(m_closed && !m_stop)
{
m_stop = true;
return path_cmd_end_poly | path_flags_close;
return path_cmd_end_poly
| static_cast<agg::path_commands_e>(path_flags_close);
}
return path_cmd_stop;
}
@ -556,7 +559,7 @@ namespace agg
m_coord[2] = x2;
m_coord[3] = y2;
}
void init(double x1, double y1, double x2, double y2)
{
m_coord[0] = x1;
@ -594,10 +597,10 @@ namespace agg
//---------------------------------------------------------------path_base
// A container to store vertices with their flags.
// A path consists of a number of contours separated with "move_to"
// A container to store vertices with their flags.
// A path consists of a number of contours separated with "move_to"
// commands. The path storage can keep and maintain more than one
// path.
// path.
// To navigate to the beginning of a particular path, use rewind(path_id);
// Where path_id is what start_new_path() returns. So, when you call
// start_new_path() you need to store its return value somewhere else
@ -644,28 +647,28 @@ namespace agg
bool sweep_flag,
double dx, double dy);
void curve3(double x_ctrl, double y_ctrl,
void curve3(double x_ctrl, double y_ctrl,
double x_to, double y_to);
void curve3_rel(double dx_ctrl, double dy_ctrl,
void curve3_rel(double dx_ctrl, double dy_ctrl,
double dx_to, double dy_to);
void curve3(double x_to, double y_to);
void curve3_rel(double dx_to, double dy_to);
void curve4(double x_ctrl1, double y_ctrl1,
double x_ctrl2, double y_ctrl2,
void curve4(double x_ctrl1, double y_ctrl1,
double x_ctrl2, double y_ctrl2,
double x_to, double y_to);
void curve4_rel(double dx_ctrl1, double dy_ctrl1,
double dx_ctrl2, double dy_ctrl2,
void curve4_rel(double dx_ctrl1, double dy_ctrl1,
double dx_ctrl2, double dy_ctrl2,
double dx_to, double dy_to);
void curve4(double x_ctrl2, double y_ctrl2,
void curve4(double x_ctrl2, double y_ctrl2,
double x_to, double y_to);
void curve4_rel(double x_ctrl2, double y_ctrl2,
void curve4_rel(double x_ctrl2, double y_ctrl2,
double x_to, double y_to);
@ -674,8 +677,8 @@ namespace agg
// Accessors
//--------------------------------------------------------------------
const container_type& vertices() const { return m_vertices; }
container_type& vertices() { return m_vertices; }
const container_type& vertices() const { return m_vertices; }
container_type& vertices() { return m_vertices; }
unsigned total_vertices() const;
@ -699,9 +702,9 @@ namespace agg
void rewind(unsigned path_id);
unsigned vertex(double* x, double* y);
// Arrange the orientation of a polygon, all polygons in a path,
// or in all paths. After calling arrange_orientations() or
// arrange_orientations_all_paths(), all the polygons will have
// Arrange the orientation of a polygon, all polygons in a path,
// or in all paths. After calling arrange_orientations() or
// arrange_orientations_all_paths(), all the polygons will have
// the same orientation, i.e. path_flags_cw or path_flags_ccw
//--------------------------------------------------------------------
unsigned arrange_polygon_orientation(unsigned start, path_flags_e orientation);
@ -709,7 +712,7 @@ namespace agg
void arrange_orientations_all_paths(path_flags_e orientation);
void invert_polygon(unsigned start);
// Flip all vertices horizontally or vertically,
// Flip all vertices horizontally or vertically,
// between x1 and x2, or between y1 and y2 respectively
//--------------------------------------------------------------------
void flip_x(double x1, double x2);
@ -717,7 +720,7 @@ namespace agg
// Concatenate path. The path is added as is.
//--------------------------------------------------------------------
template<class VertexSource>
template<class VertexSource>
void concat_path(VertexSource& vs, unsigned path_id = 0)
{
double x=0;
@ -731,9 +734,9 @@ namespace agg
}
//--------------------------------------------------------------------
// Join path. The path is joined with the existing one, that is,
// Join path. The path is joined with the existing one, that is,
// it behaves as if the pen of a plotter was always down (drawing)
template<class VertexSource>
template<class VertexSource>
void join_path(VertexSource& vs, unsigned path_id = 0)
{
double x=0.0, y=0.0;
@ -769,16 +772,16 @@ namespace agg
}
while(!is_stop(cmd = vs.vertex(&x, &y)))
{
m_vertices.add_vertex(x, y, is_move_to(cmd) ?
unsigned(path_cmd_line_to) :
m_vertices.add_vertex(x, y, is_move_to(cmd) ?
unsigned(path_cmd_line_to) :
cmd);
}
}
}
// Concatenate polygon/polyline.
// Concatenate polygon/polyline.
//--------------------------------------------------------------------
template<class T> void concat_poly(const T* data,
template<class T> void concat_poly(const T* data,
unsigned num_points,
bool closed)
{
@ -788,7 +791,7 @@ namespace agg
// Join polygon/polyline continuously.
//--------------------------------------------------------------------
template<class T> void join_poly(const T* data,
template<class T> void join_poly(const T* data,
unsigned num_points,
bool closed)
{
@ -846,7 +849,7 @@ namespace agg
};
//------------------------------------------------------------------------
template<class VC>
template<class VC>
unsigned path_base<VC>::start_new_path()
{
if(!is_stop(m_vertices.last_command()))
@ -858,7 +861,7 @@ namespace agg
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline void path_base<VC>::rel_to_abs(double* x, double* y) const
{
if(m_vertices.total_vertices())
@ -870,7 +873,7 @@ namespace agg
*x += x2;
*y += y2;
}
else if (!is_stop(m_vertices.last_command()) &&
else if (!is_stop(m_vertices.last_command()) &&
is_vertex(m_vertices.prev_vertex(&x2, &y2)))
{
*x += x2;
@ -880,14 +883,14 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline void path_base<VC>::move_to(double x, double y)
{
m_vertices.add_vertex(x, y, path_cmd_move_to);
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline void path_base<VC>::move_rel(double dx, double dy)
{
rel_to_abs(&dx, &dy);
@ -895,14 +898,14 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline void path_base<VC>::line_to(double x, double y)
{
m_vertices.add_vertex(x, y, path_cmd_line_to);
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline void path_base<VC>::line_rel(double dx, double dy)
{
rel_to_abs(&dx, &dy);
@ -910,14 +913,14 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline void path_base<VC>::hline_to(double x)
{
m_vertices.add_vertex(x, last_y(), path_cmd_line_to);
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline void path_base<VC>::hline_rel(double dx)
{
double dy = 0;
@ -926,14 +929,14 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline void path_base<VC>::vline_to(double y)
{
m_vertices.add_vertex(last_x(), y, path_cmd_line_to);
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline void path_base<VC>::vline_rel(double dy)
{
double dx = 0;
@ -942,7 +945,7 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
void path_base<VC>::arc_to(double rx, double ry,
double angle,
bool large_arc_flag,
@ -961,7 +964,7 @@ namespace agg
// Ensure radii are valid
//-------------------------
if(rx < epsilon || ry < epsilon)
if(rx < epsilon || ry < epsilon)
{
line_to(x, y);
return;
@ -990,7 +993,7 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
void path_base<VC>::arc_rel(double rx, double ry,
double angle,
bool large_arc_flag,
@ -1002,8 +1005,8 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
void path_base<VC>::curve3(double x_ctrl, double y_ctrl,
template<class VC>
void path_base<VC>::curve3(double x_ctrl, double y_ctrl,
double x_to, double y_to)
{
m_vertices.add_vertex(x_ctrl, y_ctrl, path_cmd_curve3);
@ -1011,8 +1014,8 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
void path_base<VC>::curve3_rel(double dx_ctrl, double dy_ctrl,
template<class VC>
void path_base<VC>::curve3_rel(double dx_ctrl, double dy_ctrl,
double dx_to, double dy_to)
{
rel_to_abs(&dx_ctrl, &dy_ctrl);
@ -1022,7 +1025,7 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
void path_base<VC>::curve3(double x_to, double y_to)
{
double x0;
@ -1030,7 +1033,7 @@ namespace agg
if(is_vertex(m_vertices.last_vertex(&x0, &y0)))
{
double x_ctrl;
double y_ctrl;
double y_ctrl;
unsigned cmd = m_vertices.prev_vertex(&x_ctrl, &y_ctrl);
if(is_curve(cmd))
{
@ -1047,7 +1050,7 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
void path_base<VC>::curve3_rel(double dx_to, double dy_to)
{
rel_to_abs(&dx_to, &dy_to);
@ -1055,9 +1058,9 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
void path_base<VC>::curve4(double x_ctrl1, double y_ctrl1,
double x_ctrl2, double y_ctrl2,
template<class VC>
void path_base<VC>::curve4(double x_ctrl1, double y_ctrl1,
double x_ctrl2, double y_ctrl2,
double x_to, double y_to)
{
m_vertices.add_vertex(x_ctrl1, y_ctrl1, path_cmd_curve4);
@ -1066,9 +1069,9 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
void path_base<VC>::curve4_rel(double dx_ctrl1, double dy_ctrl1,
double dx_ctrl2, double dy_ctrl2,
template<class VC>
void path_base<VC>::curve4_rel(double dx_ctrl1, double dy_ctrl1,
double dx_ctrl2, double dy_ctrl2,
double dx_to, double dy_to)
{
rel_to_abs(&dx_ctrl1, &dy_ctrl1);
@ -1080,8 +1083,8 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
void path_base<VC>::curve4(double x_ctrl2, double y_ctrl2,
template<class VC>
void path_base<VC>::curve4(double x_ctrl2, double y_ctrl2,
double x_to, double y_to)
{
double x0;
@ -1089,7 +1092,7 @@ namespace agg
if(is_vertex(last_vertex(&x0, &y0)))
{
double x_ctrl1;
double y_ctrl1;
double y_ctrl1;
unsigned cmd = prev_vertex(&x_ctrl1, &y_ctrl1);
if(is_curve(cmd))
{
@ -1106,8 +1109,8 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
void path_base<VC>::curve4_rel(double dx_ctrl2, double dy_ctrl2,
template<class VC>
void path_base<VC>::curve4_rel(double dx_ctrl2, double dy_ctrl2,
double dx_to, double dy_to)
{
rel_to_abs(&dx_ctrl2, &dy_ctrl2);
@ -1116,7 +1119,7 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline void path_base<VC>::end_poly(unsigned flags)
{
if(is_vertex(m_vertices.last_command()))
@ -1126,91 +1129,91 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline void path_base<VC>::close_polygon(unsigned flags)
{
end_poly(path_flags_close | flags);
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline unsigned path_base<VC>::total_vertices() const
{
return m_vertices.total_vertices();
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline unsigned path_base<VC>::last_vertex(double* x, double* y) const
{
return m_vertices.last_vertex(x, y);
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline unsigned path_base<VC>::prev_vertex(double* x, double* y) const
{
return m_vertices.prev_vertex(x, y);
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline double path_base<VC>::last_x() const
{
return m_vertices.last_x();
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline double path_base<VC>::last_y() const
{
return m_vertices.last_y();
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline unsigned path_base<VC>::vertex(unsigned idx, double* x, double* y) const
{
return m_vertices.vertex(idx, x, y);
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline unsigned path_base<VC>::command(unsigned idx) const
{
return m_vertices.command(idx);
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
void path_base<VC>::modify_vertex(unsigned idx, double x, double y)
{
m_vertices.modify_vertex(idx, x, y);
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
void path_base<VC>::modify_vertex(unsigned idx, double x, double y, unsigned cmd)
{
m_vertices.modify_vertex(idx, x, y, cmd);
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
void path_base<VC>::modify_command(unsigned idx, unsigned cmd)
{
m_vertices.modify_command(idx, cmd);
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline void path_base<VC>::rewind(unsigned path_id)
{
m_iterator = path_id;
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
inline unsigned path_base<VC>::vertex(double* x, double* y)
{
if(m_iterator >= m_vertices.total_vertices()) return path_cmd_stop;
@ -1218,7 +1221,7 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
unsigned path_base<VC>::perceive_polygon_orientation(unsigned start,
unsigned end)
{
@ -1238,12 +1241,12 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
void path_base<VC>::invert_polygon(unsigned start, unsigned end)
{
unsigned i;
unsigned tmp_cmd = m_vertices.command(start);
--end; // Make "end" inclusive
// Shift all commands to one position
@ -1263,45 +1266,45 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
void path_base<VC>::invert_polygon(unsigned start)
{
// Skip all non-vertices at the beginning
while(start < m_vertices.total_vertices() &&
while(start < m_vertices.total_vertices() &&
!is_vertex(m_vertices.command(start))) ++start;
// Skip all insignificant move_to
while(start+1 < m_vertices.total_vertices() &&
while(start+1 < m_vertices.total_vertices() &&
is_move_to(m_vertices.command(start)) &&
is_move_to(m_vertices.command(start+1))) ++start;
// Find the last vertex
unsigned end = start + 1;
while(end < m_vertices.total_vertices() &&
while(end < m_vertices.total_vertices() &&
!is_next_poly(m_vertices.command(end))) ++end;
invert_polygon(start, end);
}
//------------------------------------------------------------------------
template<class VC>
unsigned path_base<VC>::arrange_polygon_orientation(unsigned start,
template<class VC>
unsigned path_base<VC>::arrange_polygon_orientation(unsigned start,
path_flags_e orientation)
{
if(orientation == path_flags_none) return start;
// Skip all non-vertices at the beginning
while(start < m_vertices.total_vertices() &&
while(start < m_vertices.total_vertices() &&
!is_vertex(m_vertices.command(start))) ++start;
// Skip all insignificant move_to
while(start+1 < m_vertices.total_vertices() &&
while(start+1 < m_vertices.total_vertices() &&
is_move_to(m_vertices.command(start)) &&
is_move_to(m_vertices.command(start+1))) ++start;
// Find the last vertex
unsigned end = start + 1;
while(end < m_vertices.total_vertices() &&
while(end < m_vertices.total_vertices() &&
!is_next_poly(m_vertices.command(end))) ++end;
if(end - start > 2)
@ -1311,7 +1314,7 @@ namespace agg
// Invert polygon, set orientation flag, and skip all end_poly
invert_polygon(start, end);
unsigned cmd;
while(end < m_vertices.total_vertices() &&
while(end < m_vertices.total_vertices() &&
is_end_poly(cmd = m_vertices.command(end)))
{
m_vertices.modify_command(end++, set_orientation(cmd, orientation));
@ -1322,8 +1325,8 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
unsigned path_base<VC>::arrange_orientations(unsigned start,
template<class VC>
unsigned path_base<VC>::arrange_orientations(unsigned start,
path_flags_e orientation)
{
if(orientation != path_flags_none)
@ -1342,7 +1345,7 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
void path_base<VC>::arrange_orientations_all_paths(path_flags_e orientation)
{
if(orientation != path_flags_none)
@ -1356,7 +1359,7 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
void path_base<VC>::flip_x(double x1, double x2)
{
unsigned i;
@ -1372,7 +1375,7 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
void path_base<VC>::flip_y(double y1, double y2)
{
unsigned i;
@ -1388,7 +1391,7 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
void path_base<VC>::translate(double dx, double dy, unsigned path_id)
{
unsigned num_ver = m_vertices.total_vertices();
@ -1407,7 +1410,7 @@ namespace agg
}
//------------------------------------------------------------------------
template<class VC>
template<class VC>
void path_base<VC>::translate_all_paths(double dx, double dy)
{
unsigned idx;
@ -1440,8 +1443,8 @@ namespace agg
void add_vertex(double x, double y, unsigned cmd)
{
m_vertices.push_back(vertex_type(value_type(x),
value_type(y),
m_vertices.push_back(vertex_type(value_type(x),
value_type(y),
int8u(cmd)));
}
@ -1474,8 +1477,8 @@ namespace agg
unsigned last_command() const
{
return m_vertices.size() ?
m_vertices[m_vertices.size() - 1].cmd :
return m_vertices.size() ?
m_vertices[m_vertices.size() - 1].cmd :
path_cmd_stop;
}
@ -1545,11 +1548,11 @@ namespace agg
// Example of declarations path_storage with std::vector as a container
//---------------------------------------------------------------------------
//#include <vector>
//namespace agg
//{
// typedef path_base<vertex_stl_storage<std::vector<vertex_d> > > path_storage;
//}
//#include <vector>
//namespace agg
//{
// typedef path_base<vertex_stl_storage<std::vector<vertex_d> > > path_storage;
//}
#endif

View file

@ -2,8 +2,8 @@
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
@ -35,7 +35,7 @@ namespace agg
};
//--------------------------------------------------------------blender_base
template<class ColorT, class Order = void>
template<class ColorT, class Order = void>
struct blender_base
{
typedef ColorT color_type;
@ -47,14 +47,14 @@ namespace agg
if (cover > cover_none)
{
rgba c(
color_type::to_double(r),
color_type::to_double(g),
color_type::to_double(b),
color_type::to_double(r),
color_type::to_double(g),
color_type::to_double(b),
color_type::to_double(a));
if (cover < cover_full)
{
double x = double(cover) / cover_full;
double x = static_cast<double>(cover) / static_cast<double>(cover_full);
c.r *= x;
c.g *= x;
c.b *= x;
@ -69,10 +69,10 @@ namespace agg
static rgba get(const value_type* p, cover_type cover = cover_full)
{
return get(
p[order_type::R],
p[order_type::G],
p[order_type::B],
p[order_type::A],
p[order_type::R],
p[order_type::G],
p[order_type::B],
p[order_type::A],
cover);
}

View file

@ -2,8 +2,8 @@
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
@ -24,7 +24,7 @@ namespace agg
{
poly_max_coord = (1 << 30) - 1 //----poly_max_coord
};
//------------------------------------------------------------ras_conv_int
struct ras_conv_int
{
@ -35,7 +35,7 @@ namespace agg
}
static int xi(int v) { return v; }
static int yi(int v) { return v; }
static int upscale(double v) { return iround(v * poly_subpixel_scale); }
static int upscale(double v) { return iround(v * static_cast<double>(poly_subpixel_scale)); }
static int downscale(int v) { return v; }
};
@ -49,9 +49,9 @@ namespace agg
}
static int xi(int v) { return v; }
static int yi(int v) { return v; }
static int upscale(double v)
{
return saturation<poly_max_coord>::iround(v * poly_subpixel_scale);
static int upscale(double v)
{
return saturation<poly_max_coord>::iround(v * static_cast<double>(poly_subpixel_scale));
}
static int downscale(int v) { return v; }
};
@ -66,7 +66,7 @@ namespace agg
}
static int xi(int v) { return v * 3; }
static int yi(int v) { return v; }
static int upscale(double v) { return iround(v * poly_subpixel_scale); }
static int upscale(double v) { return iround(v * static_cast<double>(poly_subpixel_scale)); }
static int downscale(int v) { return v; }
};
@ -78,10 +78,10 @@ namespace agg
{
return a * b / c;
}
static int xi(double v) { return iround(v * poly_subpixel_scale); }
static int yi(double v) { return iround(v * poly_subpixel_scale); }
static int xi(double v) { return iround(v * static_cast<double>(poly_subpixel_scale)); }
static int yi(double v) { return iround(v * static_cast<double>(poly_subpixel_scale)); }
static double upscale(double v) { return v; }
static double downscale(int v) { return v / double(poly_subpixel_scale); }
static double downscale(int v) { return v / static_cast<double>(poly_subpixel_scale); }
};
//--------------------------------------------------------ras_conv_dbl_3x
@ -92,10 +92,10 @@ namespace agg
{
return a * b / c;
}
static int xi(double v) { return iround(v * poly_subpixel_scale * 3); }
static int yi(double v) { return iround(v * poly_subpixel_scale); }
static int xi(double v) { return iround(v * static_cast<double>(poly_subpixel_scale) * 3); }
static int yi(double v) { return iround(v * static_cast<double>(poly_subpixel_scale)); }
static double upscale(double v) { return v; }
static double downscale(int v) { return v / double(poly_subpixel_scale); }
static double downscale(int v) { return v / static_cast<double>(poly_subpixel_scale); }
};
@ -111,12 +111,12 @@ namespace agg
typedef rect_base<coord_type> rect_type;
//--------------------------------------------------------------------
rasterizer_sl_clip() :
rasterizer_sl_clip() :
m_clip_box(0,0,0,0),
m_x1(0),
m_y1(0),
m_f1(0),
m_clipping(false)
m_clipping(false)
{}
//--------------------------------------------------------------------
@ -145,8 +145,8 @@ namespace agg
//------------------------------------------------------------------------
template<class Rasterizer>
AGG_INLINE void line_clip_y(Rasterizer& ras,
coord_type x1, coord_type y1,
coord_type x2, coord_type y2,
coord_type x1, coord_type y1,
coord_type x2, coord_type y2,
unsigned f1, unsigned f2) const
{
f1 &= 10;
@ -154,7 +154,7 @@ namespace agg
if((f1 | f2) == 0)
{
// Fully visible
ras.line(Conv::xi(x1), Conv::yi(y1), Conv::xi(x2), Conv::yi(y2));
ras.line(Conv::xi(x1), Conv::yi(y1), Conv::xi(x2), Conv::yi(y2));
}
else
{
@ -192,8 +192,8 @@ namespace agg
tx2 = x1 + Conv::mul_div(m_clip_box.y2-y1, x2-x1, y2-y1);
ty2 = m_clip_box.y2;
}
ras.line(Conv::xi(tx1), Conv::yi(ty1),
Conv::xi(tx2), Conv::yi(ty2));
ras.line(Conv::xi(tx1), Conv::yi(ty1),
Conv::xi(tx2), Conv::yi(ty2));
}
}
@ -288,8 +288,8 @@ namespace agg
}
else
{
ras.line(Conv::xi(m_x1), Conv::yi(m_y1),
Conv::xi(x2), Conv::yi(y2));
ras.line(Conv::xi(m_x1), Conv::yi(m_y1),
Conv::xi(x2), Conv::yi(y2));
}
m_x1 = x2;
m_y1 = y2;
@ -321,10 +321,10 @@ namespace agg
void move_to(coord_type x1, coord_type y1) { m_x1 = x1; m_y1 = y1; }
template<class Rasterizer>
void line_to(Rasterizer& ras, coord_type x2, coord_type y2)
{
ras.line(m_x1, m_y1, x2, y2);
m_x1 = x2;
void line_to(Rasterizer& ras, coord_type x2, coord_type y2)
{
ras.line(m_x1, m_y1, x2, y2);
m_x1 = x2;
m_y1 = y2;
}

View file

@ -1305,7 +1305,7 @@ namespace agg
for(i = 0; i < aa_scale; i++)
{
m_gamma[i] = value_type(
uround(gamma_function(double(i) / aa_mask) * aa_mask));
uround(gamma_function(static_cast<double>(i) / static_cast<double>(aa_mask)) * aa_mask));
}
}

View file

@ -66,7 +66,9 @@ void arrowhead::rewind(unsigned path_id)
m_cmd[3] = path_cmd_line_to;
m_cmd[4] = path_cmd_line_to;
m_cmd[5] = path_cmd_line_to;
m_cmd[7] = path_cmd_end_poly | path_flags_close | path_flags_ccw;
m_cmd[7] = path_cmd_end_poly
| static_cast<path_commands_e>(path_flags_close)
| static_cast<path_commands_e>(path_flags_ccw);
m_cmd[6] = path_cmd_stop;
return;
}
@ -87,7 +89,9 @@ void arrowhead::rewind(unsigned path_id)
m_cmd[1] = path_cmd_line_to;
m_cmd[2] = path_cmd_line_to;
m_cmd[3] = path_cmd_line_to;
m_cmd[4] = path_cmd_end_poly | path_flags_close | path_flags_ccw;
m_cmd[4] = path_cmd_end_poly
| static_cast<path_commands_e>(path_flags_close)
| static_cast<path_commands_e>(path_flags_ccw);
m_cmd[5] = path_cmd_stop;
return;
}

View file

@ -42,7 +42,7 @@ void line_profile_aa::width(double w)
//---------------------------------------------------------------------
line_profile_aa::value_type* line_profile_aa::profile(double w)
{
m_subpixel_width = uround(w * subpixel_scale);
m_subpixel_width = uround(w * static_cast<double>(subpixel_scale));
unsigned size = m_subpixel_width + subpixel_scale * 6;
if(size > m_profile.size())
{
@ -56,8 +56,8 @@ line_profile_aa::value_type* line_profile_aa::profile(double w)
void line_profile_aa::set(double center_width, double smoother_width)
{
double base_val = 1.0;
if(center_width == 0.0) center_width = 1.0 / subpixel_scale;
if(smoother_width == 0.0) smoother_width = 1.0 / subpixel_scale;
if(center_width == 0.0) center_width = 1.0 / static_cast<double>(subpixel_scale);
if(smoother_width == 0.0) smoother_width = 1.0 / static_cast<double>(subpixel_scale);
double width = center_width + smoother_width;
if(width < m_min_width)
@ -70,15 +70,15 @@ void line_profile_aa::set(double center_width, double smoother_width)
value_type* ch = profile(center_width + smoother_width);
unsigned subpixel_center_width = unsigned(center_width * subpixel_scale);
unsigned subpixel_smoother_width = unsigned(smoother_width * subpixel_scale);
unsigned subpixel_center_width = unsigned(center_width * static_cast<double>(subpixel_scale));
unsigned subpixel_smoother_width = unsigned(smoother_width * static_cast<double>(subpixel_scale));
value_type* ch_center = ch + subpixel_scale*2;
value_type* ch_center = ch + subpixel_scale * 2;
value_type* ch_smoother = ch_center + subpixel_center_width;
unsigned i;
unsigned val = m_gamma[unsigned(base_val * aa_mask)];
unsigned val = m_gamma[unsigned(base_val * static_cast<double>(aa_mask))];
ch = ch_center;
for(i = 0; i < subpixel_center_width; i++)
{
@ -90,7 +90,7 @@ void line_profile_aa::set(double center_width, double smoother_width)
*ch_smoother++ =
m_gamma[unsigned((base_val -
base_val *
(double(i) / subpixel_smoother_width)) * aa_mask)];
(double(i) / subpixel_smoother_width)) * static_cast<double>(aa_mask))];
}
unsigned n_smoother = profile_size() -
@ -113,4 +113,3 @@ void line_profile_aa::set(double center_width, double smoother_width)
}

View file

@ -152,7 +152,9 @@ unsigned rounded_rect::vertex(double* x, double* y)
else return path_cmd_line_to;
case 8:
cmd = path_cmd_end_poly | path_flags_close | path_flags_ccw;
cmd = path_cmd_end_poly
| static_cast<path_commands_e>(path_flags_close)
| static_cast<path_commands_e>(path_flags_ccw);
m_status++;
break;
}
@ -161,4 +163,3 @@ unsigned rounded_rect::vertex(double* x, double* y)
}

View file

@ -153,7 +153,9 @@ unsigned vcgen_contour::vertex(double* x, double* y)
case end_poly:
if(!m_closed) return path_cmd_stop;
m_status = stop;
return path_cmd_end_poly | path_flags_close | path_flags_ccw;
return path_cmd_end_poly
| static_cast<path_commands_e>(path_flags_close)
| static_cast<path_commands_e>(path_flags_ccw);
case stop:
return path_cmd_stop;

View file

@ -196,11 +196,15 @@ unsigned vcgen_stroke::vertex(double* x, double* y)
case end_poly1:
m_status = m_prev_status;
return path_cmd_end_poly | path_flags_close | path_flags_ccw;
return path_cmd_end_poly
| static_cast<path_commands_e>(path_flags_close)
| static_cast<path_commands_e>(path_flags_ccw);
case end_poly2:
m_status = m_prev_status;
return path_cmd_end_poly | path_flags_close | path_flags_cw;
return path_cmd_end_poly
| static_cast<path_commands_e>(path_flags_close)
| static_cast<path_commands_e>(path_flags_cw);
case stop:
cmd = path_cmd_stop;

View file

@ -73,10 +73,10 @@ class linear_gradient_from_segment
{
public:
linear_gradient_from_segment(double x1, double y1, double x2, double y2)
: x1_(x1 * agg::gradient_subpixel_scale)
, y1_(y1 * agg::gradient_subpixel_scale)
, x2_(x2 * agg::gradient_subpixel_scale)
, y2_(y2 * agg::gradient_subpixel_scale)
: x1_(x1 * static_cast<double>(agg::gradient_subpixel_scale))
, y1_(y1 * static_cast<double>(agg::gradient_subpixel_scale))
, x2_(x2 * static_cast<double>(agg::gradient_subpixel_scale))
, y2_(y2 * static_cast<double>(agg::gradient_subpixel_scale))
{
double dx = x2_ - x1_;
double dy = y2_ - y1_;