vcl/source/outdev/bitmap.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 31d510389928c8f8a495a85cdab4c12d1bbbd3ce
Author:     Hossein <hoss...@libreoffice.org>
AuthorDate: Wed Nov 16 04:30:17 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Nov 16 11:17:29 2022 +0100

    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 <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 45e3b0d3ede1..8e453e835904 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;
                     }
                 }
 

Reply via email to