From aa915ee1c4ab685875200397dcf1f630fe27b7bf Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Thu, 20 Apr 2023 15:05:51 +0900 Subject: [PATCH] Make it silent MSVC's trivial compilation warnings. @Issue: https://github.com/thorvg/thorvg/issues/1381 --- src/bin/svg2png/svg2png.cpp | 4 ++-- src/lib/sw_engine/tvgSwStroke.cpp | 4 ++-- src/loaders/jpg/tvgJpgLoader.cpp | 2 +- src/loaders/png/tvgPngLoader.cpp | 2 +- src/loaders/raw/tvgRawLoader.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bin/svg2png/svg2png.cpp b/src/bin/svg2png/svg2png.cpp index c399c289..745b6c5c 100644 --- a/src/bin/svg2png/svg2png.cpp +++ b/src/bin/svg2png/svg2png.cpp @@ -112,7 +112,7 @@ public: "To avoid the heap overflow, the conversion to the PNG file made in " << WIDTH_8K << " x " << HEIGHT_8K << " resolution." << endl; } } else { - picture->size(w, h); + picture->size(static_cast(w), static_cast(h)); } //Buffer @@ -134,7 +134,7 @@ public: uint8_t b = (uint8_t)((bgColor & 0x0000ff)); auto shape = tvg::Shape::gen(); - shape->appendRect(0, 0, w, h, 0, 0); + shape->appendRect(0, 0, static_cast(w), static_cast(h), 0, 0); shape->fill(r, g, b, 255); if (canvas->push(move(shape)) != tvg::Result::Success) return 1; diff --git a/src/lib/sw_engine/tvgSwStroke.cpp b/src/lib/sw_engine/tvgSwStroke.cpp index 8a18900d..2f41d5f0 100644 --- a/src/lib/sw_engine/tvgSwStroke.cpp +++ b/src/lib/sw_engine/tvgSwStroke.cpp @@ -388,8 +388,8 @@ static void _lineTo(SwStroke& stroke, const SwPoint& to) The scale needs to be reverted since the stroke width has not been scaled. An alternative option is to scale the width of the stroke properly by calculating the mixture of the sx/sy rating on the stroke direction. */ - delta.x /= stroke.sx; - delta.y /= stroke.sy; + delta.x = static_cast(delta.x / stroke.sx); + delta.y = static_cast(delta.y / stroke.sy); auto lineLength = mathLength(delta); delta = {static_cast(stroke.width), 0}; diff --git a/src/loaders/jpg/tvgJpgLoader.cpp b/src/loaders/jpg/tvgJpgLoader.cpp index 2b16090f..c0e0b927 100644 --- a/src/loaders/jpg/tvgJpgLoader.cpp +++ b/src/loaders/jpg/tvgJpgLoader.cpp @@ -135,7 +135,7 @@ unique_ptr JpgLoader::bitmap(uint32_t colorSpace) if (!image) return nullptr; if (this->colorSpace != colorSpace) { this->colorSpace = colorSpace; - _changeColorSpace(reinterpret_cast(image), w, h); + _changeColorSpace(reinterpret_cast(image), static_cast(w), static_cast(h)); } auto surface = static_cast(malloc(sizeof(Surface))); diff --git a/src/loaders/png/tvgPngLoader.cpp b/src/loaders/png/tvgPngLoader.cpp index 2d8f78b2..05810762 100644 --- a/src/loaders/png/tvgPngLoader.cpp +++ b/src/loaders/png/tvgPngLoader.cpp @@ -192,7 +192,7 @@ unique_ptr PngLoader::bitmap(uint32_t colorSpace) if (!image) return nullptr; if (this->colorSpace != colorSpace) { this->colorSpace = colorSpace; - _changeColorSpace(reinterpret_cast(image), w, h); + _changeColorSpace(reinterpret_cast(image), static_cast(w), static_cast(h)); } auto surface = static_cast(malloc(sizeof(Surface))); diff --git a/src/loaders/raw/tvgRawLoader.cpp b/src/loaders/raw/tvgRawLoader.cpp index 524cff1c..749b7091 100644 --- a/src/loaders/raw/tvgRawLoader.cpp +++ b/src/loaders/raw/tvgRawLoader.cpp @@ -95,7 +95,7 @@ unique_ptr RawLoader::bitmap(uint32_t colorSpace) if (!content) return nullptr; if (this->colorSpace != colorSpace) { this->colorSpace = colorSpace; - _changeColorSpace(content, w, h); + _changeColorSpace(content, static_cast(w), static_cast(h)); } auto surface = static_cast(malloc(sizeof(Surface)));