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

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Mon Jan 19 02:52:00 PST 2015


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

New commits:
commit bfde8099193f852330e9c9a3d7805395837e56da
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon Jan 19 18:58:18 2015 +0900

    Don't allow a negative sample range. Fixes test breakage.
    
    Change-Id: I3cf79b590b7d4c5aab92ccaebf6fd9c7eda529f7

diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 1ee1eef..97a7fc5 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -717,7 +717,9 @@ private:
         if (bMirror)
             nMirrorOffset = (nDstLocation << 1) + nSrcDimension - 1L;
 
-        double fReverseScale = (nSrcDimension - 1L) / double(nOutDimention - 1L);
+        const double fReverseScale = (nOutDimention > 1L) ? (nSrcDimension - 1L) / double(nOutDimention - 1L) : 0.0;
+
+        long nSampleRange = std::max(0L, nSrcDimension - 2L);
 
         for (long i = 0L; i < nDstDimension; i++)
         {
@@ -725,7 +727,7 @@ private:
             if (bMirror)
                 fTemp = nMirrorOffset - fTemp - 1L;
 
-            pMap[i] = MinMax(nDstLocation + long(fTemp), 0, nSrcDimension - 2L);
+            pMap[i] = MinMax(nDstLocation + long(fTemp), 0, nSampleRange);
             pMapOffset[i] = (long) ((fTemp - pMap[i]) * 128.0);
         }
     }


More information about the Libreoffice-commits mailing list