vcl/source/bitmap/BitmapAlphaClampFilter.cxx | 4 vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx | 76 ++--- vcl/source/bitmap/BitmapColorQuantizationFilter.cxx | 32 +- vcl/source/bitmap/BitmapColorizeFilter.cxx | 8 vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx | 12 vcl/source/bitmap/BitmapDisabledImageFilter.cxx | 4 vcl/source/bitmap/BitmapDuoToneFilter.cxx | 8 vcl/source/bitmap/BitmapEmbossGreyFilter.cxx | 28 - vcl/source/bitmap/BitmapFastScaleFilter.cxx | 26 - vcl/source/bitmap/BitmapFilterStackBlur.cxx | 189 ++++++------- vcl/source/bitmap/BitmapGaussianSeparableBlurFilter.cxx | 4 vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx | 76 ++--- vcl/source/bitmap/BitmapLightenFilter.cxx | 4 vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx | 4 vcl/source/bitmap/BitmapMedianFilter.cxx | 18 - vcl/source/bitmap/BitmapMonochromeFilter.cxx | 12 vcl/source/bitmap/BitmapMosaicFilter.cxx | 6 vcl/source/bitmap/BitmapPopArtFilter.cxx | 8 vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx | 74 ++--- vcl/source/bitmap/BitmapScaleSuperFilter.cxx | 198 +++++++------- vcl/source/bitmap/BitmapSeparableUnsharpenFilter.cxx | 8 vcl/source/bitmap/BitmapSepiaFilter.cxx | 14 vcl/source/bitmap/BitmapShadowFilter.cxx | 4 vcl/source/bitmap/BitmapSimpleColorQuantizationFilter.cxx | 12 vcl/source/bitmap/BitmapSobelGreyFilter.cxx | 30 +- vcl/source/bitmap/BitmapSolarizeFilter.cxx | 8 26 files changed, 432 insertions(+), 435 deletions(-)
New commits: commit 118aa4b843eff3d48ff877f2e3b63de554c70ea4 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sun Oct 31 08:56:51 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Oct 31 13:02:27 2021 +0100 tools::Long->sal_Int32 in bitmap filters Change-Id: Ic37f238824e1af11c924d3bccc4933cee364d798 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124505 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/vcl/source/bitmap/BitmapAlphaClampFilter.cxx b/vcl/source/bitmap/BitmapAlphaClampFilter.cxx index 245d925a9766..69691d51c2d7 100644 --- a/vcl/source/bitmap/BitmapAlphaClampFilter.cxx +++ b/vcl/source/bitmap/BitmapAlphaClampFilter.cxx @@ -23,11 +23,11 @@ BitmapEx BitmapAlphaClampFilter::execute(BitmapEx const& rBitmapEx) const AlphaScopedWriteAccess pWriteAlpha(aBitmapAlpha); const Size aSize(rBitmapEx.GetSizePixel()); - for (tools::Long nY = 0; nY < aSize.Height(); ++nY) + for (sal_Int32 nY = 0; nY < sal_Int32(aSize.Height()); ++nY) { Scanline pScanAlpha = pWriteAlpha->GetScanline(nY); - for (tools::Long nX = 0; nX < aSize.Width(); ++nX) + for (sal_Int32 nX = 0; nX < sal_Int32(aSize.Width()); ++nX) { BitmapColor aBitmapAlphaValue(pWriteAlpha->GetPixelFromData(pScanAlpha, nX)); if (aBitmapAlphaValue.GetIndex() > mcThreshold) diff --git a/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx b/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx index 3cd0bb87e4eb..5d3f1d2772e1 100644 --- a/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx +++ b/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx @@ -28,12 +28,12 @@ struct FilterSharedData { BitmapReadAccess* mpReadAccess; BitmapWriteAccess* mpWriteAccess; - tools::Long mnRadius; + sal_Int32 mnRadius; sal_uInt8 mnOutsideVal; Color maOutsideColor; FilterSharedData(Bitmap::ScopedReadAccess& rReadAccess, BitmapScopedWriteAccess& rWriteAccess, - tools::Long nRadius, sal_uInt8 nOutsideVal) + sal_Int32 nRadius, sal_uInt8 nOutsideVal) : mpReadAccess(rReadAccess.get()) , mpWriteAccess(rWriteAccess.get()) , mnRadius(nRadius) @@ -73,14 +73,14 @@ template <typename MorphologyOp, int nComponentWidth> struct Value bLookOutside ? rShared.mnOutsideVal : MorphologyOp::initVal); } - void apply(const BitmapReadAccess* pReadAccess, tools::Long x, tools::Long y, + void apply(const BitmapReadAccess* pReadAccess, sal_Int32 x, sal_Int32 y, sal_uInt8* pHint = nullptr) { sal_uInt8* pSource = (pHint ? pHint : pReadAccess->GetScanline(y)) + nWidthBytes * x; std::transform(pSource, pSource + nWidthBytes, aResult, aResult, MorphologyOp::apply); } - void copy(const BitmapWriteAccess* pWriteAccess, tools::Long x, tools::Long y, + void copy(const BitmapWriteAccess* pWriteAccess, sal_Int32 x, sal_Int32 y, sal_uInt8* pHint = nullptr) { sal_uInt8* pDest = (pHint ? pHint : pWriteAccess->GetScanline(y)) + nWidthBytes * x; @@ -104,7 +104,7 @@ template <typename MorphologyOp> struct Value<MorphologyOp, 0> { } - void apply(const BitmapReadAccess* pReadAccess, tools::Long x, tools::Long y, + void apply(const BitmapReadAccess* pReadAccess, sal_Int32 x, sal_Int32 y, sal_uInt8* /*pHint*/ = nullptr) { const auto& rSource = pReadAccess->GetColor(y, x); @@ -114,15 +114,15 @@ template <typename MorphologyOp> struct Value<MorphologyOp, 0> MorphologyOp::apply(rSource.GetBlue(), aResult.GetBlue())); } - void copy(BitmapWriteAccess* pWriteAccess, tools::Long x, tools::Long y, + void copy(BitmapWriteAccess* pWriteAccess, sal_Int32 x, sal_Int32 y, sal_uInt8* /*pHint*/ = nullptr) { pWriteAccess->SetPixel(y, x, aResult); } }; -bool GetMinMax(tools::Long nCenter, tools::Long nRadius, tools::Long nMaxLimit, tools::Long& nMin, - tools::Long& nMax) +bool GetMinMax(sal_Int32 nCenter, sal_Int32 nRadius, sal_Int32 nMaxLimit, sal_Int32& nMin, + sal_Int32& nMax) { nMin = nCenter - nRadius; nMax = nCenter + nRadius; @@ -142,27 +142,27 @@ bool GetMinMax(tools::Long nCenter, tools::Long nRadius, tools::Long nMaxLimit, template <typename MorphologyOp, int nComponentWidth> struct pass { - static void Horizontal(FilterSharedData const& rShared, const tools::Long nStart, - const tools::Long nEnd) + static void Horizontal(FilterSharedData const& rShared, const sal_Int32 nStart, + const sal_Int32 nEnd) { BitmapReadAccess* pReadAccess = rShared.mpReadAccess; BitmapWriteAccess* pWriteAccess = rShared.mpWriteAccess; - const tools::Long nLastIndex = pReadAccess->Width() - 1; + const sal_Int32 nLastIndex = pReadAccess->Width() - 1; - for (tools::Long y = nStart; y <= nEnd; y++) + for (sal_Int32 y = nStart; y <= nEnd; y++) { // Optimization sal_uInt8* const pSourceHint = pReadAccess->GetScanline(y); sal_uInt8* const pDestHint = pWriteAccess->GetScanline(y); - for (tools::Long x = 0; x <= nLastIndex; x++) + for (sal_Int32 x = 0; x <= nLastIndex; x++) { // This processes [nRadius * 2 + 1] pixels of source per resulting pixel // TODO: try to optimize this to not process same pixels repeatedly - tools::Long iMin, iMax; + sal_Int32 iMin, iMax; const bool bLookOutside = GetMinMax(x, rShared.mnRadius, nLastIndex, iMin, iMax); Value<MorphologyOp, nComponentWidth> aResult(rShared, bLookOutside); - for (tools::Long i = iMin; i <= iMax; ++i) + for (sal_Int32 i = iMin; i <= iMax; ++i) aResult.apply(pReadAccess, i, y, pSourceHint); aResult.copy(pWriteAccess, x, y, pDestHint); @@ -170,24 +170,24 @@ template <typename MorphologyOp, int nComponentWidth> struct pass } } - static void Vertical(FilterSharedData const& rShared, const tools::Long nStart, - const tools::Long nEnd) + static void Vertical(FilterSharedData const& rShared, const sal_Int32 nStart, + const sal_Int32 nEnd) { BitmapReadAccess* pReadAccess = rShared.mpReadAccess; BitmapWriteAccess* pWriteAccess = rShared.mpWriteAccess; - const tools::Long nLastIndex = pReadAccess->Height() - 1; + const sal_Int32 nLastIndex = pReadAccess->Height() - 1; - for (tools::Long x = nStart; x <= nEnd; x++) + for (sal_Int32 x = nStart; x <= nEnd; x++) { - for (tools::Long y = 0; y <= nLastIndex; y++) + for (sal_Int32 y = 0; y <= nLastIndex; y++) { // This processes [nRadius * 2 + 1] pixels of source per resulting pixel // TODO: try to optimize this to not process same pixels repeatedly - tools::Long iMin, iMax; + sal_Int32 iMin, iMax; const bool bLookOutside = GetMinMax(y, rShared.mnRadius, nLastIndex, iMin, iMax); Value<MorphologyOp, nComponentWidth> aResult(rShared, bLookOutside); - for (tools::Long i = iMin; i <= iMax; ++i) + for (sal_Int32 i = iMin; i <= iMax; ++i) aResult.apply(pReadAccess, x, i); aResult.copy(pWriteAccess, x, y); @@ -196,18 +196,18 @@ template <typename MorphologyOp, int nComponentWidth> struct pass } }; -typedef void (*passFn)(FilterSharedData const& rShared, tools::Long nStart, tools::Long nEnd); +typedef void (*passFn)(FilterSharedData const& rShared, sal_Int32 nStart, sal_Int32 nEnd); class FilterTask : public comphelper::ThreadTask { passFn mpFunction; FilterSharedData& mrShared; - tools::Long mnStart; - tools::Long mnEnd; + sal_Int32 mnStart; + sal_Int32 mnEnd; public: explicit FilterTask(const std::shared_ptr<comphelper::ThreadTaskTag>& pTag, passFn pFunction, - FilterSharedData& rShared, tools::Long nStart, tools::Long nEnd) + FilterSharedData& rShared, sal_Int32 nStart, sal_Int32 nEnd) : comphelper::ThreadTask(pTag) , mpFunction(pFunction) , mrShared(rShared) @@ -219,10 +219,10 @@ public: virtual void doWork() override { mpFunction(mrShared, mnStart, mnEnd); } }; -constexpr tools::Long nThreadStrip = 16; +constexpr sal_Int32 nThreadStrip = 16; template <typename MorphologyOp, int nComponentWidth> -void runFilter(Bitmap& rBitmap, const tools::Long nRadius, const bool bParallel, +void runFilter(Bitmap& rBitmap, const sal_Int32 nRadius, const bool bParallel, bool bUseValueOutside, sal_uInt8 nValueOutside) { using myPass = pass<MorphologyOp, nComponentWidth>; @@ -239,11 +239,11 @@ void runFilter(Bitmap& rBitmap, const tools::Long nRadius, const bool bParallel, BitmapScopedWriteAccess pWriteAccess(rBitmap); FilterSharedData aSharedData(pReadAccess, pWriteAccess, nRadius, nOutsideVal); - const tools::Long nLastIndex = pReadAccess->Height() - 1; - tools::Long nStripStart = 0; + const sal_Int32 nLastIndex = pReadAccess->Height() - 1; + sal_Int32 nStripStart = 0; for (; nStripStart < nLastIndex - nThreadStrip; nStripStart += nThreadStrip) { - tools::Long nStripEnd = nStripStart + nThreadStrip - 1; + sal_Int32 nStripEnd = nStripStart + nThreadStrip - 1; auto pTask(std::make_unique<FilterTask>(pTag, myPass::Horizontal, aSharedData, nStripStart, nStripEnd)); rShared.pushTask(std::move(pTask)); @@ -257,11 +257,11 @@ void runFilter(Bitmap& rBitmap, const tools::Long nRadius, const bool bParallel, BitmapScopedWriteAccess pWriteAccess(rBitmap); FilterSharedData aSharedData(pReadAccess, pWriteAccess, nRadius, nOutsideVal); - const tools::Long nLastIndex = pReadAccess->Width() - 1; - tools::Long nStripStart = 0; + const sal_Int32 nLastIndex = pReadAccess->Width() - 1; + sal_Int32 nStripStart = 0; for (; nStripStart < nLastIndex - nThreadStrip; nStripStart += nThreadStrip) { - tools::Long nStripEnd = nStripStart + nThreadStrip - 1; + sal_Int32 nStripEnd = nStripStart + nThreadStrip - 1; auto pTask(std::make_unique<FilterTask>(pTag, myPass::Vertical, aSharedData, nStripStart, nStripEnd)); rShared.pushTask(std::move(pTask)); @@ -282,16 +282,16 @@ void runFilter(Bitmap& rBitmap, const tools::Long nRadius, const bool bParallel, Bitmap::ScopedReadAccess pReadAccess(rBitmap); BitmapScopedWriteAccess pWriteAccess(rBitmap); FilterSharedData aSharedData(pReadAccess, pWriteAccess, nRadius, nOutsideVal); - tools::Long nFirstIndex = 0; - tools::Long nLastIndex = pReadAccess->Height() - 1; + sal_Int32 nFirstIndex = 0; + sal_Int32 nLastIndex = pReadAccess->Height() - 1; myPass::Horizontal(aSharedData, nFirstIndex, nLastIndex); } { Bitmap::ScopedReadAccess pReadAccess(rBitmap); BitmapScopedWriteAccess pWriteAccess(rBitmap); FilterSharedData aSharedData(pReadAccess, pWriteAccess, nRadius, nOutsideVal); - tools::Long nFirstIndex = 0; - tools::Long nLastIndex = pReadAccess->Width() - 1; + sal_Int32 nFirstIndex = 0; + sal_Int32 nLastIndex = pReadAccess->Width() - 1; myPass::Vertical(aSharedData, nFirstIndex, nLastIndex); } } diff --git a/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx b/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx index faafd64b81b9..45d39add373d 100644 --- a/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx +++ b/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx @@ -45,17 +45,17 @@ BitmapEx BitmapColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const const sal_uInt32 nColorOffset = 256 / nColorsPerComponent; const sal_uInt32 nTotalColors = nColorsPerComponent * nColorsPerComponent * nColorsPerComponent; - const tools::Long nWidth = pRAcc->Width(); - const tools::Long nHeight = pRAcc->Height(); + const sal_Int32 nWidth = pRAcc->Width(); + const sal_Int32 nHeight = pRAcc->Height(); std::unique_ptr<PopularColorCount[]> pCountTable(new PopularColorCount[nTotalColors]); memset(pCountTable.get(), 0, nTotalColors * sizeof(PopularColorCount)); - for (tools::Long nR = 0, nIndex = 0; nR < 256; nR += nColorOffset) + for (sal_Int32 nR = 0, nIndex = 0; nR < 256; nR += nColorOffset) { - for (tools::Long nG = 0; nG < 256; nG += nColorOffset) + for (sal_Int32 nG = 0; nG < 256; nG += nColorOffset) { - for (tools::Long nB = 0; nB < 256; nB += nColorOffset) + for (sal_Int32 nB = 0; nB < 256; nB += nColorOffset) { pCountTable[nIndex].mnIndex = nIndex; nIndex++; @@ -65,10 +65,10 @@ BitmapEx BitmapColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const if (pRAcc->HasPalette()) { - for (tools::Long nY = 0; nY < nHeight; nY++) + for (sal_Int32 nY = 0; nY < nHeight; nY++) { Scanline pScanlineRead = pRAcc->GetScanline(nY); - for (tools::Long nX = 0; nX < nWidth; nX++) + for (sal_Int32 nX = 0; nX < nWidth; nX++) { const BitmapColor& rCol = pRAcc->GetPaletteColor(pRAcc->GetIndexFromData(pScanlineRead, nX)); @@ -83,10 +83,10 @@ BitmapEx BitmapColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const } else { - for (tools::Long nY = 0; nY < nHeight; nY++) + for (sal_Int32 nY = 0; nY < nHeight; nY++) { Scanline pScanlineRead = pRAcc->GetScanline(nY); - for (tools::Long nX = 0; nX < nWidth; nX++) + for (sal_Int32 nX = 0; nX < nWidth; nX++) { const BitmapColor aCol(pRAcc->GetPixelFromData(pScanlineRead, nX)); pCountTable[((static_cast<sal_uInt32>(aCol.GetRed()) >> nRightShiftBits) @@ -137,11 +137,11 @@ BitmapEx BitmapColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const BitmapColor aDstCol(sal_uInt8(0)); std::unique_ptr<sal_uInt8[]> pIndexMap(new sal_uInt8[nTotalColors]); - for (tools::Long nR = 0, nIndex = 0; nR < 256; nR += nColorOffset) + for (sal_Int32 nR = 0, nIndex = 0; nR < 256; nR += nColorOffset) { - for (tools::Long nG = 0; nG < 256; nG += nColorOffset) + for (sal_Int32 nG = 0; nG < 256; nG += nColorOffset) { - for (tools::Long nB = 0; nB < 256; nB += nColorOffset) + for (sal_Int32 nB = 0; nB < 256; nB += nColorOffset) { pIndexMap[nIndex++] = static_cast<sal_uInt8>(aNewPal.GetBestIndex( BitmapColor(static_cast<sal_uInt8>(nR), static_cast<sal_uInt8>(nG), @@ -152,11 +152,11 @@ BitmapEx BitmapColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const if (pRAcc->HasPalette()) { - for (tools::Long nY = 0; nY < nHeight; nY++) + for (sal_Int32 nY = 0; nY < nHeight; nY++) { Scanline pScanline = pWAcc->GetScanline(nY); Scanline pScanlineRead = pRAcc->GetScanline(nY); - for (tools::Long nX = 0; nX < nWidth; nX++) + for (sal_Int32 nX = 0; nX < nWidth; nX++) { const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetIndexFromData(pScanlineRead, nX)); @@ -174,12 +174,12 @@ BitmapEx BitmapColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const } else { - for (tools::Long nY = 0; nY < nHeight; nY++) + for (sal_Int32 nY = 0; nY < nHeight; nY++) { Scanline pScanline = pWAcc->GetScanline(nY); Scanline pScanlineRead = pRAcc->GetScanline(nY); - for (tools::Long nX = 0; nX < nWidth; nX++) + for (sal_Int32 nX = 0; nX < nWidth; nX++) { const BitmapColor aCol(pRAcc->GetPixelFromData(pScanlineRead, nX)); aDstCol.SetIndex(pIndexMap[((static_cast<sal_uInt32>(aCol.GetRed()) diff --git a/vcl/source/bitmap/BitmapColorizeFilter.cxx b/vcl/source/bitmap/BitmapColorizeFilter.cxx index 068bbbffb647..5f58f6147986 100644 --- a/vcl/source/bitmap/BitmapColorizeFilter.cxx +++ b/vcl/source/bitmap/BitmapColorizeFilter.cxx @@ -23,13 +23,13 @@ BitmapEx BitmapColorizeFilter::execute(BitmapEx const& rBitmapEx) const return rBitmapEx; BitmapColor aBitmapColor; - const tools::Long nW = pWriteAccess->Width(); - const tools::Long nH = pWriteAccess->Height(); + const sal_Int32 nW = pWriteAccess->Width(); + const sal_Int32 nH = pWriteAccess->Height(); std::vector<sal_uInt8> aMapR(256); std::vector<sal_uInt8> aMapG(256); std::vector<sal_uInt8> aMapB(256); - tools::Long nX; - tools::Long nY; + sal_Int32 nX; + sal_Int32 nY; const sal_uInt8 cR = maColor.GetRed(); const sal_uInt8 cG = maColor.GetGreen(); diff --git a/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx b/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx index ce5715ea8530..db68bff1de38 100644 --- a/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx +++ b/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx @@ -23,7 +23,7 @@ BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx const& rBitmapEx) const { Bitmap aBitmap(rBitmapEx.GetBitmap()); - const tools::Long nDivisor = 8; + const sal_Int32 nDivisor = 8; Bitmap::ScopedReadAccess pReadAcc(aBitmap); bool bRet = false; @@ -34,10 +34,10 @@ BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx const& rBitmapEx) const if (pWriteAcc) { - const tools::Long nWidth = pWriteAcc->Width(), nWidth2 = nWidth + 2; - const tools::Long nHeight = pWriteAcc->Height(), nHeight2 = nHeight + 2; - std::unique_ptr<tools::Long[]> pColm(new tools::Long[nWidth2]); - std::unique_ptr<tools::Long[]> pRows(new tools::Long[nHeight2]); + const sal_Int32 nWidth = pWriteAcc->Width(), nWidth2 = nWidth + 2; + const sal_Int32 nHeight = pWriteAcc->Height(), nHeight2 = nHeight + 2; + std::unique_ptr<sal_Int32[]> pColm(new sal_Int32[nWidth2]); + std::unique_ptr<sal_Int32[]> pRows(new sal_Int32[nHeight2]); std::unique_ptr<BitmapColor[]> pColRow1(new BitmapColor[nWidth2]); std::unique_ptr<BitmapColor[]> pColRow2(new BitmapColor[nWidth2]); std::unique_ptr<BitmapColor[]> pColRow3(new BitmapColor[nWidth2]); @@ -45,7 +45,7 @@ BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx const& rBitmapEx) const BitmapColor* pRowTmp2 = pColRow2.get(); BitmapColor* pRowTmp3 = pColRow3.get(); BitmapColor* pColor; - tools::Long nY, nX, i, nSumR, nSumG, nSumB, nMatrixVal, nTmp; + sal_Int32 nY, nX, i, nSumR, nSumG, nSumB, nMatrixVal, nTmp; std::array<std::array<sal_Int32, 256>, 9> aKoeff; sal_Int32* pTmp; diff --git a/vcl/source/bitmap/BitmapDisabledImageFilter.cxx b/vcl/source/bitmap/BitmapDisabledImageFilter.cxx index 7a702effa0c3..3bcf4cf9d85c 100644 --- a/vcl/source/bitmap/BitmapDisabledImageFilter.cxx +++ b/vcl/source/bitmap/BitmapDisabledImageFilter.cxx @@ -31,12 +31,12 @@ BitmapEx BitmapDisabledImageFilter::execute(BitmapEx const& rBitmapEx) const Bitmap::ScopedReadAccess pRead(aReadBitmap); if (pRead && pGrey) { - for (tools::Long nY = 0; nY < aSize.Height(); ++nY) + for (sal_Int32 nY = 0; nY < sal_Int32(aSize.Height()); ++nY) { Scanline pGreyScan = pGrey->GetScanline(nY); Scanline pReadScan = pRead->GetScanline(nY); - for (tools::Long nX = 0; nX < aSize.Width(); ++nX) + for (sal_Int32 nX = 0; nX < sal_Int32(aSize.Width()); ++nX) { // Get the luminance from RGB color and remap the value from 0-255 to 160-224 const BitmapColor aColor = pRead->GetPixelFromData(pReadScan, nX); diff --git a/vcl/source/bitmap/BitmapDuoToneFilter.cxx b/vcl/source/bitmap/BitmapDuoToneFilter.cxx index 3c91245460b7..41c3f60fc24d 100644 --- a/vcl/source/bitmap/BitmapDuoToneFilter.cxx +++ b/vcl/source/bitmap/BitmapDuoToneFilter.cxx @@ -26,8 +26,8 @@ BitmapEx BitmapDuoToneFilter::execute(BitmapEx const& rBitmapEx) const { Bitmap aBitmap(rBitmapEx.GetBitmap()); - const tools::Long nWidth = aBitmap.GetSizePixel().Width(); - const tools::Long nHeight = aBitmap.GetSizePixel().Height(); + const sal_Int32 nWidth = aBitmap.GetSizePixel().Width(); + const sal_Int32 nHeight = aBitmap.GetSizePixel().Height(); Bitmap aResultBitmap(aBitmap.GetSizePixel(), vcl::PixelFormat::N24_BPP); Bitmap::ScopedReadAccess pReadAcc(aBitmap); @@ -35,9 +35,9 @@ BitmapEx BitmapDuoToneFilter::execute(BitmapEx const& rBitmapEx) const const BitmapColor aColorOne(mnColorOne); const BitmapColor aColorTwo(mnColorTwo); - for (tools::Long x = 0; x < nWidth; x++) + for (sal_Int32 x = 0; x < nWidth; x++) { - for (tools::Long y = 0; y < nHeight; y++) + for (sal_Int32 y = 0; y < nHeight; y++) { BitmapColor aColor = pReadAcc->GetColor(y, x); sal_uInt8 nLuminance = aColor.GetLuminance(); diff --git a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx index 0ace97a9b630..d25950b1c9f2 100644 --- a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx +++ b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx @@ -41,23 +41,23 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& rBitmapEx) const if (pWriteAcc) { BitmapColor aGrey(sal_uInt8(0)); - const tools::Long nWidth = pWriteAcc->Width(); - const tools::Long nHeight = pWriteAcc->Height(); - tools::Long nGrey11, nGrey12, nGrey13; - tools::Long nGrey21, nGrey22, nGrey23; - tools::Long nGrey31, nGrey32, nGrey33; + const sal_Int32 nWidth = pWriteAcc->Width(); + const sal_Int32 nHeight = pWriteAcc->Height(); + sal_Int32 nGrey11, nGrey12, nGrey13; + sal_Int32 nGrey21, nGrey22, nGrey23; + sal_Int32 nGrey31, nGrey32, nGrey33; double fAzim = basegfx::deg2rad(mnAzimuthAngle100 * 0.01); double fElev = basegfx::deg2rad(mnElevationAngle100 * 0.01); - std::unique_ptr<tools::Long[]> pHMap(new tools::Long[nWidth + 2]); - std::unique_ptr<tools::Long[]> pVMap(new tools::Long[nHeight + 2]); - tools::Long nX, nY, nNx, nNy, nDotL; - const tools::Long nLx = FRound(cos(fAzim) * cos(fElev) * 255.0); - const tools::Long nLy = FRound(sin(fAzim) * cos(fElev) * 255.0); - const tools::Long nLz = FRound(sin(fElev) * 255.0); + std::unique_ptr<sal_Int32[]> pHMap(new sal_Int32[nWidth + 2]); + std::unique_ptr<sal_Int32[]> pVMap(new sal_Int32[nHeight + 2]); + sal_Int32 nX, nY, nNx, nNy, nDotL; + const sal_Int32 nLx = FRound(cos(fAzim) * cos(fElev) * 255.0); + const sal_Int32 nLy = FRound(sin(fAzim) * cos(fElev) * 255.0); + const sal_Int32 nLz = FRound(sin(fElev) * 255.0); const auto nZ2 = ((6 * 255) / 4) * ((6 * 255) / 4); - const tools::Long nNzLz = ((6 * 255) / 4) * nLz; + const sal_Int32 nNzLz = ((6 * 255) / 4) * nLz; const sal_uInt8 cLz - = static_cast<sal_uInt8>(std::clamp(nLz, tools::Long(0), tools::Long(255))); + = static_cast<sal_uInt8>(std::clamp(nLz, sal_Int32(0), sal_Int32(255))); // fill mapping tables pHMap[0] = 0; @@ -115,7 +115,7 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& rBitmapEx) const if (nX < (nWidth - 1)) { - const tools::Long nNextX = pHMap[nX + 3]; + const sal_Int32 nNextX = pHMap[nX + 3]; nGrey11 = nGrey12; nGrey12 = nGrey13; diff --git a/vcl/source/bitmap/BitmapFastScaleFilter.cxx b/vcl/source/bitmap/BitmapFastScaleFilter.cxx index 0a1143d28e04..362de6de706d 100644 --- a/vcl/source/bitmap/BitmapFastScaleFilter.cxx +++ b/vcl/source/bitmap/BitmapFastScaleFilter.cxx @@ -32,8 +32,8 @@ BitmapEx BitmapFastScaleFilter::execute(BitmapEx const& rBitmapEx) const Bitmap aBitmap(rBitmapEx.GetBitmap()); const Size aSizePix(aBitmap.GetSizePixel()); - const tools::Long nNewWidth = FRound(aSizePix.Width() * mfScaleX); - const tools::Long nNewHeight = FRound(aSizePix.Height() * mfScaleY); + const sal_Int32 nNewWidth = FRound(aSizePix.Width() * mfScaleX); + const sal_Int32 nNewHeight = FRound(aSizePix.Height() * mfScaleY); bool bRet = false; SAL_INFO("vcl.gdi", "New width: " << nNewWidth << "\nNew height: " << nNewHeight); @@ -50,34 +50,34 @@ BitmapEx BitmapFastScaleFilter::execute(BitmapEx const& rBitmapEx) const if (pWriteAcc) { - const tools::Long nScanlineSize = pWriteAcc->GetScanlineSize(); - const tools::Long nNewHeight1 = nNewHeight - 1; + const sal_Int32 nScanlineSize = pWriteAcc->GetScanlineSize(); + const sal_Int32 nNewHeight1 = nNewHeight - 1; if (nNewWidth && nNewHeight) { const double nWidth = pReadAcc->Width(); const double nHeight = pReadAcc->Height(); - std::unique_ptr<tools::Long[]> pLutX(new tools::Long[nNewWidth]); - std::unique_ptr<tools::Long[]> pLutY(new tools::Long[nNewHeight]); + std::unique_ptr<sal_Int32[]> pLutX(new sal_Int32[nNewWidth]); + std::unique_ptr<sal_Int32[]> pLutY(new sal_Int32[nNewHeight]); - for (tools::Long nX = 0; nX < nNewWidth; nX++) + for (sal_Int32 nX = 0; nX < nNewWidth; nX++) { - pLutX[nX] = tools::Long(nX * nWidth / nNewWidth); + pLutX[nX] = sal_Int32(nX * nWidth / nNewWidth); } - for (tools::Long nY = 0; nY < nNewHeight; nY++) + for (sal_Int32 nY = 0; nY < nNewHeight; nY++) { - pLutY[nY] = tools::Long(nY * nHeight / nNewHeight); + pLutY[nY] = sal_Int32(nY * nHeight / nNewHeight); } - tools::Long nActY = 0; + sal_Int32 nActY = 0; while (nActY < nNewHeight) { - tools::Long nMapY = pLutY[nActY]; + sal_Int32 nMapY = pLutY[nActY]; Scanline pScanline = pWriteAcc->GetScanline(nActY); Scanline pScanlineRead = pReadAcc->GetScanline(nMapY); - for (tools::Long nX = 0; nX < nNewWidth; nX++) + for (sal_Int32 nX = 0; nX < nNewWidth; nX++) { pWriteAcc->SetPixelOnData( pScanline, nX, diff --git a/vcl/source/bitmap/BitmapFilterStackBlur.cxx b/vcl/source/bitmap/BitmapFilterStackBlur.cxx index c23adad0176f..be1ab84296c7 100644 --- a/vcl/source/bitmap/BitmapFilterStackBlur.cxx +++ b/vcl/source/bitmap/BitmapFilterStackBlur.cxx @@ -51,13 +51,13 @@ struct BlurSharedData { BitmapReadAccess* mpReadAccess; BitmapWriteAccess* mpWriteAccess; - tools::Long mnRadius; - tools::Long mnComponentWidth; - tools::Long mnDiv; - tools::Long mnColorChannels; + sal_Int32 mnRadius; + sal_Int32 mnComponentWidth; + sal_Int32 mnDiv; + sal_Int32 mnColorChannels; BlurSharedData(BitmapReadAccess* pReadAccess, BitmapWriteAccess* pWriteAccess, - tools::Long aRadius, tools::Long nComponentWidth, tools::Long nColorChannels) + sal_Int32 aRadius, sal_Int32 nComponentWidth, sal_Int32 nColorChannels) : mpReadAccess(pReadAccess) , mpWriteAccess(pWriteAccess) , mnRadius(aRadius) @@ -73,12 +73,12 @@ struct BlurArrays BlurSharedData maShared; std::vector<sal_uInt8> maStackBuffer; - std::vector<tools::Long> maPositionTable; - std::vector<tools::Long> maWeightTable; + std::vector<sal_Int32> maPositionTable; + std::vector<sal_Int32> maWeightTable; - std::vector<tools::Long> mnSumVector; - std::vector<tools::Long> mnInSumVector; - std::vector<tools::Long> mnOutSumVector; + std::vector<sal_Int32> mnSumVector; + std::vector<sal_Int32> mnInSumVector; + std::vector<sal_Int32> mnOutSumVector; BlurArrays(BlurSharedData const& rShared) : maShared(rShared) @@ -91,39 +91,39 @@ struct BlurArrays { } - void initializeWeightAndPositions(tools::Long nLastIndex) + void initializeWeightAndPositions(sal_Int32 nLastIndex) { - for (tools::Long i = 0; i < maShared.mnDiv; i++) + for (sal_Int32 i = 0; i < maShared.mnDiv; i++) { - maPositionTable[i] = std::clamp(i - maShared.mnRadius, tools::Long(0), nLastIndex); + maPositionTable[i] = std::clamp(i - maShared.mnRadius, sal_Int32(0), nLastIndex); maWeightTable[i] = maShared.mnRadius + 1 - std::abs(i - maShared.mnRadius); } } - tools::Long getMultiplyValue() const + sal_Int32 getMultiplyValue() const { - return static_cast<tools::Long>(constMultiplyTable[maShared.mnRadius]); + return static_cast<sal_Int32>(constMultiplyTable[maShared.mnRadius]); } - tools::Long getShiftValue() const + sal_Int32 getShiftValue() const { - return static_cast<tools::Long>(constShiftTable[maShared.mnRadius]); + return static_cast<sal_Int32>(constShiftTable[maShared.mnRadius]); } }; -typedef void (*BlurRangeFn)(BlurSharedData const& rShared, tools::Long nStartY, tools::Long nEndY); +typedef void (*BlurRangeFn)(BlurSharedData const& rShared, sal_Int32 nStartY, sal_Int32 nEndY); class BlurTask : public comphelper::ThreadTask { BlurRangeFn mpBlurFunction; BlurSharedData& mrShared; - tools::Long mnStartY; - tools::Long mnEndY; + sal_Int32 mnStartY; + sal_Int32 mnEndY; public: explicit BlurTask(const std::shared_ptr<comphelper::ThreadTaskTag>& pTag, - BlurRangeFn pBlurFunction, BlurSharedData& rShared, tools::Long nStartY, - tools::Long nEndY) + BlurRangeFn pBlurFunction, BlurSharedData& rShared, sal_Int32 nStartY, + sal_Int32 nEndY) : comphelper::ThreadTask(pTag) , mpBlurFunction(pBlurFunction) , mrShared(rShared) @@ -137,42 +137,42 @@ public: struct SumFunction24 { - static inline void add(tools::Long*& pValue1, tools::Long nConstant) + static inline void add(sal_Int32*& pValue1, sal_Int32 nConstant) { pValue1[0] += nConstant; pValue1[1] += nConstant; pValue1[2] += nConstant; } - static inline void set(tools::Long*& pValue1, tools::Long nConstant) + static inline void set(sal_Int32*& pValue1, sal_Int32 nConstant) { pValue1[0] = nConstant; pValue1[1] = nConstant; pValue1[2] = nConstant; } - static inline void add(tools::Long*& pValue1, const sal_uInt8* pValue2) + static inline void add(sal_Int32*& pValue1, const sal_uInt8* pValue2) { pValue1[0] += pValue2[0]; pValue1[1] += pValue2[1]; pValue1[2] += pValue2[2]; } - static inline void add(tools::Long*& pValue1, const tools::Long* pValue2) + static inline void add(sal_Int32*& pValue1, const sal_Int32* pValue2) { pValue1[0] += pValue2[0]; pValue1[1] += pValue2[1]; pValue1[2] += pValue2[2]; } - static inline void sub(tools::Long*& pValue1, const sal_uInt8* pValue2) + static inline void sub(sal_Int32*& pValue1, const sal_uInt8* pValue2) { pValue1[0] -= pValue2[0]; pValue1[1] -= pValue2[1]; pValue1[2] -= pValue2[2]; } - static inline void sub(tools::Long*& pValue1, const tools::Long* pValue2) + static inline void sub(sal_Int32*& pValue1, const sal_Int32* pValue2) { pValue1[0] -= pValue2[0]; pValue1[1] -= pValue2[1]; @@ -186,8 +186,8 @@ struct SumFunction24 pValue1[2] = pValue2[2]; } - static inline void assignMulAndShr(sal_uInt8*& result, const tools::Long* sum, - tools::Long multiply, tools::Long shift) + static inline void assignMulAndShr(sal_uInt8*& result, const sal_Int32* sum, sal_Int32 multiply, + sal_Int32 shift) { result[0] = (multiply * sum[0]) >> shift; result[1] = (multiply * sum[1]) >> shift; @@ -197,29 +197,26 @@ struct SumFunction24 struct SumFunction8 { - static inline void add(tools::Long*& pValue1, tools::Long nConstant) - { - pValue1[0] += nConstant; - } + static inline void add(sal_Int32*& pValue1, sal_Int32 nConstant) { pValue1[0] += nConstant; } - static inline void set(tools::Long*& pValue1, tools::Long nConstant) { pValue1[0] = nConstant; } + static inline void set(sal_Int32*& pValue1, sal_Int32 nConstant) { pValue1[0] = nConstant; } - static inline void add(tools::Long*& pValue1, const sal_uInt8* pValue2) + static inline void add(sal_Int32*& pValue1, const sal_uInt8* pValue2) { pValue1[0] += pValue2[0]; } - static inline void add(tools::Long*& pValue1, const tools::Long* pValue2) + static inline void add(sal_Int32*& pValue1, const sal_Int32* pValue2) { pValue1[0] += pValue2[0]; } - static inline void sub(tools::Long*& pValue1, const sal_uInt8* pValue2) + static inline void sub(sal_Int32*& pValue1, const sal_uInt8* pValue2) { pValue1[0] -= pValue2[0]; } - static inline void sub(tools::Long*& pValue1, const tools::Long* pValue2) + static inline void sub(sal_Int32*& pValue1, const sal_Int32* pValue2) { pValue1[0] -= pValue2[0]; } @@ -229,15 +226,15 @@ struct SumFunction8 pValue1[0] = pValue2[0]; } - static inline void assignMulAndShr(sal_uInt8*& result, const tools::Long* sum, - tools::Long multiply, tools::Long shift) + static inline void assignMulAndShr(sal_uInt8*& result, const sal_Int32* sum, sal_Int32 multiply, + sal_Int32 shift) { result[0] = (multiply * sum[0]) >> shift; } }; template <typename SumFunction> -void stackBlurHorizontal(BlurSharedData const& rShared, tools::Long nStart, tools::Long nEnd) +void stackBlurHorizontal(BlurSharedData const& rShared, sal_Int32 nStart, sal_Int32 nEnd) { BitmapReadAccess* pReadAccess = rShared.mpReadAccess; BitmapWriteAccess* pWriteAccess = rShared.mpWriteAccess; @@ -247,34 +244,34 @@ void stackBlurHorizontal(BlurSharedData const& rShared, tools::Long nStart, tool sal_uInt8* pStack = aArrays.maStackBuffer.data(); sal_uInt8* pStackPtr; - tools::Long nWidth = pReadAccess->Width(); - tools::Long nLastIndexX = nWidth - 1; + sal_Int32 nWidth = pReadAccess->Width(); + sal_Int32 nLastIndexX = nWidth - 1; - tools::Long nMultiplyValue = aArrays.getMultiplyValue(); - tools::Long nShiftValue = aArrays.getShiftValue(); + sal_Int32 nMultiplyValue = aArrays.getMultiplyValue(); + sal_Int32 nShiftValue = aArrays.getShiftValue(); - tools::Long nRadius = rShared.mnRadius; - tools::Long nComponentWidth = rShared.mnComponentWidth; - tools::Long nDiv = rShared.mnDiv; + sal_Int32 nRadius = rShared.mnRadius; + sal_Int32 nComponentWidth = rShared.mnComponentWidth; + sal_Int32 nDiv = rShared.mnDiv; Scanline pSourcePointer; Scanline pDestinationPointer; - tools::Long nXPosition; - tools::Long nStackIndex; - tools::Long nStackIndexStart; - tools::Long nWeight; + sal_Int32 nXPosition; + sal_Int32 nStackIndex; + sal_Int32 nStackIndexStart; + sal_Int32 nWeight; aArrays.initializeWeightAndPositions(nLastIndexX); - tools::Long* nSum = aArrays.mnSumVector.data(); - tools::Long* nInSum = aArrays.mnInSumVector.data(); - tools::Long* nOutSum = aArrays.mnOutSumVector.data(); + sal_Int32* nSum = aArrays.mnSumVector.data(); + sal_Int32* nInSum = aArrays.mnInSumVector.data(); + sal_Int32* nOutSum = aArrays.mnOutSumVector.data(); - tools::Long* pPositionPointer = aArrays.maPositionTable.data(); - tools::Long* pWeightPointer = aArrays.maWeightTable.data(); + sal_Int32* pPositionPointer = aArrays.maPositionTable.data(); + sal_Int32* pWeightPointer = aArrays.maWeightTable.data(); - for (tools::Long y = nStart; y <= nEnd; y++) + for (sal_Int32 y = nStart; y <= nEnd; y++) { SumFunction::set(nSum, 0); SumFunction::set(nInSum, 0); @@ -286,7 +283,7 @@ void stackBlurHorizontal(BlurSharedData const& rShared, tools::Long nStart, tool // for the first pixel; aArrays.maWeightTable has [1,2,3,4,5,6,5,4,3,2,1]. Before looking at // the first row pixel, we pretend to have processed fake previous pixels, as if the row was // extended to the left with the same color as that of the first pixel. - for (tools::Long i = 0; i < nDiv; i++) + for (sal_Int32 i = 0; i < nDiv; i++) { pSourcePointer = pReadAccess->GetScanline(y) + nComponentWidth * pPositionPointer[i]; @@ -313,7 +310,7 @@ void stackBlurHorizontal(BlurSharedData const& rShared, tools::Long nStart, tool pSourcePointer = pReadAccess->GetScanline(y) + nComponentWidth * nXPosition; - for (tools::Long x = 0; x < nWidth; x++) + for (sal_Int32 x = 0; x < nWidth; x++) { pDestinationPointer = pWriteAccess->GetScanline(y) + nComponentWidth * x; @@ -357,7 +354,7 @@ void stackBlurHorizontal(BlurSharedData const& rShared, tools::Long nStart, tool } template <typename SumFunction> -void stackBlurVertical(BlurSharedData const& rShared, tools::Long nStart, tools::Long nEnd) +void stackBlurVertical(BlurSharedData const& rShared, sal_Int32 nStart, sal_Int32 nEnd) { BitmapReadAccess* pReadAccess = rShared.mpReadAccess; BitmapWriteAccess* pWriteAccess = rShared.mpWriteAccess; @@ -367,33 +364,33 @@ void stackBlurVertical(BlurSharedData const& rShared, tools::Long nStart, tools: sal_uInt8* pStack = aArrays.maStackBuffer.data(); sal_uInt8* pStackPtr; - tools::Long nHeight = pReadAccess->Height(); - tools::Long nLastIndexY = nHeight - 1; + sal_Int32 nHeight = pReadAccess->Height(); + sal_Int32 nLastIndexY = nHeight - 1; - tools::Long nMultiplyValue = aArrays.getMultiplyValue(); - tools::Long nShiftValue = aArrays.getShiftValue(); + sal_Int32 nMultiplyValue = aArrays.getMultiplyValue(); + sal_Int32 nShiftValue = aArrays.getShiftValue(); - tools::Long nRadius = rShared.mnRadius; - tools::Long nComponentWidth = rShared.mnComponentWidth; - tools::Long nDiv = rShared.mnDiv; + sal_Int32 nRadius = rShared.mnRadius; + sal_Int32 nComponentWidth = rShared.mnComponentWidth; + sal_Int32 nDiv = rShared.mnDiv; Scanline pSourcePointer; Scanline pDestinationPointer; - tools::Long nYPosition; - tools::Long nStackIndex; - tools::Long nStackIndexStart; - tools::Long nWeight; + sal_Int32 nYPosition; + sal_Int32 nStackIndex; + sal_Int32 nStackIndexStart; + sal_Int32 nWeight; aArrays.initializeWeightAndPositions(nLastIndexY); - tools::Long* nSum = aArrays.mnSumVector.data(); - tools::Long* nInSum = aArrays.mnInSumVector.data(); - tools::Long* nOutSum = aArrays.mnOutSumVector.data(); - tools::Long* pPositionPointer = aArrays.maPositionTable.data(); - tools::Long* pWeightPointer = aArrays.maWeightTable.data(); + sal_Int32* nSum = aArrays.mnSumVector.data(); + sal_Int32* nInSum = aArrays.mnInSumVector.data(); + sal_Int32* nOutSum = aArrays.mnOutSumVector.data(); + sal_Int32* pPositionPointer = aArrays.maPositionTable.data(); + sal_Int32* pWeightPointer = aArrays.maWeightTable.data(); - for (tools::Long x = nStart; x <= nEnd; x++) + for (sal_Int32 x = nStart; x <= nEnd; x++) { SumFunction::set(nSum, 0); SumFunction::set(nInSum, 0); @@ -405,7 +402,7 @@ void stackBlurVertical(BlurSharedData const& rShared, tools::Long nStart, tools: // for the first pixel; aArrays.maWeightTable has [1,2,3,4,5,6,5,4,3,2,1]. Before looking at // the first column pixels, we pretend to have processed fake previous pixels, as if the // column was extended to the top with the same color as that of the first pixel. - for (tools::Long i = 0; i < nDiv; i++) + for (sal_Int32 i = 0; i < nDiv; i++) { pSourcePointer = pReadAccess->GetScanline(pPositionPointer[i]) + nComponentWidth * x; @@ -432,7 +429,7 @@ void stackBlurVertical(BlurSharedData const& rShared, tools::Long nStart, tools: pSourcePointer = pReadAccess->GetScanline(nYPosition) + nComponentWidth * x; - for (tools::Long y = 0; y < nHeight; y++) + for (sal_Int32 y = 0; y < nHeight; y++) { pDestinationPointer = pWriteAccess->GetScanline(y) + nComponentWidth * x; @@ -473,10 +470,10 @@ void stackBlurVertical(BlurSharedData const& rShared, tools::Long nStart, tools: } } -constexpr tools::Long nThreadStrip = 16; +constexpr sal_Int32 nThreadStrip = 16; -void runStackBlur(Bitmap& rBitmap, const tools::Long nRadius, const tools::Long nComponentWidth, - const tools::Long nColorChannels, BlurRangeFn pBlurHorizontalFn, +void runStackBlur(Bitmap& rBitmap, const sal_Int32 nRadius, const sal_Int32 nComponentWidth, + const sal_Int32 nColorChannels, BlurRangeFn pBlurHorizontalFn, BlurRangeFn pBlurVerticalFn, const bool bParallel) { if (bParallel) @@ -492,12 +489,12 @@ void runStackBlur(Bitmap& rBitmap, const tools::Long nRadius, const tools::Long BlurSharedData aSharedData(pReadAccess.get(), pWriteAccess.get(), nRadius, nComponentWidth, nColorChannels); - const tools::Long nFirstIndex = 0; - const tools::Long nLastIndex = pReadAccess->Height() - 1; + const sal_Int32 nFirstIndex = 0; + const sal_Int32 nLastIndex = pReadAccess->Height() - 1; vcl::bitmap::generateStripRanges<nThreadStrip>( nFirstIndex, nLastIndex, - [&](tools::Long const nStart, tools::Long const nEnd, bool const bLast) { + [&](sal_Int32 const nStart, sal_Int32 const nEnd, bool const bLast) { if (!bLast) { auto pTask(std::make_unique<BlurTask>(pTag, pBlurHorizontalFn, @@ -515,12 +512,12 @@ void runStackBlur(Bitmap& rBitmap, const tools::Long nRadius, const tools::Long BlurSharedData aSharedData(pReadAccess.get(), pWriteAccess.get(), nRadius, nComponentWidth, nColorChannels); - const tools::Long nFirstIndex = 0; - const tools::Long nLastIndex = pReadAccess->Width() - 1; + const sal_Int32 nFirstIndex = 0; + const sal_Int32 nLastIndex = pReadAccess->Width() - 1; vcl::bitmap::generateStripRanges<nThreadStrip>( nFirstIndex, nLastIndex, - [&](tools::Long const nStart, tools::Long const nEnd, bool const bLast) { + [&](sal_Int32 const nStart, sal_Int32 const nEnd, bool const bLast) { if (!bLast) { auto pTask(std::make_unique<BlurTask>(pTag, pBlurVerticalFn, @@ -546,8 +543,8 @@ void runStackBlur(Bitmap& rBitmap, const tools::Long nRadius, const tools::Long BitmapScopedWriteAccess pWriteAccess(rBitmap); BlurSharedData aSharedData(pReadAccess.get(), pWriteAccess.get(), nRadius, nComponentWidth, nColorChannels); - tools::Long nFirstIndex = 0; - tools::Long nLastIndex = pReadAccess->Height() - 1; + sal_Int32 nFirstIndex = 0; + sal_Int32 nLastIndex = pReadAccess->Height() - 1; pBlurHorizontalFn(aSharedData, nFirstIndex, nLastIndex); } { @@ -555,8 +552,8 @@ void runStackBlur(Bitmap& rBitmap, const tools::Long nRadius, const tools::Long BitmapScopedWriteAccess pWriteAccess(rBitmap); BlurSharedData aSharedData(pReadAccess.get(), pWriteAccess.get(), nRadius, nComponentWidth, nColorChannels); - tools::Long nFirstIndex = 0; - tools::Long nLastIndex = pReadAccess->Width() - 1; + sal_Int32 nFirstIndex = 0; + sal_Int32 nLastIndex = pReadAccess->Width() - 1; pBlurVerticalFn(aSharedData, nFirstIndex, nLastIndex); } } @@ -567,7 +564,7 @@ void stackBlur24(Bitmap& rBitmap, sal_Int32 nRadius, sal_Int32 nComponentWidth) const bool bParallel = true; // Limit radius nRadius = std::clamp<sal_Int32>(nRadius, 2, 254); - const tools::Long nColorChannels = 3; // 3 color channel + const sal_Int32 nColorChannels = 3; // 3 color channel BlurRangeFn pBlurHorizontalFn = stackBlurHorizontal<SumFunction24>; BlurRangeFn pBlurVerticalFn = stackBlurVertical<SumFunction24>; @@ -581,7 +578,7 @@ void stackBlur8(Bitmap& rBitmap, sal_Int32 nRadius, sal_Int32 nComponentWidth) const bool bParallel = true; // Limit radius nRadius = std::clamp<sal_Int32>(nRadius, 2, 254); - const tools::Long nColorChannels = 1; // 1 color channel + const sal_Int32 nColorChannels = 1; // 1 color channel BlurRangeFn pBlurHorizontalFn = stackBlurHorizontal<SumFunction8>; BlurRangeFn pBlurVerticalFn = stackBlurVertical<SumFunction8>; diff --git a/vcl/source/bitmap/BitmapGaussianSeparableBlurFilter.cxx b/vcl/source/bitmap/BitmapGaussianSeparableBlurFilter.cxx index 93c3399be493..85c790422140 100644 --- a/vcl/source/bitmap/BitmapGaussianSeparableBlurFilter.cxx +++ b/vcl/source/bitmap/BitmapGaussianSeparableBlurFilter.cxx @@ -20,8 +20,8 @@ BitmapEx BitmapGaussianSeparableBlurFilter::execute(BitmapEx const& rBitmapEx) c { Bitmap aBitmap(rBitmapEx.GetBitmap()); - const tools::Long nWidth = aBitmap.GetSizePixel().Width(); - const tools::Long nHeight = aBitmap.GetSizePixel().Height(); + const sal_Int32 nWidth = aBitmap.GetSizePixel().Width(); + const sal_Int32 nHeight = aBitmap.GetSizePixel().Height(); // Prepare Blur Vector int aNumberOfContributions; diff --git a/vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx b/vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx index 973e357fb2f5..5ff3c23ad1e9 100644 --- a/vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx +++ b/vcl/source/bitmap/BitmapInterpolateScaleFilter.cxx @@ -31,8 +31,8 @@ BitmapEx BitmapInterpolateScaleFilter::execute(BitmapEx const& rBitmapEx) const Bitmap aBitmap(rBitmapEx.GetBitmap()); const Size aSizePix(aBitmap.GetSizePixel()); - const tools::Long nNewWidth = FRound(aSizePix.Width() * mfScaleX); - const tools::Long nNewHeight = FRound(aSizePix.Height() * mfScaleY); + const sal_Int32 nNewWidth = FRound(aSizePix.Width() * mfScaleX); + const sal_Int32 nNewHeight = FRound(aSizePix.Height() * mfScaleY); bool bRet = false; if ((nNewWidth > 1) && (nNewHeight > 1)) @@ -40,29 +40,29 @@ BitmapEx BitmapInterpolateScaleFilter::execute(BitmapEx const& rBitmapEx) const Bitmap::ScopedReadAccess pReadAcc(aBitmap); if (pReadAcc) { - tools::Long nWidth = pReadAcc->Width(); - tools::Long nHeight = pReadAcc->Height(); + sal_Int32 nWidth = pReadAcc->Width(); + sal_Int32 nHeight = pReadAcc->Height(); Bitmap aNewBmp(Size(nNewWidth, nHeight), vcl::PixelFormat::N24_BPP); BitmapScopedWriteAccess pWriteAcc(aNewBmp); if (pWriteAcc) { - const tools::Long nNewWidth1 = nNewWidth - 1; - const tools::Long nWidth1 = pReadAcc->Width() - 1; + const sal_Int32 nNewWidth1 = nNewWidth - 1; + const sal_Int32 nWidth1 = pReadAcc->Width() - 1; const double fRevScaleX = static_cast<double>(nWidth1) / nNewWidth1; - std::unique_ptr<tools::Long[]> pLutInt(new tools::Long[nNewWidth]); - std::unique_ptr<tools::Long[]> pLutFrac(new tools::Long[nNewWidth]); + std::unique_ptr<sal_Int32[]> pLutInt(new sal_Int32[nNewWidth]); + std::unique_ptr<sal_Int32[]> pLutFrac(new sal_Int32[nNewWidth]); - for (tools::Long nX = 0, nTemp = nWidth - 2; nX < nNewWidth; nX++) + for (sal_Int32 nX = 0, nTemp = nWidth - 2; nX < nNewWidth; nX++) { double fTemp = nX * fRevScaleX; - pLutInt[nX] = MinMax(static_cast<tools::Long>(fTemp), 0, nTemp); + pLutInt[nX] = MinMax(static_cast<sal_Int32>(fTemp), 0, nTemp); fTemp -= pLutInt[nX]; - pLutFrac[nX] = static_cast<tools::Long>(fTemp * 1024.); + pLutFrac[nX] = static_cast<sal_Int32>(fTemp * 1024.); } - for (tools::Long nY = 0; nY < nHeight; nY++) + for (sal_Int32 nY = 0; nY < nHeight; nY++) { Scanline pScanlineRead = pReadAcc->GetScanline(nY); if (1 == nWidth) @@ -79,7 +79,7 @@ BitmapEx BitmapInterpolateScaleFilter::execute(BitmapEx const& rBitmapEx) const } Scanline pScanline = pWriteAcc->GetScanline(nY); - for (tools::Long nX = 0; nX < nNewWidth; nX++) + for (sal_Int32 nX = 0; nX < nNewWidth; nX++) { pWriteAcc->SetPixelOnData(pScanline, nX, aCol0); } @@ -87,9 +87,9 @@ BitmapEx BitmapInterpolateScaleFilter::execute(BitmapEx const& rBitmapEx) const else { Scanline pScanline = pWriteAcc->GetScanline(nY); - for (tools::Long nX = 0; nX < nNewWidth; nX++) + for (sal_Int32 nX = 0; nX < nNewWidth; nX++) { - tools::Long nTemp = pLutInt[nX]; + sal_Int32 nTemp = pLutInt[nX]; BitmapColor aCol0, aCol1; if (pReadAcc->HasPalette()) @@ -107,12 +107,12 @@ BitmapEx BitmapInterpolateScaleFilter::execute(BitmapEx const& rBitmapEx) const nTemp = pLutFrac[nX]; - tools::Long lXR0 = aCol0.GetRed(); - tools::Long lXG0 = aCol0.GetGreen(); - tools::Long lXB0 = aCol0.GetBlue(); - tools::Long lXR1 = aCol1.GetRed() - lXR0; - tools::Long lXG1 = aCol1.GetGreen() - lXG0; - tools::Long lXB1 = aCol1.GetBlue() - lXB0; + sal_Int32 lXR0 = aCol0.GetRed(); + sal_Int32 lXG0 = aCol0.GetGreen(); + sal_Int32 lXB0 = aCol0.GetBlue(); + sal_Int32 lXR1 = aCol1.GetRed() - lXR0; + sal_Int32 lXG1 = aCol1.GetGreen() - lXG0; + sal_Int32 lXB1 = aCol1.GetBlue() - lXB0; aCol0.SetRed( static_cast<sal_uInt8>((lXR1 * nTemp + (lXR0 << 10)) >> 10)); @@ -143,19 +143,19 @@ BitmapEx BitmapInterpolateScaleFilter::execute(BitmapEx const& rBitmapEx) const if (pReadAcc && pWriteAcc) { - const tools::Long nNewHeight1 = nNewHeight - 1; - const tools::Long nHeight1 = pReadAcc->Height() - 1; + const sal_Int32 nNewHeight1 = nNewHeight - 1; + const sal_Int32 nHeight1 = pReadAcc->Height() - 1; const double fRevScaleY = static_cast<double>(nHeight1) / nNewHeight1; - std::unique_ptr<tools::Long[]> pLutInt(new tools::Long[nNewHeight]); - std::unique_ptr<tools::Long[]> pLutFrac(new tools::Long[nNewHeight]); + std::unique_ptr<sal_Int32[]> pLutInt(new sal_Int32[nNewHeight]); + std::unique_ptr<sal_Int32[]> pLutFrac(new sal_Int32[nNewHeight]); - for (tools::Long nY = 0, nTemp = nHeight - 2; nY < nNewHeight; nY++) + for (sal_Int32 nY = 0, nTemp = nHeight - 2; nY < nNewHeight; nY++) { double fTemp = nY * fRevScaleY; - pLutInt[nY] = MinMax(static_cast<tools::Long>(fTemp), 0, nTemp); + pLutInt[nY] = MinMax(static_cast<sal_Int32>(fTemp), 0, nTemp); fTemp -= pLutInt[nY]; - pLutFrac[nY] = static_cast<tools::Long>(fTemp * 1024.); + pLutFrac[nY] = static_cast<sal_Int32>(fTemp * 1024.); } // after 1st step, bitmap *is* 24bit format (see above) @@ -163,34 +163,34 @@ BitmapEx BitmapInterpolateScaleFilter::execute(BitmapEx const& rBitmapEx) const "in-between format has palette, should not " "happen (!)"); - for (tools::Long nX = 0; nX < nNewWidth; nX++) + for (sal_Int32 nX = 0; nX < nNewWidth; nX++) { if (1 == nHeight) { BitmapColor aCol0 = pReadAcc->GetPixel(0, nX); - for (tools::Long nY = 0; nY < nNewHeight; nY++) + for (sal_Int32 nY = 0; nY < nNewHeight; nY++) { pWriteAcc->SetPixel(nY, nX, aCol0); } } else { - for (tools::Long nY = 0; nY < nNewHeight; nY++) + for (sal_Int32 nY = 0; nY < nNewHeight; nY++) { - tools::Long nTemp = pLutInt[nY]; + sal_Int32 nTemp = pLutInt[nY]; BitmapColor aCol0 = pReadAcc->GetPixel(nTemp++, nX); BitmapColor aCol1 = pReadAcc->GetPixel(nTemp, nX); nTemp = pLutFrac[nY]; - tools::Long lXR0 = aCol0.GetRed(); - tools::Long lXG0 = aCol0.GetGreen(); - tools::Long lXB0 = aCol0.GetBlue(); - tools::Long lXR1 = aCol1.GetRed() - lXR0; - tools::Long lXG1 = aCol1.GetGreen() - lXG0; - tools::Long lXB1 = aCol1.GetBlue() - lXB0; + sal_Int32 lXR0 = aCol0.GetRed(); + sal_Int32 lXG0 = aCol0.GetGreen(); + sal_Int32 lXB0 = aCol0.GetBlue(); + sal_Int32 lXR1 = aCol1.GetRed() - lXR0; + sal_Int32 lXG1 = aCol1.GetGreen() - lXG0; + sal_Int32 lXB1 = aCol1.GetBlue() - lXB0; aCol0.SetRed( static_cast<sal_uInt8>((lXR1 * nTemp + (lXR0 << 10)) >> 10)); diff --git a/vcl/source/bitmap/BitmapLightenFilter.cxx b/vcl/source/bitmap/BitmapLightenFilter.cxx index 35b06566855f..47fa49a70e08 100644 --- a/vcl/source/bitmap/BitmapLightenFilter.cxx +++ b/vcl/source/bitmap/BitmapLightenFilter.cxx @@ -25,11 +25,11 @@ BitmapEx BitmapLightenFilter::execute(BitmapEx const& rBitmapEx) const if (pRead && pWrite) { - for (tools::Long nY = 0; nY < aSize.Height(); ++nY) + for (sal_Int32 nY = 0; nY < sal_Int32(aSize.Height()); ++nY) { Scanline pScanline = pWrite->GetScanline(nY); Scanline pScanlineRead = pRead->GetScanline(nY); - for (tools::Long nX = 0; nX < aSize.Width(); ++nX) + for (sal_Int32 nX = 0; nX < sal_Int32(aSize.Width()); ++nX) { BitmapColor aBmpColor = pRead->HasPalette() diff --git a/vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx b/vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx index 3ccca0ebd90b..c9ec102d933a 100644 --- a/vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx +++ b/vcl/source/bitmap/BitmapMaskToAlphaFilter.cxx @@ -30,11 +30,11 @@ BitmapEx BitmapMaskToAlphaFilter::execute(BitmapEx const& rBitmapEx) const { assert(pRead->HasPalette() && "only supposed to be called with 1-bit mask"); assert(pRead->GetPaletteEntryCount() == 2); - for (tools::Long nY = 0; nY < aSize.Height(); ++nY) + for (sal_Int32 nY = 0; nY < sal_Int32(aSize.Height()); ++nY) { Scanline pScanline = pWrite->GetScanline(nY); Scanline pScanlineRead = pRead->GetScanline(nY); - for (tools::Long nX = 0; nX < aSize.Width(); ++nX) + for (sal_Int32 nX = 0; nX < sal_Int32(aSize.Width()); ++nX) { BitmapColor aBmpColor = pRead->GetPixelFromData(pScanlineRead, nX); if (aBmpColor == COL_BLACK) diff --git a/vcl/source/bitmap/BitmapMedianFilter.cxx b/vcl/source/bitmap/BitmapMedianFilter.cxx index 2e0b6556005d..567bc6ef20c3 100644 --- a/vcl/source/bitmap/BitmapMedianFilter.cxx +++ b/vcl/source/bitmap/BitmapMedianFilter.cxx @@ -16,7 +16,7 @@ #define S2(a, b) \ { \ - tools::Long t; \ + sal_Int32 t; \ if ((t = b - a) < 0) \ { \ a += t; \ @@ -63,10 +63,10 @@ BitmapEx BitmapMedianFilter::execute(BitmapEx const& rBitmapEx) const if (pWriteAcc) { - const tools::Long nWidth = pWriteAcc->Width(), nWidth2 = nWidth + 2; - const tools::Long nHeight = pWriteAcc->Height(), nHeight2 = nHeight + 2; - std::unique_ptr<tools::Long[]> pColm(new tools::Long[nWidth2]); - std::unique_ptr<tools::Long[]> pRows(new tools::Long[nHeight2]); + const sal_Int32 nWidth = pWriteAcc->Width(), nWidth2 = nWidth + 2; + const sal_Int32 nHeight = pWriteAcc->Height(), nHeight2 = nHeight + 2; + std::unique_ptr<sal_Int32[]> pColm(new sal_Int32[nWidth2]); + std::unique_ptr<sal_Int32[]> pRows(new sal_Int32[nHeight2]); std::unique_ptr<BitmapColor[]> pColRow1(new BitmapColor[nWidth2]); std::unique_ptr<BitmapColor[]> pColRow2(new BitmapColor[nWidth2]); std::unique_ptr<BitmapColor[]> pColRow3(new BitmapColor[nWidth2]); @@ -74,10 +74,10 @@ BitmapEx BitmapMedianFilter::execute(BitmapEx const& rBitmapEx) const BitmapColor* pRowTmp2 = pColRow2.get(); BitmapColor* pRowTmp3 = pColRow3.get(); BitmapColor* pColor; - tools::Long nY, nX, i; - tools::Long nR1, nR2, nR3, nR4, nR5, nR6, nR7, nR8, nR9; - tools::Long nG1, nG2, nG3, nG4, nG5, nG6, nG7, nG8, nG9; - tools::Long nB1, nB2, nB3, nB4, nB5, nB6, nB7, nB8, nB9; + sal_Int32 nY, nX, i; + sal_Int32 nR1, nR2, nR3, nR4, nR5, nR6, nR7, nR8, nR9; + sal_Int32 nG1, nG2, nG3, nG4, nG5, nG6, nG7, nG8, nG9; + sal_Int32 nB1, nB2, nB3, nB4, nB5, nB6, nB7, nB8, nB9; // create column LUT for (i = 0; i < nWidth2; i++) diff --git a/vcl/source/bitmap/BitmapMonochromeFilter.cxx b/vcl/source/bitmap/BitmapMonochromeFilter.cxx index 365e06a7a15c..1e4e6edf4cb1 100644 --- a/vcl/source/bitmap/BitmapMonochromeFilter.cxx +++ b/vcl/source/bitmap/BitmapMonochromeFilter.cxx @@ -29,16 +29,16 @@ BitmapEx BitmapMonochromeFilter::execute(BitmapEx const& aBitmapEx) const { const BitmapColor aBlack(pWriteAcc->GetBestMatchingColor(COL_BLACK)); const BitmapColor aWhite(pWriteAcc->GetBestMatchingColor(COL_WHITE)); - const tools::Long nWidth = pWriteAcc->Width(); - const tools::Long nHeight = pWriteAcc->Height(); + const sal_Int32 nWidth = pWriteAcc->Width(); + const sal_Int32 nHeight = pWriteAcc->Height(); if (pReadAcc->HasPalette()) { - for (tools::Long nY = 0; nY < nHeight; nY++) + for (sal_Int32 nY = 0; nY < nHeight; nY++) { Scanline pScanline = pWriteAcc->GetScanline(nY); Scanline pScanlineRead = pReadAcc->GetScanline(nY); - for (tools::Long nX = 0; nX < nWidth; nX++) + for (sal_Int32 nX = 0; nX < nWidth; nX++) { const sal_uInt8 cIndex = pReadAcc->GetIndexFromData(pScanlineRead, nX); if (pReadAcc->GetPaletteColor(cIndex).GetLuminance() >= mcThreshold) @@ -54,11 +54,11 @@ BitmapEx BitmapMonochromeFilter::execute(BitmapEx const& aBitmapEx) const } else { - for (tools::Long nY = 0; nY < nHeight; nY++) + for (sal_Int32 nY = 0; nY < nHeight; nY++) { Scanline pScanline = pWriteAcc->GetScanline(nY); Scanline pScanlineRead = pReadAcc->GetScanline(nY); - for (tools::Long nX = 0; nX < nWidth; nX++) + for (sal_Int32 nX = 0; nX < nWidth; nX++) { if (pReadAcc->GetPixelFromData(pScanlineRead, nX).GetLuminance() >= mcThreshold) diff --git a/vcl/source/bitmap/BitmapMosaicFilter.cxx b/vcl/source/bitmap/BitmapMosaicFilter.cxx index 0426dc3ff044..a146a142bb69 100644 --- a/vcl/source/bitmap/BitmapMosaicFilter.cxx +++ b/vcl/source/bitmap/BitmapMosaicFilter.cxx @@ -38,8 +38,8 @@ BitmapEx BitmapMosaicFilter::execute(BitmapEx const& rBitmapEx) const } bool bConditionsMet = false; - tools::Long nWidth(0); - tools::Long nHeight(0); + sal_Int32 nWidth(0); + sal_Int32 nHeight(0); if (pReadAcc && pWriteAcc) { nWidth = pReadAcc->Width(); @@ -50,7 +50,7 @@ BitmapEx BitmapMosaicFilter::execute(BitmapEx const& rBitmapEx) const if (bConditionsMet) { BitmapColor aCol; - tools::Long nX, nY, nX1, nX2, nY1, nY2, nSumR, nSumG, nSumB; + sal_Int32 nX, nY, nX1, nX2, nY1, nY2, nSumR, nSumG, nSumB; double fArea_1; nY1 = 0; diff --git a/vcl/source/bitmap/BitmapPopArtFilter.cxx b/vcl/source/bitmap/BitmapPopArtFilter.cxx index 81a3d22c76f0..a575a4e06f5a 100644 --- a/vcl/source/bitmap/BitmapPopArtFilter.cxx +++ b/vcl/source/bitmap/BitmapPopArtFilter.cxx @@ -29,8 +29,8 @@ BitmapEx BitmapPopArtFilter::execute(BitmapEx const& rBitmapEx) const if (pWriteAcc) { - const tools::Long nWidth = pWriteAcc->Width(); - const tools::Long nHeight = pWriteAcc->Height(); + const sal_Int32 nWidth = pWriteAcc->Width(); + const sal_Int32 nHeight = pWriteAcc->Height(); const int nEntryCount = 1 << pWriteAcc->GetBitCount(); int n = 0; std::vector<PopArtEntry> aPopArtTable(nEntryCount); @@ -43,10 +43,10 @@ BitmapEx BitmapPopArtFilter::execute(BitmapEx const& rBitmapEx) const } // get pixel count for each palette entry - for (tools::Long nY = 0; nY < nHeight; nY++) + for (sal_Int32 nY = 0; nY < nHeight; nY++) { Scanline pScanline = pWriteAcc->GetScanline(nY); - for (tools::Long nX = 0; nX < nWidth; nX++) + for (sal_Int32 nX = 0; nX < nWidth; nX++) { aPopArtTable[pWriteAcc->GetIndexFromData(pScanline, nX)].mnCount++; } diff --git a/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx b/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx index b1115a1dfe56..bb40e9846708 100644 --- a/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx +++ b/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx @@ -33,9 +33,9 @@ namespace { void ImplCalculateContributions( - const tools::Long aSourceSize, - const tools::Long aDestinationSize, - tools::Long& aNumberOfContributions, + const sal_Int32 aSourceSize, + const sal_Int32 aDestinationSize, + sal_Int32& aNumberOfContributions, std::vector<sal_Int16>& rWeights, std::vector<sal_Int32>& rPixels, std::vector<sal_Int32>& rCounts, @@ -46,19 +46,19 @@ void ImplCalculateContributions( const double fScaledRadius((fScale < 1.0) ? fSamplingRadius / fScale : fSamplingRadius); const double fFilterFactor(std::min(fScale, 1.0)); - aNumberOfContributions = (tools::Long(fabs(ceil(fScaledRadius))) * 2) + 1; - const tools::Long nAllocSize(aDestinationSize * aNumberOfContributions); + aNumberOfContributions = (sal_Int32(fabs(ceil(fScaledRadius))) * 2) + 1; + const sal_Int32 nAllocSize(aDestinationSize * aNumberOfContributions); rWeights.resize(nAllocSize); rPixels.resize(nAllocSize); rCounts.resize(aDestinationSize); - for(tools::Long i(0); i < aDestinationSize; i++) + for(sal_Int32 i(0); i < aDestinationSize; i++) { - const tools::Long aIndex(i * aNumberOfContributions); + const sal_Int32 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))); - tools::Long aCurrentCount(0); + sal_Int32 aCurrentCount(0); for(sal_Int32 j(aLeft); j <= aRight; j++) { @@ -71,8 +71,8 @@ void ImplCalculateContributions( } // Handling on edges - const tools::Long aPixelIndex(MinMax(j, 0, aSourceSize - 1)); - const tools::Long nIndex(aIndex + aCurrentCount); + const sal_Int32 aPixelIndex(MinMax(j, 0, aSourceSize - 1)); + const sal_Int32 nIndex(aIndex + aCurrentCount); // scale the weight by 255 since we're converting from float to int rWeights[nIndex] = aWeight * 255; @@ -89,8 +89,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 tools::Long nWidth(rSource.GetSizePixel().Width()); - const tools::Long nNewWidth(FRound(nWidth * rScaleX)); + const sal_Int32 nWidth(rSource.GetSizePixel().Width()); + const sal_Int32 nNewWidth(FRound(nWidth * rScaleX)); if(nWidth == nNewWidth) { @@ -104,9 +104,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; - tools::Long aNumberOfContributions(0); + sal_Int32 aNumberOfContributions(0); - const tools::Long nHeight(rSource.GetSizePixel().Height()); + const sal_Int32 nHeight(rSource.GetSizePixel().Height()); ImplCalculateContributions(nWidth, nNewWidth, aNumberOfContributions, aWeights, aPixels, aCounts, aKernel); rTarget = Bitmap(Size(nNewWidth, nHeight), vcl::PixelFormat::N24_BPP); BitmapScopedWriteAccess pWriteAcc(rTarget); @@ -114,21 +114,21 @@ bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& rSc if(bResult) { - for(tools::Long y(0); y < nHeight; y++) + for(sal_Int32 y(0); y < nHeight; y++) { Scanline pScanline = pWriteAcc->GetScanline( y ); Scanline pScanlineRead = pReadAcc->GetScanline( y ); - for(tools::Long x(0); x < nNewWidth; x++) + for(sal_Int32 x(0); x < nNewWidth; x++) { - const tools::Long aBaseIndex(x * aNumberOfContributions); + const sal_Int32 aBaseIndex(x * aNumberOfContributions); sal_Int32 aSum(0); sal_Int32 aValueRed(0); sal_Int32 aValueGreen(0); sal_Int32 aValueBlue(0); - for(tools::Long j(0); j < aCounts[x]; j++) + for(sal_Int32 j(0); j < aCounts[x]; j++) { - const tools::Long aIndex(aBaseIndex + j); + const sal_Int32 aIndex(aBaseIndex + j); const sal_Int16 aWeight(aWeights[aIndex]); BitmapColor aColor; @@ -179,8 +179,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 tools::Long nHeight(rSource.GetSizePixel().Height()); - const tools::Long nNewHeight(FRound(nHeight * rScaleY)); + const sal_Int32 nHeight(rSource.GetSizePixel().Height()); + const sal_Int32 nNewHeight(FRound(nHeight * rScaleY)); if(nHeight == nNewHeight) { @@ -194,9 +194,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; - tools::Long aNumberOfContributions(0); + sal_Int32 aNumberOfContributions(0); - const tools::Long nWidth(rSource.GetSizePixel().Width()); + const sal_Int32 nWidth(rSource.GetSizePixel().Width()); ImplCalculateContributions(nHeight, nNewHeight, aNumberOfContributions, aWeights, aPixels, aCounts, aKernel); rTarget = Bitmap(Size(nWidth, nNewHeight), vcl::PixelFormat::N24_BPP); BitmapScopedWriteAccess pWriteAcc(rTarget); @@ -205,24 +205,24 @@ bool ImplScaleConvolutionVer(Bitmap& rSource, Bitmap& rTarget, const double& rSc if(pWriteAcc) { std::vector<BitmapColor> aScanline(nHeight); - for(tools::Long x(0); x < nWidth; x++) + for(sal_Int32 x(0); x < nWidth; x++) { - for(tools::Long y(0); y < nHeight; y++) + for(sal_Int32 y(0); y < nHeight; y++) if(pReadAcc->HasPalette()) aScanline[y] = pReadAcc->GetPaletteColor(pReadAcc->GetPixelIndex(y, x)); else aScanline[y] = pReadAcc->GetPixel(y, x); - for(tools::Long y(0); y < nNewHeight; y++) + for(sal_Int32 y(0); y < nNewHeight; y++) { - const tools::Long aBaseIndex(y * aNumberOfContributions); + const sal_Int32 aBaseIndex(y * aNumberOfContributions); sal_Int32 aSum(0); sal_Int32 aValueRed(0); sal_Int32 aValueGreen(0); sal_Int32 aValueBlue(0); - for(tools::Long j(0); j < aCounts[y]; j++) + for(sal_Int32 j(0); j < aCounts[y]; j++) { - const tools::Long aIndex(aBaseIndex + j); + const sal_Int32 aIndex(aBaseIndex + j); const sal_Int16 aWeight(aWeights[aIndex]); aSum += aWeight; const BitmapColor & aColor = aScanline[aPixels[aIndex]]; @@ -269,10 +269,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 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 sal_Int32 nWidth(rBitmap.GetSizePixel().Width()); + const sal_Int32 nHeight(rBitmap.GetSizePixel().Height()); + const sal_Int32 nNewWidth(FRound(nWidth * fScaleX)); + const sal_Int32 nNewHeight(FRound(nHeight * fScaleY)); const bool bScaleHor(nWidth != nNewWidth); const bool bScaleVer(nHeight != nNewHeight); const bool bMirror(bMirrorHor || bMirrorVer); @@ -298,8 +298,8 @@ bool ImplScaleConvolution(Bitmap& rBitmap, const double& rScaleX, const double& nMirrorFlags |= BmpMirrorFlags::Vertical; } - const tools::Long nStartSize(nWidth * nHeight); - const tools::Long nEndSize(nNewWidth * nNewHeight); + const sal_Int32 nStartSize(nWidth * nHeight); + const sal_Int32 nEndSize(nNewWidth * nNewHeight); bMirrorAfter = nStartSize > nEndSize; @@ -313,8 +313,8 @@ bool ImplScaleConvolution(Bitmap& rBitmap, const double& rScaleX, const double& if (bResult) { - const tools::Long nInBetweenSizeHorFirst(nHeight * nNewWidth); - const tools::Long nInBetweenSizeVerFirst(nNewHeight * nWidth); + const sal_Int32 nInBetweenSizeHorFirst(nHeight * nNewWidth); + const sal_Int32 nInBetweenSizeVerFirst(nNewHeight * nWidth); Bitmap aSource(rBitmap); if(nInBetweenSizeHorFirst < nInBetweenSizeVerFirst) diff --git a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx index 7399311257a5..bc7f3a8361f4 100644 --- a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx +++ b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx @@ -49,18 +49,18 @@ struct ScaleContext { BitmapReadAccess* mpSrc; BitmapWriteAccess* mpDest; - tools::Long mnDestW; + sal_Int32 mnDestW; bool mbHMirr; bool mbVMirr; - std::vector<tools::Long> maMapIX; - std::vector<tools::Long> maMapIY; + std::vector<sal_Int32> maMapIX; + std::vector<sal_Int32> maMapIY; std::vector<BilinearWeightType> maMapFX; std::vector<BilinearWeightType> maMapFY; ScaleContext( BitmapReadAccess *pSrc, BitmapWriteAccess *pDest, - tools::Long nSrcW, tools::Long nDestW, - tools::Long nSrcH, tools::Long nDestH, + sal_Int32 nSrcW, sal_Int32 nDestW, + sal_Int32 nSrcH, sal_Int32 nDestH, bool bHMirr, bool bVMirr) : mpSrc(pSrc) , mpDest(pDest) @@ -76,28 +76,28 @@ struct ScaleContext generateMap(nSrcH, nDestH, bVMirr, maMapIY, maMapFY); } - static void generateMap(tools::Long nSourceLength, tools::Long nDestinationLength, bool bMirrored, - std::vector<tools::Long> & rMapIX, std::vector<BilinearWeightType> & rMapFX) + static void generateMap(sal_Int32 nSourceLength, sal_Int32 nDestinationLength, bool bMirrored, + std::vector<sal_Int32> & rMapIX, std::vector<BilinearWeightType> & rMapFX) { const double fRevScale = (nDestinationLength > 1) ? double(nSourceLength - 1) / (nDestinationLength - 1) : 0.0; - tools::Long nTemp = nSourceLength - 2; - tools::Long nTempX = nSourceLength - 1; + sal_Int32 nTemp = nSourceLength - 2; + sal_Int32 nTempX = nSourceLength - 1; - for (tools::Long i = 0; i < nDestinationLength; i++) + for (sal_Int32 i = 0; i < nDestinationLength; i++) { double fTemp = i * fRevScale; if (bMirrored) fTemp = nTempX - fTemp; - rMapIX[i] = MinMax(tools::Long(fTemp), 0, nTemp); + rMapIX[i] = MinMax(sal_Int32(fTemp), 0, nTemp); rMapFX[i] = BilinearWeightType((fTemp - rMapIX[i]) * (BilinearWeightType(1) << MAP_PRECISION)); } } }; -constexpr tools::Long constScaleThreadStrip = 32; +constexpr sal_Int32 constScaleThreadStrip = 32; -typedef void (*ScaleRangeFn)(const ScaleContext & rContext, tools::Long nStartY, tools::Long nEndY); +typedef void (*ScaleRangeFn)(const ScaleContext & rContext, sal_Int32 nStartY, sal_Int32 nEndY); template <size_t nSize> struct ScaleFunc { @@ -164,22 +164,22 @@ template <size_t nSize> struct ScaleFunc }; template <int nColorBits> -void scaleDown (const ScaleContext &rCtx, tools::Long nStartY, tools::Long nEndY) +void scaleDown (const ScaleContext &rCtx, sal_Int32 nStartY, sal_Int32 nEndY) { comphelper::ProfileZone pz("BitmapScaleSuperFilter::scaleDown"); constexpr int nColorComponents = nColorBits / 8; static_assert(nColorComponents * 8 == nColorBits, "nColorBits must be divisible by 8"); using ScaleFunction = ScaleFunc<nColorComponents>; - const tools::Long nStartX = 0; - const tools::Long nEndX = rCtx.mnDestW - 1; + const sal_Int32 nStartX = 0; + const sal_Int32 nEndX = rCtx.mnDestW - 1; - for (tools::Long nY = nStartY; nY <= nEndY; nY++) + for (sal_Int32 nY = nStartY; nY <= nEndY; nY++) { - tools::Long nTop = rCtx.mbVMirr ? (nY + 1) : nY; - tools::Long nBottom = rCtx.mbVMirr ? nY : (nY + 1); + sal_Int32 nTop = rCtx.mbVMirr ? (nY + 1) : nY; + sal_Int32 nBottom = rCtx.mbVMirr ? nY : (nY + 1); - tools::Long nLineStart; - tools::Long nLineRange; + sal_Int32 nLineStart; + sal_Int32 nLineRange; if (nY == nEndY) { nLineStart = rCtx.maMapIY[nY]; @@ -193,13 +193,13 @@ void scaleDown (const ScaleContext &rCtx, tools::Long nStartY, tools::Long nEndY } Scanline pScanDest = rCtx.mpDest->GetScanline(nY); - for (tools::Long nX = nStartX; nX <= nEndX; nX++) + for (sal_Int32 nX = nStartX; nX <= nEndX; nX++) { - tools::Long nLeft = rCtx.mbHMirr ? (nX + 1) : nX; - tools::Long nRight = rCtx.mbHMirr ? nX : (nX + 1); + sal_Int32 nLeft = rCtx.mbHMirr ? (nX + 1) : nX; + sal_Int32 nRight = rCtx.mbHMirr ? nX : (nX + 1); - tools::Long nRowStart; - tools::Long nRowRange; + sal_Int32 nRowStart; + sal_Int32 nRowRange; if (nX == nEndX) { nRowStart = rCtx.maMapIX[nX]; @@ -215,7 +215,7 @@ void scaleDown (const ScaleContext &rCtx, tools::Long nStartY, tools::Long nEndY std::array<int, nColorComponents> sumNumbers{}; // zero-initialize BilinearWeightType nTotalWeightY = 0; - for (tools::Long i = 0; i<= nLineRange; i++) + for (sal_Int32 i = 0; i<= nLineRange; i++) { Scanline pTmpY = rCtx.mpSrc->GetScanline(nLineStart + i); Scanline pTmpX = pTmpY + nColorComponents * nRowStart; @@ -223,7 +223,7 @@ void scaleDown (const ScaleContext &rCtx, tools::Long nStartY, tools::Long nEndY std::array<int, nColorComponents> sumRows{}; // zero-initialize BilinearWeightType nTotalWeightX = 0; - for (tools::Long j = 0; j <= nRowRange; j++) + for (sal_Int32 j = 0; j <= nRowRange; j++) { if (nX == nEndX) { @@ -280,18 +280,18 @@ void scaleDown (const ScaleContext &rCtx, tools::Long nStartY, tools::Long nEndY } template <int nColorBits> -void scaleUp(const ScaleContext &rCtx, tools::Long nStartY, tools::Long nEndY) +void scaleUp(const ScaleContext &rCtx, sal_Int32 nStartY, sal_Int32 nEndY) { comphelper::ProfileZone pz("BitmapScaleSuperFilter::scaleUp"); constexpr int nColorComponents = nColorBits / 8; static_assert(nColorComponents * 8 == nColorBits, "nColorBits must be divisible by 8"); using ScaleFunction = ScaleFunc<nColorComponents>; - const tools::Long nStartX = 0; - const tools::Long nEndX = rCtx.mnDestW - 1; + const sal_Int32 nStartX = 0; + const sal_Int32 nEndX = rCtx.mnDestW - 1; - for (tools::Long nY = nStartY; nY <= nEndY; nY++) + for (sal_Int32 nY = nStartY; nY <= nEndY; nY++) { - tools::Long nTempY = rCtx.maMapIY[nY]; + sal_Int32 nTempY = rCtx.maMapIY[nY]; BilinearWeightType nTempFY = rCtx.maMapFY[nY]; Scanline pLine0 = rCtx.mpSrc->GetScanline(nTempY+0); @@ -304,9 +304,9 @@ void scaleUp(const ScaleContext &rCtx, tools::Long nStartY, tools::Long nEndY) Scanline pColorPtr0; Scanline pColorPtr1; - for (tools::Long nX = nStartX; nX <= nEndX; nX++) + for (sal_Int32 nX = nStartX; nX <= nEndX; nX++) { - tools::Long nTempX = rCtx.maMapIX[nX]; + sal_Int32 nTempX = rCtx.maMapIX[nX]; BilinearWeightType nTempFX = rCtx.maMapFX[nX]; pColorPtr0 = pLine0 + nTempX * nColorComponents; @@ -327,14 +327,14 @@ class ScaleTask : public comphelper::ThreadTask { ScaleRangeFn mpScaleRangeFunction; const ScaleContext& mrContext; - tools::Long mnStartY; - tools::Long mnEndY; + sal_Int32 mnStartY; + sal_Int32 mnEndY; public: explicit ScaleTask(const std::shared_ptr<comphelper::ThreadTaskTag>& pTag, ScaleRangeFn pScaleRangeFunction, const ScaleContext& rContext, - tools::Long nStartY, tools::Long nEndY) + sal_Int32 nStartY, sal_Int32 nEndY) : comphelper::ThreadTask(pTag) , mpScaleRangeFunction(pScaleRangeFunction) , mrContext(rContext) @@ -348,21 +348,21 @@ public: } }; -void scaleUpPalette8bit(const ScaleContext &rCtx, tools::Long nStartY, tools::Long nEndY) +void scaleUpPalette8bit(const ScaleContext &rCtx, sal_Int32 nStartY, sal_Int32 nEndY) { - const tools::Long nStartX = 0, nEndX = rCtx.mnDestW - 1; + const sal_Int32 nStartX = 0, nEndX = rCtx.mnDestW - 1; - for( tools::Long nY = nStartY; nY <= nEndY; nY++ ) + for( sal_Int32 nY = nStartY; nY <= nEndY; nY++ ) { - tools::Long nTempY = rCtx.maMapIY[ nY ]; + sal_Int32 nTempY = rCtx.maMapIY[ nY ]; BilinearWeightType nTempFY = rCtx.maMapFY[ nY ]; Scanline pLine0 = rCtx.mpSrc->GetScanline( nTempY ); Scanline pLine1 = rCtx.mpSrc->GetScanline( ++nTempY ); Scanline pScanDest = rCtx.mpDest->GetScanline( nY ); - for(tools::Long nX = nStartX, nXDst = 0; nX <= nEndX; nX++ ) + for(sal_Int32 nX = nStartX, nXDst = 0; nX <= nEndX; nX++ ) { - tools::Long nTempX = rCtx.maMapIX[ nX ]; + sal_Int32 nTempX = rCtx.maMapIX[ nX ]; BilinearWeightType nTempFX = rCtx.maMapFX[ nX ]; const BitmapColor& rCol0 = rCtx.mpSrc->GetPaletteColor( pLine0[ nTempX ] ); @@ -386,19 +386,19 @@ void scaleUpPalette8bit(const ScaleContext &rCtx, tools::Long nStartY, tools::Lo } } -void scaleUpPaletteGeneral(const ScaleContext &rCtx, tools::Long nStartY, tools::Long nEndY) +void scaleUpPaletteGeneral(const ScaleContext &rCtx, sal_Int32 nStartY, sal_Int32 nEndY) { - const tools::Long nStartX = 0, nEndX = rCtx.mnDestW - 1; + const sal_Int32 nStartX = 0, nEndX = rCtx.mnDestW - 1; - for( tools::Long nY = nStartY; nY <= nEndY; nY++ ) + for( sal_Int32 nY = nStartY; nY <= nEndY; nY++ ) { - tools::Long nTempY = rCtx.maMapIY[ nY ]; + sal_Int32 nTempY = rCtx.maMapIY[ nY ]; BilinearWeightType nTempFY = rCtx.maMapFY[ nY ]; Scanline pScanline = rCtx.mpDest->GetScanline( nY ); - for( tools::Long nX = nStartX, nXDst = 0; nX <= nEndX; nX++ ) + for( sal_Int32 nX = nStartX, nXDst = 0; nX <= nEndX; nX++ ) { - tools::Long nTempX = rCtx.maMapIX[ nX ]; + sal_Int32 nTempX = rCtx.maMapIX[ nX ]; BilinearWeightType nTempFX = rCtx.maMapFX[ nX ]; BitmapColor aCol0 = rCtx.mpSrc->GetPaletteColor( rCtx.mpSrc->GetPixelIndex( nTempY, nTempX ) ); @@ -421,19 +421,19 @@ void scaleUpPaletteGeneral(const ScaleContext &rCtx, tools::Long nStartY, tools: } } -void scaleUpNonPaletteGeneral(const ScaleContext &rCtx, tools::Long nStartY, tools::Long nEndY) +void scaleUpNonPaletteGeneral(const ScaleContext &rCtx, sal_Int32 nStartY, sal_Int32 nEndY) { - const tools::Long nStartX = 0, nEndX = rCtx.mnDestW - 1; + const sal_Int32 nStartX = 0, nEndX = rCtx.mnDestW - 1; - for( tools::Long nY = nStartY; nY <= nEndY; nY++ ) + for( sal_Int32 nY = nStartY; nY <= nEndY; nY++ ) { - tools::Long nTempY = rCtx.maMapIY[ nY ]; + sal_Int32 nTempY = rCtx.maMapIY[ nY ]; BilinearWeightType nTempFY = rCtx.maMapFY[ nY ]; Scanline pScanDest = rCtx.mpDest->GetScanline( nY ); - for( tools::Long nX = nStartX, nXDst = 0; nX <= nEndX; nX++ ) + for( sal_Int32 nX = nStartX, nXDst = 0; nX <= nEndX; nX++ ) { - tools::Long nTempX = rCtx.maMapIX[ nX ]; + sal_Int32 nTempX = rCtx.maMapIX[ nX ]; BilinearWeightType nTempFX = rCtx.maMapFX[ nX ]; BitmapColor aCol0 = rCtx.mpSrc->GetPixel( nTempY, nTempX ); @@ -456,16 +456,16 @@ void scaleUpNonPaletteGeneral(const ScaleContext &rCtx, tools::Long nStartY, too } } -void scaleDownPalette8bit(const ScaleContext &rCtx, tools::Long nStartY, tools::Long nEndY) +void scaleDownPalette8bit(const ScaleContext &rCtx, sal_Int32 nStartY, sal_Int32 nEndY) { - const tools::Long nStartX = 0, nEndX = rCtx.mnDestW - 1; + const sal_Int32 nStartX = 0, nEndX = rCtx.mnDestW - 1; - for( tools::Long nY = nStartY; nY <= nEndY; nY++ ) + for( sal_Int32 nY = nStartY; nY <= nEndY; nY++ ) { - tools::Long nTop = rCtx.mbVMirr ? ( nY + 1 ) : nY; - tools::Long nBottom = rCtx.mbVMirr ? nY : ( nY + 1 ) ; + sal_Int32 nTop = rCtx.mbVMirr ? ( nY + 1 ) : nY; + sal_Int32 nBottom = rCtx.mbVMirr ? nY : ( nY + 1 ) ; - tools::Long nLineStart, nLineRange; + sal_Int32 nLineStart, nLineRange; if( nY == nEndY ) { nLineStart = rCtx.maMapIY[ nY ]; @@ -478,13 +478,13 @@ void scaleDownPalette8bit(const ScaleContext &rCtx, tools::Long nStartY, tools:: } Scanline pScanDest = rCtx.mpDest->GetScanline( nY ); - for( tools::Long nX = nStartX , nXDst = 0; nX <= nEndX; nX++ ) + for( sal_Int32 nX = nStartX , nXDst = 0; nX <= nEndX; nX++ ) { - tools::Long nLeft = rCtx.mbHMirr ? ( nX + 1 ) : nX; - tools::Long nRight = rCtx.mbHMirr ? nX : ( nX + 1 ) ; + sal_Int32 nLeft = rCtx.mbHMirr ? ( nX + 1 ) : nX; + sal_Int32 nRight = rCtx.mbHMirr ? nX : ( nX + 1 ) ; - tools::Long nRowStart; - tools::Long nRowRange; + sal_Int32 nRowStart; + sal_Int32 nRowRange; if( nX == nEndX ) { nRowStart = rCtx.maMapIX[ nX ]; @@ -501,7 +501,7 @@ void scaleDownPalette8bit(const ScaleContext &rCtx, tools::Long nStartY, tools:: int nSumB = 0; BilinearWeightType nTotalWeightY = 0; - for(tools::Long i = 0; i<= nLineRange; i++) + for(sal_Int32 i = 0; i<= nLineRange; i++) { Scanline pTmpY = rCtx.mpSrc->GetScanline( nLineStart + i ); int nSumRowR = 0; @@ -509,7 +509,7 @@ void scaleDownPalette8bit(const ScaleContext &rCtx, tools::Long nStartY, tools:: int nSumRowB = 0; BilinearWeightType nTotalWeightX = 0; - for(tools::Long j = 0; j <= nRowRange; j++) + for(sal_Int32 j = 0; j <= nRowRange; j++) { const BitmapColor& rCol = rCtx.mpSrc->GetPaletteColor( pTmpY[ nRowStart + j ] ); @@ -581,16 +581,16 @@ void scaleDownPalette8bit(const ScaleContext &rCtx, tools::Long nStartY, tools:: } } -void scaleDownPaletteGeneral(const ScaleContext &rCtx, tools::Long nStartY, tools::Long nEndY) +void scaleDownPaletteGeneral(const ScaleContext &rCtx, sal_Int32 nStartY, sal_Int32 nEndY) { - const tools::Long nStartX = 0, nEndX = rCtx.mnDestW - 1; + const sal_Int32 nStartX = 0, nEndX = rCtx.mnDestW - 1; - for( tools::Long nY = nStartY; nY <= nEndY; nY++ ) + for( sal_Int32 nY = nStartY; nY <= nEndY; nY++ ) { - tools::Long nTop = rCtx.mbVMirr ? ( nY + 1 ) : nY; - tools::Long nBottom = rCtx.mbVMirr ? nY : ( nY + 1 ) ; + sal_Int32 nTop = rCtx.mbVMirr ? ( nY + 1 ) : nY; + sal_Int32 nBottom = rCtx.mbVMirr ? nY : ( nY + 1 ) ; - tools::Long nLineStart, nLineRange; + sal_Int32 nLineStart, nLineRange; if( nY ==nEndY ) { nLineStart = rCtx.maMapIY[ nY ]; @@ -603,12 +603,12 @@ void scaleDownPaletteGeneral(const ScaleContext &rCtx, tools::Long nStartY, tool } Scanline pScanDest = rCtx.mpDest->GetScanline( nY ); - for( tools::Long nX = nStartX , nXDst = 0; nX <= nEndX; nX++ ) + for( sal_Int32 nX = nStartX , nXDst = 0; nX <= nEndX; nX++ ) { - tools::Long nLeft = rCtx.mbHMirr ? ( nX + 1 ) : nX; - tools::Long nRight = rCtx.mbHMirr ? nX : ( nX + 1 ) ; + sal_Int32 nLeft = rCtx.mbHMirr ? ( nX + 1 ) : nX; + sal_Int32 nRight = rCtx.mbHMirr ? nX : ( nX + 1 ) ; - tools::Long nRowStart, nRowRange; + sal_Int32 nRowStart, nRowRange; if( nX == nEndX ) { nRowStart = rCtx.maMapIX[ nX ]; @@ -625,7 +625,7 @@ void scaleDownPaletteGeneral(const ScaleContext &rCtx, tools::Long nStartY, tool int nSumB = 0; BilinearWeightType nTotalWeightY = 0; - for(tools::Long i = 0; i<= nLineRange; i++) + for(sal_Int32 i = 0; i<= nLineRange; i++) { int nSumRowR = 0; int nSumRowG = 0; @@ -633,7 +633,7 @@ void scaleDownPaletteGeneral(const ScaleContext &rCtx, tools::Long nStartY, tool BilinearWeightType nTotalWeightX = 0; Scanline pScanlineSrc = rCtx.mpSrc->GetScanline( nLineStart + i ); - for(tools::Long j = 0; j <= nRowRange; j++) + for(sal_Int32 j = 0; j <= nRowRange; j++) { BitmapColor aCol0 = rCtx.mpSrc->GetPaletteColor ( rCtx.mpSrc->GetIndexFromData( pScanlineSrc, nRowStart + j ) ); @@ -673,7 +673,7 @@ void scaleDownPaletteGeneral(const ScaleContext &rCtx, tools::Long nStartY, tool } } - tools::Long nWeightY = lclMaxWeight(); + sal_Int32 nWeightY = lclMaxWeight(); if( nY == nEndY ) nWeightY = lclMaxWeight(); else if( i == 0 ) @@ -709,16 +709,16 @@ void scaleDownPaletteGeneral(const ScaleContext &rCtx, tools::Long nStartY, tool } } -void scaleDownNonPaletteGeneral(const ScaleContext &rCtx, tools::Long nStartY, tools::Long nEndY) +void scaleDownNonPaletteGeneral(const ScaleContext &rCtx, sal_Int32 nStartY, sal_Int32 nEndY) { - const tools::Long nStartX = 0, nEndX = rCtx.mnDestW - 1; + const sal_Int32 nStartX = 0, nEndX = rCtx.mnDestW - 1; - for( tools::Long nY = nStartY; nY <= nEndY; nY++ ) + for( sal_Int32 nY = nStartY; nY <= nEndY; nY++ ) { - tools::Long nTop = rCtx.mbVMirr ? ( nY + 1 ) : nY; - tools::Long nBottom = rCtx.mbVMirr ? nY : ( nY + 1 ) ; + sal_Int32 nTop = rCtx.mbVMirr ? ( nY + 1 ) : nY; + sal_Int32 nBottom = rCtx.mbVMirr ? nY : ( nY + 1 ) ; - tools::Long nLineStart, nLineRange; + sal_Int32 nLineStart, nLineRange; if( nY ==nEndY ) { nLineStart = rCtx.maMapIY[ nY ]; @@ -731,12 +731,12 @@ void scaleDownNonPaletteGeneral(const ScaleContext &rCtx, tools::Long nStartY, t } Scanline pScanDest = rCtx.mpDest->GetScanline( nY ); - for( tools::Long nX = nStartX , nXDst = 0; nX <= nEndX; nX++ ) + for( sal_Int32 nX = nStartX , nXDst = 0; nX <= nEndX; nX++ ) { - tools::Long nLeft = rCtx.mbHMirr ? ( nX + 1 ) : nX; - tools::Long nRight = rCtx.mbHMirr ? nX : ( nX + 1 ) ; + sal_Int32 nLeft = rCtx.mbHMirr ? ( nX + 1 ) : nX; + sal_Int32 nRight = rCtx.mbHMirr ? nX : ( nX + 1 ) ; - tools::Long nRowStart, nRowRange; + sal_Int32 nRowStart, nRowRange; if( nX == nEndX ) { nRowStart = rCtx.maMapIX[ nX ]; @@ -753,7 +753,7 @@ void scaleDownNonPaletteGeneral(const ScaleContext &rCtx, tools::Long nStartY, t int nSumB = 0; BilinearWeightType nTotalWeightY = 0; - for(tools::Long i = 0; i<= nLineRange; i++) + for(sal_Int32 i = 0; i<= nLineRange; i++) { int nSumRowR = 0; int nSumRowG = 0; @@ -761,7 +761,7 @@ void scaleDownNonPaletteGeneral(const ScaleContext &rCtx, tools::Long nStartY, t BilinearWeightType nTotalWeightX = 0; Scanline pScanlineSrc = rCtx.mpSrc->GetScanline( nLineStart + i ); - for(tools::Long j = 0; j <= nRowRange; j++) + for(sal_Int32 j = 0; j <= nRowRange; j++) { BitmapColor aCol0 = rCtx.mpSrc->GetPixelFromData( pScanlineSrc, nRowStart + j ); @@ -859,8 +859,8 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) const double fScaleX = std::fabs(mrScaleX); double fScaleY = std::fabs(mrScaleY); - const tools::Long nDstW = FRound(aSizePix.Width() * fScaleX); - const tools::Long nDstH = FRound(aSizePix.Height() * fScaleY); + const sal_Int32 nDstW = FRound(aSizePix.Width() * fScaleX); + const sal_Int32 nDstH = FRound(aSizePix.Height() * fScaleY); constexpr double fScaleThresh = 0.6; @@ -903,7 +903,7 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) const BitmapScopedWriteAccess pWriteAccess(aOutBmp); - const tools::Long nEndY = nDstH - 1; + const sal_Int32 nEndY = nDstH - 1; if (pReadAccess && pWriteAccess) { @@ -971,7 +971,7 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) const // A large source image. bool bHorizontalWork = pReadAccess->Height() >= 512 && pReadAccess->Width() >= 512; bool bUseThreads = true; - const tools::Long nStartY = 0; + const sal_Int32 nStartY = 0; static bool bDisableThreadedScaling = getenv ("VCL_NO_THREAD_SCALE"); if (bDisableThreadedScaling || !bHorizontalWork) @@ -989,7 +989,7 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) const std::shared_ptr<comphelper::ThreadTaskTag> pTag = comphelper::ThreadPool::createThreadTaskTag(); vcl::bitmap::generateStripRanges<constScaleThreadStrip>(nStartY, nEndY, - [&] (tools::Long const nStart, tools::Long const nEnd, bool const bLast) + [&] (sal_Int32 const nStart, sal_Int32 const nEnd, bool const bLast) { if (!bLast) { diff --git a/vcl/source/bitmap/BitmapSeparableUnsharpenFilter.cxx b/vcl/source/bitmap/BitmapSeparableUnsharpenFilter.cxx index c8aae120a48b..bbf5950dc968 100644 --- a/vcl/source/bitmap/BitmapSeparableUnsharpenFilter.cxx +++ b/vcl/source/bitmap/BitmapSeparableUnsharpenFilter.cxx @@ -21,8 +21,8 @@ BitmapEx BitmapSeparableUnsharpenFilter::execute(BitmapEx const& rBitmapEx) cons { Bitmap aBitmap(rBitmapEx.GetBitmap()); - const tools::Long nWidth = aBitmap.GetSizePixel().Width(); - const tools::Long nHeight = aBitmap.GetSizePixel().Height(); + const sal_Int32 nWidth = aBitmap.GetSizePixel().Width(); + const sal_Int32 nHeight = aBitmap.GetSizePixel().Height(); Bitmap aBlur(aBitmap); BitmapEx aBlurEx(aBlur); @@ -42,10 +42,10 @@ BitmapEx BitmapSeparableUnsharpenFilter::execute(BitmapEx const& rBitmapEx) cons BitmapColor aColor, aColorBlur; // For all pixels in original image subtract pixels values from blurred image - for (tools::Long y = 0; y < nHeight; y++) ... etc. - the rest is truncated