From 29779b75b34ac01ce97e1c41073f3e982652f97d Mon Sep 17 00:00:00 2001 From: Christian Feldmann Date: Sun, 3 Dec 2023 18:27:28 +0100 Subject: [PATCH] Fix error in QSize to our Size conversion --- YUViewLib/src/common/Typedef.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/YUViewLib/src/common/Typedef.h b/YUViewLib/src/common/Typedef.h index 201ccaf9f..65c3118f8 100644 --- a/YUViewLib/src/common/Typedef.h +++ b/YUViewLib/src/common/Typedef.h @@ -227,7 +227,6 @@ template using vector4d = std::vector>; template using array = std::array; template using array2d = std::array, N1>; - template int indexInVec(const std::vector &vec, const T &item) { auto it = std::find(vec.begin(), vec.end(), item); @@ -265,8 +264,9 @@ struct Size { constexpr Size(unsigned width, unsigned height) : width(width), height(height) {} constexpr Size(int width, int height) - : width(static_cast(width)), height(static_cast(height)) { + this->width = (width < 0) ? 0 : static_cast(width); + this->height = (height < 0) ? 0 : static_cast(height); } constexpr Size() = default;