@@ -327,18 +327,18 @@ void RendererCairo::visit(const Raster *t_raster)
327327 for (size_t i = 0 ; i < t_raster->raster .size (); ++i)
328328 {
329329 const color_t alpha = color::alpha (t_raster->raster [i]);
330- imageData[i * 4 + 3 ] = alpha;
330+ imageData[i * 4 + 3 ] = static_cast < unsigned char >( alpha) ;
331331 if (alpha < color::byte_mask)
332332 {
333- imageData[i * 4 + 2 ] = color::red (t_raster->raster [i]) * alpha / color::byte_mask;
334- imageData[i * 4 + 1 ] = color::green (t_raster->raster [i]) * alpha / color::byte_mask;
335- imageData[i * 4 + 0 ] = color::blue (t_raster->raster [i]) * alpha / color::byte_mask;
333+ imageData[i * 4 + 2 ] = static_cast < unsigned char >( color::red (t_raster->raster [i]) * alpha / color::byte_mask) ;
334+ imageData[i * 4 + 1 ] = static_cast < unsigned char >( color::green (t_raster->raster [i]) * alpha / color::byte_mask) ;
335+ imageData[i * 4 + 0 ] = static_cast < unsigned char >( color::blue (t_raster->raster [i]) * alpha / color::byte_mask) ;
336336 }
337337 else
338338 {
339- imageData[i * 4 + 2 ] = color::red (t_raster->raster [i]);
340- imageData[i * 4 + 1 ] = color::green (t_raster->raster [i]);
341- imageData[i * 4 + 0 ] = color::blue (t_raster->raster [i]);
339+ imageData[i * 4 + 2 ] = static_cast < unsigned char >( color::red (t_raster->raster [i]) );
340+ imageData[i * 4 + 1 ] = static_cast < unsigned char >( color::green (t_raster->raster [i]) );
341+ imageData[i * 4 + 0 ] = static_cast < unsigned char >( color::blue (t_raster->raster [i]) );
342342 }
343343 }
344344 cairo_surface_t *image = cairo_image_surface_create_for_data (
@@ -388,8 +388,9 @@ static cairo_status_t cairowrite_ucvec(void *closure, unsigned char const *data,
388388
389389void RendererCairoPng::render (const Page &t_page, double t_scale)
390390{
391- surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, t_page.size .x * t_scale,
392- t_page.size .y * t_scale);
391+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
392+ static_cast <int >(t_page.size .x * t_scale),
393+ static_cast <int >(t_page.size .y * t_scale));
393394
394395 cr = cairo_create (surface);
395396
@@ -411,8 +412,9 @@ void RendererCairoPng::get_data(const uint8_t **t_buf, size_t *t_size) const
411412
412413void RendererCairoPngBase64::render (const Page &t_page, double t_scale)
413414{
414- surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, t_page.size .x * t_scale,
415- t_page.size .y * t_scale);
415+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
416+ static_cast <int >(t_page.size .x * t_scale),
417+ static_cast <int >(t_page.size .y * t_scale));
416418
417419 cr = cairo_create (surface);
418420
@@ -505,8 +507,8 @@ void RendererCairoEps::get_data(const uint8_t **t_buf, size_t *t_size) const
505507void RendererCairoTiff::render (const Page &t_page, double t_scale)
506508{
507509 const int argb_size = 4 ;
508- const int width = t_page.size .x * t_scale;
509- const int height = t_page.size .y * t_scale;
510+ const int width = static_cast < int >( t_page.size .x * t_scale) ;
511+ const int height = static_cast < int >( t_page.size .y * t_scale) ;
510512 const int stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, width);
511513
512514 std::vector<unsigned char > raw_buffer (stride * height);
0 commit comments