include/vcl/BitmapTools.hxx | 2 include/vcl/GraphicObject.hxx | 9 ---- include/vcl/bitmapex.hxx | 3 - vcl/source/bitmap/BitmapEx.cxx | 54 ------------------------ vcl/source/bitmap/BitmapTools.cxx | 40 ------------------ vcl/source/graphic/GraphicObject2.cxx | 75 ---------------------------------- 6 files changed, 183 deletions(-)
New commits: commit fe2950994241598ca2e5d6ccdb13d852b92fb80c Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Aug 29 12:30:32 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Aug 30 13:41:23 2025 +0200 remove some now unused BitmapEx methods Change-Id: Ibe32424f7d484b495d2bce542900eba7f796c584 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190406 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/vcl/BitmapTools.hxx b/include/vcl/BitmapTools.hxx index 45261c3b8341..822c1f984e32 100644 --- a/include/vcl/BitmapTools.hxx +++ b/include/vcl/BitmapTools.hxx @@ -88,8 +88,6 @@ VCL_DLLPUBLIC css::uno::Sequence< sal_Int8 > CanvasExtractBitmapData(Bitmap cons Bitmap VCL_DLLPUBLIC createHistorical8x8FromArray(std::array<sal_uInt8,64> const & pArray, Color aColorPix, Color aColorBack); bool VCL_DLLPUBLIC isHistorical8x8(const Bitmap& rBitmap, Color& o_rBack, Color& o_rFront); -VCL_DLLPUBLIC bool convertBitmap32To24Plus8(BitmapEx const & rInput, BitmapEx & rResult); - /** Retrieve downsampled and cropped bitmap Takes destination size in twips units. diff --git a/include/vcl/GraphicObject.hxx b/include/vcl/GraphicObject.hxx index 40bc2221cb40..6af1a1fafa2d 100644 --- a/include/vcl/GraphicObject.hxx +++ b/include/vcl/GraphicObject.hxx @@ -146,15 +146,6 @@ private: const GraphicAttr* pAttr ) const; - void SAL_DLLPRIVATE ImplTransformBitmap( - BitmapEx& rBmpEx, - const GraphicAttr& rAttr, - const Size& rCropLeftTop, - const Size& rCropRightBottom, - const tools::Rectangle& rCropRect, - const Size& rDstSize, - bool bEnlarge - ) const; void SAL_DLLPRIVATE ImplTransformBitmap( Bitmap& rBmp, const GraphicAttr& rAttr, diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx index 35bb0248313a..8b7633941fb9 100644 --- a/include/vcl/bitmapex.hxx +++ b/include/vcl/bitmapex.hxx @@ -420,9 +420,6 @@ public: [[nodiscard]] BitmapEx ModifyBitmapEx( const basegfx::BColorModifierStack& rBColorModifierStack) const; - [[nodiscard]] - static BitmapEx AutoScaleBitmap( BitmapEx const & aBitmap, const tools::Long aStandardSize ); - SAL_DLLPRIVATE void ChangeColorAlpha( sal_uInt8 cIndexFrom, sal_Int8 nAlphaTo ); /** diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx index 34573ffc8cf2..bf9fa15df12e 100644 --- a/vcl/source/bitmap/BitmapEx.cxx +++ b/vcl/source/bitmap/BitmapEx.cxx @@ -457,60 +457,6 @@ void BitmapEx::Draw( OutputDevice* pOutDev, pOutDev->DrawBitmapEx( rDestPt, rDestSize, *this ); } -BitmapEx BitmapEx::AutoScaleBitmap(BitmapEx const & aBitmap, const tools::Long aStandardSize) -{ - Point aEmptyPoint(0,0); - double imgposX = 0; - double imgposY = 0; - BitmapEx aRet = aBitmap; - double imgOldWidth = aRet.GetSizePixel().Width(); - double imgOldHeight = aRet.GetSizePixel().Height(); - - if (imgOldWidth >= aStandardSize || imgOldHeight >= aStandardSize) - { - sal_Int32 imgNewWidth = 0; - sal_Int32 imgNewHeight = 0; - if (imgOldWidth >= imgOldHeight) - { - imgNewWidth = aStandardSize; - imgNewHeight = sal_Int32(imgOldHeight / (imgOldWidth / aStandardSize) + 0.5); - imgposX = 0; - imgposY = (aStandardSize - (imgOldHeight / (imgOldWidth / aStandardSize) + 0.5)) / 2 + 0.5; - } - else - { - imgNewHeight = aStandardSize; - imgNewWidth = sal_Int32(imgOldWidth / (imgOldHeight / aStandardSize) + 0.5); - imgposY = 0; - imgposX = (aStandardSize - (imgOldWidth / (imgOldHeight / aStandardSize) + 0.5)) / 2 + 0.5; - } - - Size aScaledSize( imgNewWidth, imgNewHeight ); - aRet.Scale( aScaledSize, BmpScaleFlag::BestQuality ); - } - else - { - imgposX = (aStandardSize - imgOldWidth) / 2 + 0.5; - imgposY = (aStandardSize - imgOldHeight) / 2 + 0.5; - } - - Size aStdSize( aStandardSize, aStandardSize ); - tools::Rectangle aRect(aEmptyPoint, aStdSize ); - - ScopedVclPtrInstance< VirtualDevice > aVirDevice(*Application::GetDefaultDevice()); - aVirDevice->SetOutputSizePixel( aStdSize ); - aVirDevice->SetFillColor( COL_TRANSPARENT ); - aVirDevice->SetLineColor( COL_TRANSPARENT ); - - // Draw a rect into virDevice - aVirDevice->DrawRect( aRect ); - Point aPointPixel( static_cast<tools::Long>(imgposX), static_cast<tools::Long>(imgposY) ); - aVirDevice->DrawBitmapEx( aPointPixel, aRet ); - aRet = aVirDevice->GetBitmap( aEmptyPoint, aStdSize ); - - return aRet; -} - sal_uInt8 BitmapEx::GetAlpha(sal_Int32 nX, sal_Int32 nY) const { if(maBitmap.IsEmpty()) diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index 2946b3357f93..10181b2b33e2 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -1006,46 +1006,6 @@ void CanvasCairoExtractBitmapData( const Bitmap & aBitmap, unsigned char*& data, } #endif -bool convertBitmap32To24Plus8(BitmapEx const & rInput, BitmapEx & rResult) -{ - const Bitmap& aBitmap(rInput.GetBitmap()); - if (aBitmap.getPixelFormat() != vcl::PixelFormat::N32_BPP) - return false; - - Size aSize = aBitmap.GetSizePixel(); - Bitmap aResultBitmap(aSize, vcl::PixelFormat::N24_BPP); - AlphaMask aResultAlpha(aSize); - { - BitmapScopedWriteAccess pResultBitmapAccess(aResultBitmap); - BitmapScopedWriteAccess pResultAlphaAccess(aResultAlpha); - - BitmapScopedReadAccess pReadAccess(aBitmap); - - for (tools::Long nY = 0; nY < aSize.Height(); ++nY) - { - Scanline aResultScan = pResultBitmapAccess->GetScanline(nY); - Scanline aResultScanAlpha = pResultAlphaAccess->GetScanline(nY); - - Scanline aReadScan = pReadAccess->GetScanline(nY); - - for (tools::Long nX = 0; nX < aSize.Width(); ++nX) - { - const BitmapColor aColor = pReadAccess->GetPixelFromData(aReadScan, nX); - BitmapColor aResultColor(aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue()); - BitmapColor aResultColorAlpha(aColor.GetAlpha(), aColor.GetAlpha(), aColor.GetAlpha()); - - pResultBitmapAccess->SetPixelOnData(aResultScan, nX, aResultColor); - pResultAlphaAccess->SetPixelOnData(aResultScanAlpha, nX, aResultColorAlpha); - } - } - } - if (rInput.IsAlpha()) - rResult = BitmapEx(aResultBitmap, rInput.GetAlphaMask()); - else - rResult = BitmapEx(aResultBitmap, aResultAlpha); - return true; -} - Bitmap GetDownsampledBitmap(Size const& rDstSizeTwip, Point const& rSrcPt, Size const& rSrcSz, Bitmap const& rBmp, tools::Long nMaxBmpDPIX, tools::Long nMaxBmpDPIY) { diff --git a/vcl/source/graphic/GraphicObject2.cxx b/vcl/source/graphic/GraphicObject2.cxx index c617b49a915a..d0549386d1de 100644 --- a/vcl/source/graphic/GraphicObject2.cxx +++ b/vcl/source/graphic/GraphicObject2.cxx @@ -401,81 +401,6 @@ bool GraphicObject::ImplDrawTiled( OutputDevice& rOut, const Point& rPosPixel, return bRet; } -void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx, - const GraphicAttr& rAttr, - const Size& rCropLeftTop, - const Size& rCropRightBottom, - const tools::Rectangle& rCropRect, - const Size& rDstSize, - bool bEnlarge ) const -{ - // #107947# Extracted from svdograf.cxx - - // #104115# Crop the bitmap - if( rAttr.IsCropped() ) - { - rBmpEx.Crop( rCropRect ); - - // #104115# Negative crop sizes mean: enlarge bitmap and pad - if( bEnlarge && ( - rCropLeftTop.Width() < 0 || - rCropLeftTop.Height() < 0 || - rCropRightBottom.Width() < 0 || - rCropRightBottom.Height() < 0 ) ) - { - Size aBmpSize( rBmpEx.GetSizePixel() ); - sal_Int32 nPadLeft( rCropLeftTop.Width() < 0 ? -rCropLeftTop.Width() : 0 ); - sal_Int32 nPadTop( rCropLeftTop.Height() < 0 ? -rCropLeftTop.Height() : 0 ); - sal_Int32 nPadTotalWidth( aBmpSize.Width() + nPadLeft + (rCropRightBottom.Width() < 0 ? -rCropRightBottom.Width() : 0) ); - sal_Int32 nPadTotalHeight( aBmpSize.Height() + nPadTop + (rCropRightBottom.Height() < 0 ? -rCropRightBottom.Height() : 0) ); - - BitmapEx aBmpEx2; - - if( rBmpEx.IsAlpha() ) - { - aBmpEx2 = rBmpEx; - } - else - { - // #104115# Generate mask bitmap and init to zero - AlphaMask aMask(aBmpSize); - aMask.Erase(255); - - // #104115# Always generate transparent bitmap, we need the border transparent - aBmpEx2 = BitmapEx( rBmpEx.GetBitmap(), aMask ); - - // #104115# Add opaque mask to source bitmap, otherwise the destination remains transparent - rBmpEx = aBmpEx2; - } - - aBmpEx2.Scale(Size(nPadTotalWidth, nPadTotalHeight)); - aBmpEx2.Erase( Color(ColorAlpha,0,0,0,0) ); - aBmpEx2.CopyPixel( tools::Rectangle( Point(nPadLeft, nPadTop), aBmpSize ), tools::Rectangle( Point(0, 0), aBmpSize ), rBmpEx ); - rBmpEx = aBmpEx2; - } - } - - const Size aSizePixel( rBmpEx.GetSizePixel() ); - - if( rAttr.GetRotation() == 0_deg10 || IsAnimated() ) - return; - - if( !(aSizePixel.Width() && aSizePixel.Height() && rDstSize.Width() && rDstSize.Height()) ) - return; - - double fSrcWH = static_cast<double>(aSizePixel.Width()) / aSizePixel.Height(); - double fDstWH = static_cast<double>(rDstSize.Width()) / rDstSize.Height(); - double fScaleX = 1.0, fScaleY = 1.0; - - // always choose scaling to shrink bitmap - if( fSrcWH < fDstWH ) - fScaleY = aSizePixel.Width() / ( fDstWH * aSizePixel.Height() ); - else - fScaleX = fDstWH * aSizePixel.Height() / aSizePixel.Width(); - - rBmpEx.Scale( fScaleX, fScaleY ); -} - void GraphicObject::ImplTransformBitmap( Bitmap& rBmp, const GraphicAttr& rAttr, const Size& rCropLeftTop,