diff options
author | Armin Le Grand <alg@apache.org> | 2012-11-12 19:27:33 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2012-11-12 19:27:33 +0000 |
commit | 4be8cc079667cca2cae91dba9e46c16ccff1537f (patch) | |
tree | 00be54aad0e0ffb87404aa63c6ff4bad57328ebd | |
parent | 61e12761a4887b8a6bbb977996cd1ea4080d00ac (diff) |
Added ColorDepth change test with assertion to the Bitmap::Scale method
Notes
Notes:
merged as: f7d373d18f965b36f310d44044bdba6476f6eb03
-rw-r--r-- | vcl/source/gdi/bitmap3.cxx | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index 9698e53d12f6..dcc11a8878b5 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -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; } // ------------------------------------------------------------------------ |