summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-04-30 16:46:40 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-04-30 16:57:09 +0200
commit818a0ed6c6b2f7176551f1db0ff518b5a0bb522e (patch)
tree747fafac111703124946069103908d7d0158bbaa /vcl
parentae4e79e7728b39bdb98f023d950dbbfa7c4c38d4 (diff)
fdo#77126 BitmapEx.Scale already takes care of mirroring
Change-Id: I320a5ec1da62cc1a8b3cb227298ecaf99f305a6f
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/outdev/bitmap.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index e0841a60a25a..4fabf50e3d21 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -501,12 +501,16 @@ void OutputDevice::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize
// we have beautiful scaling algorithms, let's use them
if (aDestSizePixel != rSrcSizePixel && rSrcSizePixel.Width() != 0 && rSrcSizePixel.Height() != 0)
{
- double fScaleX = double(aDestSizePixel.Width()) / rSrcSizePixel.Width();
- double fScaleY = double(aDestSizePixel.Height()) / rSrcSizePixel.Height();
+ double fScaleX = std::abs(aDestSizePixel.Width() / double(rSrcSizePixel.Width()));
+ double fScaleY = std::abs(aDestSizePixel.Height() / double(rSrcSizePixel.Height()));
aScaledBitmapEx.Scale(fScaleX, fScaleY);
- aSrcSizePixel = aDestSizePixel;
+ // Negative size values are used for mirroring, but Scale already takes
+ // care of mirroring so convert all negative values to positive.
+ aSrcSizePixel = Size(std::abs(aDestSizePixel.Width()),
+ std::abs(aDestSizePixel.Height()));
+
aSrcPtPixel.X() = rSrcPtPixel.X() * fScaleX;
aSrcPtPixel.Y() = rSrcPtPixel.Y() * fScaleY;
}