tdf#152061 Fix bitmap image scaling
In the regression introduced by c2c37eadf32c80bcd8f168b9fc67f32002b3cb07
the bitmap image scale was calculated incorrectly. Upon resizing the
image a bit, this problem went away, and the image was shown with much
better quality compared to what it was before the above commit. It
turned out that the problem happened when the scale was less than 1, and
it was happening inside "if ( nScaleX < 1.0 || nScaleY < 1.0 ) {...}".
The part that was calculating aPosAry.mnSrcWidth and aPosAry.mnSrcHeight
was wrong, because it was setting the same height and width without
considering the fScale. The bitmap was scaled using Bitmap::Scale()
parameter which was newly multipled by fScale in the above commit. To
fix the problem, these two values are now multipled by fScale.
Change-Id: I8c77d2db3b05da54f1999d3915a70e3b7cc8106f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142754
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 31d510389928c8f8a495a85cdab4c12d1bbbd3ce)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142690
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 49bdf98..df916c0e 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -171,8 +171,8 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize,
if ( nScaleX < 1.0 || nScaleY < 1.0 )
{
aBmp.Scale(nScaleX, nScaleY);
aPosAry.mnSrcWidth = aPosAry.mnDestWidth;
aPosAry.mnSrcHeight = aPosAry.mnDestHeight;
aPosAry.mnSrcWidth = aPosAry.mnDestWidth * fScale;
aPosAry.mnSrcHeight = aPosAry.mnDestHeight * fScale;
}
}