[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - vcl/source

Tomaž Vajngerl tomaz.vajngerl at collabora.com
Wed Apr 30 13:14:42 PDT 2014


 vcl/source/gdi/outdev2.cxx |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 10fef58379630c9d8e8ba76258baee917959e7c5
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Wed Apr 30 16:46:40 2014 +0200

    fdo#77126 BitmapEx.Scale already takes care of mirroring
    
    Change-Id: I320a5ec1da62cc1a8b3cb227298ecaf99f305a6f
    
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index 8ec9c21..48ec303 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -1010,12 +1010,16 @@ void OutputDevice::ImplDrawBitmapEx( 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;
         }


More information about the Libreoffice-commits mailing list