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

Armin Le Grand alg at apache.org
Wed Jun 12 12:12:16 PDT 2013


 vcl/source/gdi/bitmap3.cxx |   37 +++++++++++++++++++++++++------------
 1 file changed, 25 insertions(+), 12 deletions(-)

New commits:
commit f7d373d18f965b36f310d44044bdba6476f6eb03
Author: Armin Le Grand <alg at apache.org>
Date:   Mon Nov 12 19:27:33 2012 +0000

    Added ColorDepth change test with assertion to the Bitmap::Scale method
    
    (cherry picked from commit 4be8cc079667cca2cae91dba9e46c16ccff1537f)
    
    Conflicts:
    	vcl/source/gdi/bitmap3.cxx
    
    Change-Id: I329ebc63df0dd96d4a2596ad42ff1aa14405bdd4

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 6507d5d..5bcdb9f 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -855,33 +855,39 @@ sal_Bool Bitmap::ImplConvertGhosted()
 
 sal_Bool Bitmap::Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nScaleFlag )
 {
+    bool bRetval(false);
+
+#ifdef DBG_UTIL
+    const sal_uInt16 nStartCount(GetBitCount());
+#endif
+
     if(basegfx::fTools::equalZero(rScaleX) || basegfx::fTools::equalZero(rScaleY))
     {
         // no scale
-        return true;
+        bRetval = true;
     }
 
     if(basegfx::fTools::equal(rScaleX, 1.0) && basegfx::fTools::equal(rScaleY, 1.0))
     {
         // no scale
-        return true;
+        bRetval = true;
     }
 
     switch(nScaleFlag)
     {
         case BMP_SCALE_NONE :
         {
-            return false;
+            bRetval = false;
             break;
         }
         case BMP_SCALE_FAST :
         {
-            return ImplScaleFast( rScaleX, rScaleY );
+            bRetval = ImplScaleFast( rScaleX, rScaleY );
             break;
         }
         case BMP_SCALE_INTERPOLATE :
         {
-            return ImplScaleInterpolate( rScaleX, rScaleY );
+            bRetval = ImplScaleInterpolate( rScaleX, rScaleY );
             break;
         }
         case BMP_SCALE_SUPER :
@@ -889,12 +895,12 @@ sal_Bool Bitmap::Scale( const double& rScaleX, const double& rScaleY, sal_uInt32
             if(GetSizePixel().Width() < 2 || GetSizePixel().Height() < 2)
             {
                 // fallback to ImplScaleFast
-                return ImplScaleFast( rScaleX, rScaleY );
+                bRetval = ImplScaleFast( rScaleX, rScaleY );
             }
             else
             {
                 // #i121233# use method from symphony
-                return ImplScaleSuper( rScaleX, rScaleY );
+                bRetval = ImplScaleSuper( rScaleX, rScaleY );
             }
             break;
         }
@@ -902,33 +908,40 @@ sal_Bool Bitmap::Scale( const double& rScaleX, const double& rScaleY, sal_uInt32
         {
             const Lanczos3Kernel kernel;
 
-            return ImplScaleConvolution( rScaleX, rScaleY, kernel );
+            bRetval = ImplScaleConvolution( rScaleX, rScaleY, kernel );
             break;
         }
         case BMP_SCALE_BICUBIC :
         {
             const BicubicKernel kernel;
 
-            return ImplScaleConvolution( rScaleX, rScaleY, kernel );
+            bRetval = ImplScaleConvolution( rScaleX, rScaleY, kernel );
             break;
         }
         case BMP_SCALE_BILINEAR :
         {
             const BilinearKernel kernel;
 
-            return ImplScaleConvolution( rScaleX, rScaleY, kernel );
+            bRetval = ImplScaleConvolution( rScaleX, rScaleY, kernel );
             break;
         }
         case BMP_SCALE_BOX :
         {
             const BoxKernel kernel;
 
-            return ImplScaleConvolution( rScaleX, rScaleY, kernel );
+            bRetval = ImplScaleConvolution( rScaleX, rScaleY, kernel );
             break;
         }
     }
 
-    return false;
+#ifdef DBG_UTIL
+    if(bRetval && nStartCount != GetBitCount())
+    {
+        OSL_ENSURE(false, "Bitmap::Scale has changed the ColorDepth, this should *not* happen (!)");
+    }
+#endif
+
+    return bRetval;
 }
 
 // ------------------------------------------------------------------------


More information about the Libreoffice-commits mailing list