From 21f21d82681573780b7f7c1acd8d3b0d82af06ce Mon Sep 17 00:00:00 2001 From: pjft Date: Sat, 9 Jun 2018 18:38:18 +0100 Subject: [PATCH] Final Fix for resizing images --- es-core/src/components/ImageComponent.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/es-core/src/components/ImageComponent.cpp b/es-core/src/components/ImageComponent.cpp index 316433679..14f5fac13 100644 --- a/es-core/src/components/ImageComponent.cpp +++ b/es-core/src/components/ImageComponent.cpp @@ -62,7 +62,7 @@ void ImageComponent::resize() // we need to make sure we're not creating an image larger than max size mSize[1] = Math::min(Math::round(mSize[1] *= resizeScale.x()), mTargetSize.y()); }else{ - mSize[1] = Math::round(mSize[1] *= resizeScale.y()); // this will be mTargetSize.y(). We can't exceed it. + mSize[1] = Math::round(mSize[1] * resizeScale.y()); // this will be mTargetSize.y(). We can't exceed it. // for SVG rasterization, always calculate width from rounded height (see comment above) // we need to make sure we're not creating an image larger than max size @@ -112,8 +112,11 @@ void ImageComponent::resize() } } } + + mSize[0] = Math::round(mSize.x()); + mSize[1] = Math::round(mSize.y()); // mSize.y() should already be rounded - mTexture->rasterizeAt((size_t)Math::round(mSize.x()), (size_t)Math::round(mSize.y())); + mTexture->rasterizeAt((size_t)mSize.x(), (size_t)mSize.y()); onSizeChanged(); }