include/vcl/bitmap.hxx | 9 --- vcl/source/gdi/bitmap3.cxx | 103 --------------------------------------------- 2 files changed, 112 deletions(-)
New commits: commit 71cca07fc18149b37fb22956257dd0b8f5df89a1 Author: Tomaž Vajngerl <[email protected]> Date: Sun May 12 22:00:22 2013 +0200 Remove old scale convolution methods from Bitmap. Change-Id: I0265a4b4c7b2fda267eb56ef719fd6a53d49d460 diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index 7cf248c..292c3fb 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -345,15 +345,6 @@ public: SAL_DLLPRIVATE sal_Bool ImplScaleInterpolate( const double& rScaleX, const double& rScaleY ); SAL_DLLPRIVATE sal_Bool ImplScaleSuper( const double& rScaleX, const double& rScaleY ); SAL_DLLPRIVATE sal_Bool ImplScaleConvolution( const double& rScaleX, const double& rScaleY, const Kernel& aKernel); - SAL_DLLPRIVATE bool ImplScaleConvolution( const double& rScaleX, const double& rScaleY, Kernel& aKernel); - SAL_DLLPRIVATE bool ImplTransformAveraging( const double& rScaleX, const double& rScaleY, - const Rectangle& rRotatedRectangle, const long nAngle10, const Color& rFillColor ); - SAL_DLLPRIVATE bool ImplTransformBilinearFiltering( const double& rScaleX, const double& rScaleY, - const Rectangle& rRotatedRectangle, const long nAngle10, const Color& rFillColor ); - - SAL_DLLPRIVATE static void ImplCalculateContributions( const int aSourceSize, const int aDestinationSize, - int& aNumberOfContributions, double*& pWeights, int*& pPixels, int*& pCount, - Kernel& aKernel ); SAL_DLLPRIVATE bool ImplConvolutionPass( Bitmap& aNewBitmap, const int nNewSize, BitmapReadAccess* pReadAcc, int aNumberOfContributions, double* pWeights, int* pPixels, int* pCount ); diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index 6816bb9..e639b36 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -3396,109 +3396,6 @@ sal_Bool Bitmap::Adjust( short nLuminancePercent, short nContrastPercent, return bRet; } -bool Bitmap::ImplScaleConvolution( const double& rScaleX, const double& rScaleY, Kernel& aKernel ) -{ - const long nWidth = GetSizePixel().Width(); - const long nHeight = GetSizePixel().Height(); - const long nNewWidth = FRound( nWidth * rScaleX ); - const long nNewHeight = FRound( nHeight * rScaleY ); - - bool bResult; - BitmapReadAccess* pReadAcc; - Bitmap aNewBitmap; - - int aNumberOfContributions; - double* pWeights; - int* pPixels; - int* pCount; - - // Handle negative scales safely cf. other ImplScale methods - if( ( nNewWidth < 1L ) || ( nNewHeight < 1L ) ) - return false; - - // Do horizontal filtering - ImplCalculateContributions( nWidth, nNewWidth, aNumberOfContributions, pWeights, pPixels, pCount, aKernel ); - pReadAcc = AcquireReadAccess(); - aNewBitmap = Bitmap( Size( nHeight, nNewWidth ), 24); - bResult = ImplConvolutionPass( aNewBitmap, nNewWidth, pReadAcc, aNumberOfContributions, pWeights, pPixels, pCount ); - - ReleaseAccess( pReadAcc ); - delete[] pWeights; - delete[] pCount; - delete[] pPixels; - - if ( !bResult ) - return bResult; - - // Swap Bitmaps - ImplAssignWithSize( aNewBitmap ); - - // Do vertical filtering - ImplCalculateContributions( nHeight, nNewHeight, aNumberOfContributions, pWeights, pPixels, pCount, aKernel ); - pReadAcc = AcquireReadAccess(); - aNewBitmap = Bitmap( Size( nNewWidth, nNewHeight ), 24); - bResult = ImplConvolutionPass( aNewBitmap, nNewHeight, pReadAcc, aNumberOfContributions, pWeights, pPixels, pCount ); - - ReleaseAccess( pReadAcc ); - delete[] pWeights; - delete[] pCount; - delete[] pPixels; - - if ( !bResult ) - return bResult; - - ImplAssignWithSize( aNewBitmap ); - - return true; -} - -void Bitmap::ImplCalculateContributions( const int aSourceSize, const int aDestinationSize, int& aNumberOfContributions, - double*& pWeights, int*& pPixels, int*& pCount, Kernel& aKernel) -{ - const double aSamplingRadius = aKernel.GetWidth(); - const double aScale = aDestinationSize / (double) aSourceSize; - const double aScaledRadius = (aScale < 1.0) ? aSamplingRadius / aScale : aSamplingRadius; - const double aFilterFactor = (aScale < 1.0) ? aScale : 1.0; - - aNumberOfContributions = (int) ( 2 * ceil(aScaledRadius) + 1 ); - - pWeights = new double[ aDestinationSize*aNumberOfContributions ]; - pPixels = new int[ aDestinationSize*aNumberOfContributions ]; - pCount = new int[ aDestinationSize ]; - - double aWeight, aCenter; - int aIndex, aLeft, aRight; - int aPixelIndex, aCurrentCount; - - for ( int i = 0; i < aDestinationSize; i++ ) - { - aIndex = i * aNumberOfContributions; - aCurrentCount = 0; - aCenter = i / aScale; - - aLeft = (int) floor(aCenter - aScaledRadius); - aRight = (int) ceil (aCenter + aScaledRadius); - - for ( int j = aLeft; j <= aRight; j++ ) - { - aWeight = aKernel.Calculate( aFilterFactor * ( aCenter - (double) j ) ); - - // Reduce calculations with ignoring weights of 0.0 - if (fabs(aWeight) < 0.0001) - continue; - - // Handling on edges - aPixelIndex = MinMax( j, 0, aSourceSize - 1); - - pWeights[ aIndex + aCurrentCount ] = aWeight; - pPixels[ aIndex + aCurrentCount ] = aPixelIndex; - - aCurrentCount++; - } - pCount[ i ] = aCurrentCount; - } -} - bool Bitmap::ImplConvolutionPass(Bitmap& aNewBitmap, const int nNewSize, BitmapReadAccess* pReadAcc, int aNumberOfContributions, double* pWeights, int* pPixels, int* pCount) { BitmapWriteAccess* pWriteAcc = aNewBitmap.AcquireWriteAccess();
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
