tdf#152061 Fix bitmap image scaling
In the regression introduced by c2c37eadf3
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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user