diff options
author | Armin Le Grand <alg@apache.org> | 2012-11-12 19:27:33 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-12 20:11:00 +0100 |
commit | f7d373d18f965b36f310d44044bdba6476f6eb03 (patch) | |
tree | bbeb4a1d1208e69b411031eb994a56802ec93314 /vcl | |
parent | a108ecfabf7930b0cdff16ab819ec36a7cb0a3a6 (diff) |
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
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/bitmap3.cxx | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index 6507d5de4f38..5bcdb9ff2cfe 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; } // ------------------------------------------------------------------------ |