summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-05-12 22:00:22 +0200
committerTomaž Vajngerl <quikee@gmail.com>2013-05-12 22:04:16 +0200
commit71cca07fc18149b37fb22956257dd0b8f5df89a1 (patch)
treef4cf1268b059d115acef0fd08197d1aba20cdb76 /vcl
parentbaebeb7de4c5f9511e45c2846ec2a72861a948c0 (diff)
Remove old scale convolution methods from Bitmap.
Change-Id: I0265a4b4c7b2fda267eb56ef719fd6a53d49d460
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/bitmap3.cxx103
1 files changed, 0 insertions, 103 deletions
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 6816bb9aa49f..e639b360098f 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();