avoid a few -Wsign-conversion warnings
This commit is contained in:
parent
76e761b2f0
commit
a552518541
2 changed files with 13 additions and 13 deletions
|
@ -85,8 +85,8 @@ void save_as_jpeg(T1 & file,int quality, T2 const& image)
|
|||
struct jpeg_compress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
|
||||
int width=image.width();
|
||||
int height=image.height();
|
||||
int width = static_cast<int>(image.width());
|
||||
int height = static_cast<int>(image.height());
|
||||
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
jpeg_create_compress(&cinfo);
|
||||
|
|
|
@ -80,20 +80,20 @@ inline int import_image(T2 const& im_in,
|
|||
image<typename T2::pixel> const& data = im_in.data();
|
||||
std::size_t width = im_in.width();
|
||||
std::size_t height = im_in.height();
|
||||
int stride = sizeof(typename T2::pixel_type) * width;
|
||||
std::size_t stride = sizeof(typename T2::pixel_type) * width;
|
||||
if (data.width() == width &&
|
||||
data.height() == height)
|
||||
{
|
||||
if (alpha)
|
||||
{
|
||||
return WebPPictureImportRGBA(&pic, data.bytes(), stride);
|
||||
return WebPPictureImportRGBA(&pic, data.bytes(), static_cast<int>(stride));
|
||||
}
|
||||
else
|
||||
{
|
||||
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1
|
||||
return WebPPictureImportRGBX(&pic, data.bytes(), stride);
|
||||
return WebPPictureImportRGBX(&pic, data.bytes(), static_cast<int>(stride));
|
||||
#else
|
||||
return WebPPictureImportRGBA(&pic, data.bytes(), stride);
|
||||
return WebPPictureImportRGBA(&pic, data.bytes(), static_cast<int>(stride));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -109,14 +109,14 @@ inline int import_image(T2 const& im_in,
|
|||
}
|
||||
if (alpha)
|
||||
{
|
||||
return WebPPictureImportRGBA(&pic, im.bytes(), stride);
|
||||
return WebPPictureImportRGBA(&pic, im.bytes(), static_cast<int>(stride));
|
||||
}
|
||||
else
|
||||
{
|
||||
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1
|
||||
return WebPPictureImportRGBX(&pic, im.bytes(), stride);
|
||||
return WebPPictureImportRGBX(&pic, im.bytes(), static_cast<int>(stride));
|
||||
#else
|
||||
return WebPPictureImportRGBA(&pic, im.bytes(), stride);
|
||||
return WebPPictureImportRGBA(&pic, im.bytes(), static_cast<int>(stride));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -127,17 +127,17 @@ inline int import_image(image_rgba8 const& im,
|
|||
WebPPicture & pic,
|
||||
bool alpha)
|
||||
{
|
||||
int stride = sizeof(image_rgba8::pixel_type) * im.width();
|
||||
std::size_t stride = sizeof(image_rgba8::pixel_type) * im.width();
|
||||
if (alpha)
|
||||
{
|
||||
return WebPPictureImportRGBA(&pic, im.bytes(), stride);
|
||||
return WebPPictureImportRGBA(&pic, im.bytes(), static_cast<int>(stride));
|
||||
}
|
||||
else
|
||||
{
|
||||
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1
|
||||
return WebPPictureImportRGBX(&pic, im.bytes(), stride);
|
||||
return WebPPictureImportRGBX(&pic, im.bytes(), static_cast<int>(stride));
|
||||
#else
|
||||
return WebPPictureImportRGBA(&pic, im.bytes(), stride);
|
||||
return WebPPictureImportRGBA(&pic, im.bytes(), static_cast<int>(stride));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue