[Libreoffice-commits] core.git: vcl/source

pasqualm pasqual.milvaques at gmail.com
Wed Apr 6 09:26:06 UTC 2016


 vcl/source/outdev/bitmap.cxx |   19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

New commits:
commit 1e3d634e413abf2b4c2a6c70a87586d8c598054c
Author: pasqualm <pasqual.milvaques at gmail.com>
Date:   Mon Feb 29 00:09:02 2016 +0100

    tdf#90319: make image flipping work when aLinearContext(...) code path chosen
    
    Image flipping can be processed following different code paths in bitmap.cxx.
    Has been verified that it was broken in Linux Mint (with cinnamon) because
    there a buggy code path was chosen which was not fixed
    in commit 3119440a80282692640378fde5e37974ab63f096 in master.
    This commit solves the problem for this code path
    
    Change-Id: I22257e70761ca5469c0424b5f9925681cfd4e2e3
    Reviewed-on: https://gerrit.libreoffice.org/22753
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jacobo Aragunde PĂ©rez <jaragunde at igalia.com>

diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index b6e86e3..e0e953f 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -728,37 +728,28 @@ struct LinearScaleContext
         const long nSrcWidth = aBitmapRect.GetWidth();
         const long nSrcHeight = aBitmapRect.GetHeight();
 
-        const bool bHMirr = aOutSize.Width() < 0;
-        const bool bVMirr = aOutSize.Height() < 0;
-
         generateSimpleMap(
             nSrcWidth,  aDstRect.GetWidth(), aBitmapRect.Left(),
-            aOutSize.Width(),  nOffX, bHMirr, mpMapX.get(), mpMapXOffset.get());
+            aOutSize.Width(),  nOffX, mpMapX.get(), mpMapXOffset.get());
 
         generateSimpleMap(
             nSrcHeight, aDstRect.GetHeight(), aBitmapRect.Top(),
-            aOutSize.Height(), nOffY, bVMirr, mpMapY.get(), mpMapYOffset.get());
+            aOutSize.Height(), nOffY, mpMapY.get(), mpMapYOffset.get());
     }
 
 private:
 
     static void generateSimpleMap(long nSrcDimension, long nDstDimension, long nDstLocation,
-                                  long nOutDimention, long nOffset, bool bMirror, long* pMap, long* pMapOffset)
+                                  long nOutDimention, long nOffset, long* pMap, long* pMapOffset)
     {
-        long nMirrorOffset = 0;
 
-        if (bMirror)
-            nMirrorOffset = (nDstLocation << 1) + nSrcDimension - 1L;
-
-        const double fReverseScale = (nOutDimention > 1L) ? (nSrcDimension - 1L) / double(nOutDimention - 1L) : 0.0;
+        const double fReverseScale = (std::abs(nOutDimention) > 1L) ? (nSrcDimension - 1L) / double(std::abs(nOutDimention) - 1L) : 0.0;
 
         long nSampleRange = std::max(0L, nSrcDimension - 2L);
 
         for (long i = 0L; i < nDstDimension; i++)
         {
-            double fTemp = ((nOffset + i) * fReverseScale);
-            if (bMirror)
-                fTemp = nMirrorOffset - fTemp - 1L;
+            double fTemp = std::abs((nOffset + i) * fReverseScale);
 
             pMap[i] = MinMax(nDstLocation + long(fTemp), 0, nSampleRange);
             pMapOffset[i] = (long) ((fTemp - pMap[i]) * 128.0);


More information about the Libreoffice-commits mailing list