You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2012/11/12 21:27:33 UTC
svn commit: r1408441 - /incubator/ooo/trunk/main/vcl/source/gdi/bitmap3.cxx
Author: alg
Date: Mon Nov 12 20:27:33 2012
New Revision: 1408441
URL: http://svn.apache.org/viewvc?rev=1408441&view=rev
Log:
Added ColorDepth change test with assertion to the Bitmap::Scale method
Modified:
incubator/ooo/trunk/main/vcl/source/gdi/bitmap3.cxx
Modified: incubator/ooo/trunk/main/vcl/source/gdi/bitmap3.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/bitmap3.cxx?rev=1408441&r1=1408440&r2=1408441&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/bitmap3.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/bitmap3.cxx Mon Nov 12 20:27:33 2012
@@ -906,10 +906,13 @@ sal_Bool Bitmap::ImplConvertGhosted()
sal_Bool Bitmap::Scale( const double& rScaleX, const double& rScaleY, sal_uLong nScaleFlag )
{
+ bool bRetval(false);
+
#ifdef DBG_UTIL
// #121233# allow to test the different scalers in debug build with source
// level debugger (change nNumber to desired action)
static sal_uInt16 nNumber(0);
+ const sal_uInt16 nStartCount(GetBitCount());
switch(nNumber)
{
@@ -929,7 +932,7 @@ sal_Bool Bitmap::Scale( const double& rS
if(basegfx::fTools::equalZero(rScaleX) && basegfx::fTools::equalZero(rScaleY))
{
// no scale
- return true;
+ bRetval = true;
}
else
{
@@ -949,17 +952,17 @@ sal_Bool Bitmap::Scale( const double& rS
default:
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 :
@@ -967,12 +970,12 @@ sal_Bool Bitmap::Scale( const double& rS
if(GetSizePixel().Width() < 2 || GetSizePixel().Height() < 2)
{
// fallback to ImplScaleFast
- return ImplScaleFast( rScaleX, rScaleY );
+ bRetval = ImplScaleFast( rScaleX, rScaleY );
}
else
{
// #121233# use method from symphony
- return ImplScaleSuper( rScaleX, rScaleY );
+ bRetval = ImplScaleSuper( rScaleX, rScaleY );
}
break;
}
@@ -980,35 +983,41 @@ sal_Bool Bitmap::Scale( const double& rS
{
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;
}
}
}
- // should not happen
- 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;
}
// ------------------------------------------------------------------------