Kaydet (Commit) 4be8cc07 authored tarafından Armin Le Grand's avatar Armin Le Grand

Added ColorDepth change test with assertion to the Bitmap::Scale method

üst 61e12761
......@@ -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& rScaleX, const double& rScaleY, sal_uLong
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& rScaleX, const double& rScaleY, sal_uLong
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& rScaleX, const double& rScaleY, sal_uLong
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& rScaleX, const double& rScaleY, sal_uLong
{
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;
}
// ------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment