Fix -Wdeprecated-enum-enum-conversion
warnings (AGG)
This commit is contained in:
parent
a9c98dff5d
commit
9627432723
16 changed files with 258 additions and 241 deletions
2
deps/agg/include/agg_basics.h
vendored
2
deps/agg/include/agg_basics.h
vendored
|
@ -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
|
||||
|
|
11
deps/agg/include/agg_color_gray.h
vendored
11
deps/agg/include/agg_color_gray.h
vendored
|
@ -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));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
|
16
deps/agg/include/agg_color_rgba.h
vendored
16
deps/agg/include/agg_color_rgba.h
vendored
|
@ -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));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
|
7
deps/agg/include/agg_conv_adaptor_vpgen.h
vendored
7
deps/agg/include/agg_conv_adaptor_vpgen.h
vendored
|
@ -103,7 +103,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_start_x = tx;
|
||||
m_start_y = ty;
|
||||
m_vertices = -1;
|
||||
|
@ -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
|
||||
|
||||
|
|
8
deps/agg/include/agg_image_filters.h
vendored
8
deps/agg/include/agg_image_filters.h
vendored
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "agg_array.h"
|
||||
#include "agg_math.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace agg
|
||||
{
|
||||
|
@ -59,7 +60,8 @@ 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] =
|
||||
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];
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
|
8
deps/agg/include/agg_line_aa_basics.h
vendored
8
deps/agg/include/agg_line_aa_basics.h
vendored
|
@ -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));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
9
deps/agg/include/agg_path_storage.h
vendored
9
deps/agg/include/agg_path_storage.h
vendored
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
2
deps/agg/include/agg_pixfmt_base.h
vendored
2
deps/agg/include/agg_pixfmt_base.h
vendored
|
@ -54,7 +54,7 @@ namespace agg
|
|||
|
||||
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;
|
||||
|
|
18
deps/agg/include/agg_rasterizer_sl_clip.h
vendored
18
deps/agg/include/agg_rasterizer_sl_clip.h
vendored
|
@ -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; }
|
||||
};
|
||||
|
||||
|
@ -51,7 +51,7 @@ namespace agg
|
|||
static int yi(int v) { return v; }
|
||||
static int upscale(double v)
|
||||
{
|
||||
return saturation<poly_max_coord>::iround(v * poly_subpixel_scale);
|
||||
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); }
|
||||
};
|
||||
|
||||
|
||||
|
|
2
deps/agg/include/agg_renderer_outline_aa.h
vendored
2
deps/agg/include/agg_renderer_outline_aa.h
vendored
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
8
deps/agg/src/agg_arrowhead.cpp
vendored
8
deps/agg/src/agg_arrowhead.cpp
vendored
|
@ -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;
|
||||
}
|
||||
|
|
15
deps/agg/src/agg_line_profile_aa.cpp
vendored
15
deps/agg/src/agg_line_profile_aa.cpp
vendored
|
@ -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_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)
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
|
5
deps/agg/src/agg_rounded_rect.cpp
vendored
5
deps/agg/src/agg_rounded_rect.cpp
vendored
|
@ -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)
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
|
4
deps/agg/src/agg_vcgen_contour.cpp
vendored
4
deps/agg/src/agg_vcgen_contour.cpp
vendored
|
@ -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;
|
||||
|
|
8
deps/agg/src/agg_vcgen_stroke.cpp
vendored
8
deps/agg/src/agg_vcgen_stroke.cpp
vendored
|
@ -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;
|
||||
|
|
|
@ -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_;
|
||||
|
|
Loading…
Reference in a new issue