diff options
Diffstat (limited to 'vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx')
-rw-r--r-- | vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx b/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx index b679e172d554..bf210fa21236 100644 --- a/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx +++ b/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx @@ -35,9 +35,9 @@ namespace { void ImplCalculateContributions( - const long aSourceSize, - const long aDestinationSize, - long& aNumberOfContributions, + const tools::Long aSourceSize, + const tools::Long aDestinationSize, + tools::Long& aNumberOfContributions, std::vector<sal_Int16>& rWeights, std::vector<sal_Int32>& rPixels, std::vector<sal_Int32>& rCounts, @@ -48,19 +48,19 @@ void ImplCalculateContributions( const double fScaledRadius((fScale < 1.0) ? fSamplingRadius / fScale : fSamplingRadius); const double fFilterFactor(std::min(fScale, 1.0)); - aNumberOfContributions = (long(fabs(ceil(fScaledRadius))) * 2) + 1; - const long nAllocSize(aDestinationSize * aNumberOfContributions); + aNumberOfContributions = (tools::Long(fabs(ceil(fScaledRadius))) * 2) + 1; + const tools::Long nAllocSize(aDestinationSize * aNumberOfContributions); rWeights.resize(nAllocSize); rPixels.resize(nAllocSize); rCounts.resize(aDestinationSize); - for(long i(0); i < aDestinationSize; i++) + for(tools::Long i(0); i < aDestinationSize; i++) { - const long aIndex(i * aNumberOfContributions); + const tools::Long aIndex(i * aNumberOfContributions); const double aCenter(i / fScale); const sal_Int32 aLeft(static_cast< sal_Int32 >(floor(aCenter - fScaledRadius))); const sal_Int32 aRight(static_cast< sal_Int32 >(ceil(aCenter + fScaledRadius))); - long aCurrentCount(0); + tools::Long aCurrentCount(0); for(sal_Int32 j(aLeft); j <= aRight; j++) { @@ -73,8 +73,8 @@ void ImplCalculateContributions( } // Handling on edges - const long aPixelIndex(MinMax(j, 0, aSourceSize - 1)); - const long nIndex(aIndex + aCurrentCount); + const tools::Long aPixelIndex(MinMax(j, 0, aSourceSize - 1)); + const tools::Long nIndex(aIndex + aCurrentCount); // scale the weight by 255 since we're converting from float to int rWeights[nIndex] = aWeight * 255; @@ -91,8 +91,8 @@ bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& rSc { // Do horizontal filtering OSL_ENSURE(rScaleX > 0.0, "Error in scaling: Mirror given in non-mirror-capable method (!)"); - const long nWidth(rSource.GetSizePixel().Width()); - const long nNewWidth(FRound(nWidth * rScaleX)); + const tools::Long nWidth(rSource.GetSizePixel().Width()); + const tools::Long nNewWidth(FRound(nWidth * rScaleX)); if(nWidth == nNewWidth) { @@ -106,9 +106,9 @@ bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& rSc std::vector<sal_Int16> aWeights; std::vector<sal_Int32> aPixels; std::vector<sal_Int32> aCounts; - long aNumberOfContributions(0); + tools::Long aNumberOfContributions(0); - const long nHeight(rSource.GetSizePixel().Height()); + const tools::Long nHeight(rSource.GetSizePixel().Height()); ImplCalculateContributions(nWidth, nNewWidth, aNumberOfContributions, aWeights, aPixels, aCounts, aKernel); rTarget = Bitmap(Size(nNewWidth, nHeight), 24); BitmapScopedWriteAccess pWriteAcc(rTarget); @@ -116,21 +116,21 @@ bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& rSc if(bResult) { - for(long y(0); y < nHeight; y++) + for(tools::Long y(0); y < nHeight; y++) { Scanline pScanline = pWriteAcc->GetScanline( y ); Scanline pScanlineRead = pReadAcc->GetScanline( y ); - for(long x(0); x < nNewWidth; x++) + for(tools::Long x(0); x < nNewWidth; x++) { - const long aBaseIndex(x * aNumberOfContributions); + const tools::Long aBaseIndex(x * aNumberOfContributions); sal_Int32 aSum(0); sal_Int32 aValueRed(0); sal_Int32 aValueGreen(0); sal_Int32 aValueBlue(0); - for(long j(0); j < aCounts[x]; j++) + for(tools::Long j(0); j < aCounts[x]; j++) { - const long aIndex(aBaseIndex + j); + const tools::Long aIndex(aBaseIndex + j); const sal_Int16 aWeight(aWeights[aIndex]); BitmapColor aColor; @@ -181,8 +181,8 @@ bool ImplScaleConvolutionVer(Bitmap& rSource, Bitmap& rTarget, const double& rSc { // Do vertical filtering OSL_ENSURE(rScaleY > 0.0, "Error in scaling: Mirror given in non-mirror-capable method (!)"); - const long nHeight(rSource.GetSizePixel().Height()); - const long nNewHeight(FRound(nHeight * rScaleY)); + const tools::Long nHeight(rSource.GetSizePixel().Height()); + const tools::Long nNewHeight(FRound(nHeight * rScaleY)); if(nHeight == nNewHeight) { @@ -196,9 +196,9 @@ bool ImplScaleConvolutionVer(Bitmap& rSource, Bitmap& rTarget, const double& rSc std::vector<sal_Int16> aWeights; std::vector<sal_Int32> aPixels; std::vector<sal_Int32> aCounts; - long aNumberOfContributions(0); + tools::Long aNumberOfContributions(0); - const long nWidth(rSource.GetSizePixel().Width()); + const tools::Long nWidth(rSource.GetSizePixel().Width()); ImplCalculateContributions(nHeight, nNewHeight, aNumberOfContributions, aWeights, aPixels, aCounts, aKernel); rTarget = Bitmap(Size(nWidth, nNewHeight), 24); BitmapScopedWriteAccess pWriteAcc(rTarget); @@ -207,24 +207,24 @@ bool ImplScaleConvolutionVer(Bitmap& rSource, Bitmap& rTarget, const double& rSc if(pWriteAcc) { std::vector<BitmapColor> aScanline(nHeight); - for(long x(0); x < nWidth; x++) + for(tools::Long x(0); x < nWidth; x++) { - for(long y(0); y < nHeight; y++) + for(tools::Long y(0); y < nHeight; y++) if(pReadAcc->HasPalette()) aScanline[y] = pReadAcc->GetPaletteColor(pReadAcc->GetPixelIndex(y, x)); else aScanline[y] = pReadAcc->GetPixel(y, x); - for(long y(0); y < nNewHeight; y++) + for(tools::Long y(0); y < nNewHeight; y++) { - const long aBaseIndex(y * aNumberOfContributions); + const tools::Long aBaseIndex(y * aNumberOfContributions); sal_Int32 aSum(0); sal_Int32 aValueRed(0); sal_Int32 aValueGreen(0); sal_Int32 aValueBlue(0); - for(long j(0); j < aCounts[y]; j++) + for(tools::Long j(0); j < aCounts[y]; j++) { - const long aIndex(aBaseIndex + j); + const tools::Long aIndex(aBaseIndex + j); const sal_Int16 aWeight(aWeights[aIndex]); aSum += aWeight; const BitmapColor & aColor = aScanline[aPixels[aIndex]]; @@ -271,10 +271,10 @@ bool ImplScaleConvolution(Bitmap& rBitmap, const double& rScaleX, const double& const bool bMirrorVer(rScaleY < 0.0); const double fScaleX(bMirrorHor ? -rScaleX : rScaleX); const double fScaleY(bMirrorVer ? -rScaleY : rScaleY); - const long nWidth(rBitmap.GetSizePixel().Width()); - const long nHeight(rBitmap.GetSizePixel().Height()); - const long nNewWidth(FRound(nWidth * fScaleX)); - const long nNewHeight(FRound(nHeight * fScaleY)); + const tools::Long nWidth(rBitmap.GetSizePixel().Width()); + const tools::Long nHeight(rBitmap.GetSizePixel().Height()); + const tools::Long nNewWidth(FRound(nWidth * fScaleX)); + const tools::Long nNewHeight(FRound(nHeight * fScaleY)); const bool bScaleHor(nWidth != nNewWidth); const bool bScaleVer(nHeight != nNewHeight); const bool bMirror(bMirrorHor || bMirrorVer); @@ -300,8 +300,8 @@ bool ImplScaleConvolution(Bitmap& rBitmap, const double& rScaleX, const double& nMirrorFlags |= BmpMirrorFlags::Vertical; } - const long nStartSize(nWidth * nHeight); - const long nEndSize(nNewWidth * nNewHeight); + const tools::Long nStartSize(nWidth * nHeight); + const tools::Long nEndSize(nNewWidth * nNewHeight); bMirrorAfter = nStartSize > nEndSize; @@ -315,8 +315,8 @@ bool ImplScaleConvolution(Bitmap& rBitmap, const double& rScaleX, const double& if (bResult) { - const long nInBetweenSizeHorFirst(nHeight * nNewWidth); - const long nInBetweenSizeVerFirst(nNewHeight * nWidth); + const tools::Long nInBetweenSizeHorFirst(nHeight * nNewWidth); + const tools::Long nInBetweenSizeVerFirst(nNewHeight * nWidth); Bitmap aSource(rBitmap); if(nInBetweenSizeHorFirst < nInBetweenSizeVerFirst) |