vcl/inc/win/salbmp.h   |    4 
 vcl/win/gdi/salbmp.cxx |  224 -------------------------------------------------
 2 files changed, 228 deletions(-)

New commits:
commit f60b8997084b6bd924911e8b90289cb60cd66e17
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Fri Sep 5 09:33:33 2025 +0200
Commit:     Noel Grandin <noelgran...@gmail.com>
CommitDate: Fri Sep 5 10:56:58 2025 +0200

    ImplCreateGdiPlusBitmap is unused
    
    since
        commit aba63efcdb1b084c6ef68ecb8df2e648e993af13
        Author: Noel Grandin <noel.gran...@collabora.co.uk>
        Date:   Mon Sep 1 13:45:41 2025 +0200
        converting the SalGraphics backend from BitmapEx->Bitmap (3)
    
    Change-Id: I562ee88f1a66b0fad8fa7d58dc19b6b2231d8c8f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190609
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/vcl/inc/win/salbmp.h b/vcl/inc/win/salbmp.h
index 200051bf64f1..d87daa33b37c 100644
--- a/vcl/inc/win/salbmp.h
+++ b/vcl/inc/win/salbmp.h
@@ -39,12 +39,8 @@ private:
     void*               mpDIB;
     sal_Int32           mnDIBSize { 0 };
     HBITMAP             mhDDB;
-
     sal_uInt16          mnBitCount;
 
-    std::shared_ptr<Gdiplus::Bitmap>    ImplCreateGdiPlusBitmap(const 
WinSalBitmap& rAlphaSource);
-    std::shared_ptr<Gdiplus::Bitmap> ImplCreateGdiPlusBitmap();
-
 public:
 
     void*               ImplGethDIB() const { return mpDIB; }
diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx
index 8c926d5d35fe..0064da5cd507 100644
--- a/vcl/win/gdi/salbmp.cxx
+++ b/vcl/win/gdi/salbmp.cxx
@@ -169,230 +169,6 @@ std::shared_ptr< Gdiplus::Bitmap > 
WinSalBitmap::ImplGetGdiPlusBitmap() const
     return aRetval;
 }
 
-std::shared_ptr<Gdiplus::Bitmap> WinSalBitmap::ImplCreateGdiPlusBitmap()
-{
-    std::shared_ptr<Gdiplus::Bitmap> pRetval;
-    WinSalBitmap* pSalRGB = this;
-    std::optional<WinSalBitmap> pExtraWinSalRGB;
-
-    if(!pSalRGB->ImplGethDIB())
-    {
-        // we need DIB for success with AcquireBuffer, create a replacement 
WinSalBitmap
-        pExtraWinSalRGB.emplace();
-        pExtraWinSalRGB->Create(*pSalRGB);
-        pSalRGB = &*pExtraWinSalRGB;
-    }
-
-    BitmapBuffer* pRGB = pSalRGB->AcquireBuffer(BitmapAccessMode::Read);
-    std::optional<BitmapBuffer> pExtraRGB;
-
-    if (pRGB && ScanlineFormat::N24BitTcBgr != pRGB->meFormat)
-    {
-        // convert source bitmap to BMP_FORMAT_24BIT_TC_BGR format if not yet 
in that format
-        SalTwoRect aSalTwoRect(0, 0, pRGB->mnWidth, pRGB->mnHeight, 0, 0, 
pRGB->mnWidth, pRGB->mnHeight);
-        pExtraRGB = StretchAndConvert(
-            *pRGB,
-            aSalTwoRect,
-            ScanlineFormat::N24BitTcBgr);
-
-        pSalRGB->ReleaseBuffer(pRGB, BitmapAccessMode::Write);
-        pRGB = pExtraRGB ? &*pExtraRGB : nullptr;
-    }
-
-    if (pRGB
-        && pRGB->mnWidth > 0
-        && pRGB->mnHeight > 0
-        && ScanlineFormat::N24BitTcBgr == pRGB->meFormat)
-    {
-        const sal_uInt32 nW(pRGB->mnWidth);
-        const sal_uInt32 nH(pRGB->mnHeight);
-
-        pRetval = std::make_shared<Gdiplus::Bitmap>(nW, nH, 
PixelFormat24bppRGB);
-
-        if ( pRetval->GetLastStatus() == Gdiplus::Ok )
-        {
-            sal_uInt8* pSrcRGB(pRGB->mpBits);
-            const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3));
-            const bool bTopDown(pRGB->meDirection == 
ScanlineDirection::TopDown);
-            const Gdiplus::Rect aAllRect(0, 0, nW, nH);
-            Gdiplus::BitmapData aGdiPlusBitmapData;
-            pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, 
PixelFormat24bppRGB, &aGdiPlusBitmapData);
-
-            // copy data to Gdiplus::Bitmap; format is BGR here in both cases, 
so memcpy is possible
-            for(sal_uInt32 y(0); y < nH; y++)
-            {
-                const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1);
-                sal_uInt8* targetPixels = 
static_cast<sal_uInt8*>(aGdiPlusBitmapData.Scan0) + (nYInsert * 
aGdiPlusBitmapData.Stride);
-
-                memcpy(targetPixels, pSrcRGB, nW * 3);
-                pSrcRGB += nW * 3 + nExtraRGB;
-            }
-
-            pRetval->UnlockBits(&aGdiPlusBitmapData);
-        }
-        else
-        {
-            pRetval.reset();
-        }
-    }
-
-    if(pExtraRGB)
-    {
-        // #i123478# shockingly, BitmapBuffer does not free the memory it is 
controlling
-        // in its destructor, this *has to be done by hand*. Doing it here now
-        delete[] pExtraRGB->mpBits;
-        pExtraRGB.reset();
-    }
-    else
-    {
-        pSalRGB->ReleaseBuffer(pRGB, BitmapAccessMode::Read);
-    }
-
-    return pRetval;
-}
-
-std::shared_ptr<Gdiplus::Bitmap> WinSalBitmap::ImplCreateGdiPlusBitmap(const 
WinSalBitmap& rAlphaSource)
-{
-    std::shared_ptr<Gdiplus::Bitmap> pRetval;
-    WinSalBitmap* pSalRGB = this;
-    std::optional<WinSalBitmap> pExtraWinSalRGB;
-
-    if(!pSalRGB->ImplGethDIB())
-    {
-        // we need DIB for success with AcquireBuffer, create a replacement 
WinSalBitmap
-        pExtraWinSalRGB.emplace();
-        pExtraWinSalRGB->Create(*pSalRGB);
-        pSalRGB = &*pExtraWinSalRGB;
-    }
-
-    BitmapBuffer* pRGB = pSalRGB->AcquireBuffer(BitmapAccessMode::Read);
-    std::optional<BitmapBuffer> pExtraRGB;
-
-    if (pRGB && ScanlineFormat::N24BitTcBgr != pRGB->meFormat)
-    {
-        // convert source bitmap to canlineFormat::N24BitTcBgr format if not 
yet in that format
-        SalTwoRect aSalTwoRect(0, 0, pRGB->mnWidth, pRGB->mnHeight, 0, 0, 
pRGB->mnWidth, pRGB->mnHeight);
-        pExtraRGB = StretchAndConvert(
-            *pRGB,
-            aSalTwoRect,
-            ScanlineFormat::N24BitTcBgr);
-
-        pSalRGB->ReleaseBuffer(pRGB, BitmapAccessMode::Read);
-        pRGB = pExtraRGB ? &*pExtraRGB : nullptr;
-    }
-
-    WinSalBitmap* pSalA = const_cast< WinSalBitmap* >(&rAlphaSource);
-    std::optional<WinSalBitmap> pExtraWinSalA;
-
-    if(!pSalA->ImplGethDIB())
-    {
-        // we need DIB for success with AcquireBuffer, create a replacement 
WinSalBitmap
-        pExtraWinSalA.emplace();
-        pExtraWinSalA->Create(*pSalA);
-        pSalA = &*pExtraWinSalA;
-    }
-
-    BitmapBuffer* pA = pSalA->AcquireBuffer(BitmapAccessMode::Read);
-    std::optional<BitmapBuffer> pExtraA;
-
-    if (pA && ScanlineFormat::N8BitPal != pA->meFormat)
-    {
-        // convert alpha bitmap to ScanlineFormat::N8BitPal format if not yet 
in that format
-        SalTwoRect aSalTwoRect(0, 0, pA->mnWidth, pA->mnHeight, 0, 0, 
pA->mnWidth, pA->mnHeight);
-
-        pExtraA = StretchAndConvert(
-            *pA,
-            aSalTwoRect,
-            ScanlineFormat::N8BitPal);
-
-        pSalA->ReleaseBuffer(pA, BitmapAccessMode::Read);
-        pA = pExtraA ? &*pExtraA : nullptr;
-    }
-
-    if(pRGB
-        && pA
-        && pRGB->mnWidth > 0
-        && pRGB->mnHeight > 0
-        && pRGB->mnWidth == pA->mnWidth
-        && pRGB->mnHeight == pA->mnHeight
-        && ScanlineFormat::N24BitTcBgr == pRGB->meFormat
-        && ScanlineFormat::N8BitPal == pA->meFormat)
-    {
-        // we have alpha and bitmap in known formats, create GdiPlus Bitmap as 
32bit ARGB
-        const sal_uInt32 nW(pRGB->mnWidth);
-        const sal_uInt32 nH(pRGB->mnHeight);
-
-        pRetval = std::make_shared<Gdiplus::Bitmap>(nW, nH, 
PixelFormat32bppARGB);
-
-        if ( pRetval->GetLastStatus() == Gdiplus::Ok ) // 2nd place to secure 
with new Gdiplus::Bitmap
-        {
-            sal_uInt8* pSrcRGB(pRGB->mpBits);
-            sal_uInt8* pSrcA(pA->mpBits);
-            const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3));
-            const sal_uInt32 nExtraA(pA->mnScanlineSize - nW);
-            const bool bTopDown(pRGB->meDirection == 
ScanlineDirection::TopDown);
-            const Gdiplus::Rect aAllRect(0, 0, nW, nH);
-            Gdiplus::BitmapData aGdiPlusBitmapData;
-            pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, 
PixelFormat32bppARGB, &aGdiPlusBitmapData);
-
-            // copy data to Gdiplus::Bitmap; format is BGRA; need to mix BGR 
from Bitmap and
-            // A from alpha, so inner loop is needed (who invented BitmapEx..?)
-            for(sal_uInt32 y(0); y < nH; y++)
-            {
-                const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1);
-                sal_uInt8* targetPixels = 
static_cast<sal_uInt8*>(aGdiPlusBitmapData.Scan0) + (nYInsert * 
aGdiPlusBitmapData.Stride);
-
-                for(sal_uInt32 x(0); x < nW; x++)
-                {
-                    *targetPixels++ = *pSrcRGB++;
-                    *targetPixels++ = *pSrcRGB++;
-                    *targetPixels++ = *pSrcRGB++;
-                    *targetPixels++ = *pSrcA++;
-                }
-
-                pSrcRGB += nExtraRGB;
-                pSrcA += nExtraA;
-            }
-
-            pRetval->UnlockBits(&aGdiPlusBitmapData);
-        }
-        else
-        {
-            pRetval.reset();
-        }
-    }
-
-    if(pExtraA)
-    {
-        // #i123478# shockingly, BitmapBuffer does not free the memory it is 
controlling
-        // in its destructor, this *has to be done by hand*. Doing it here now
-        delete[] pExtraA->mpBits;
-        pExtraA.reset();
-    }
-    else
-    {
-        pSalA->ReleaseBuffer(pA, BitmapAccessMode::Read);
-    }
-
-    pExtraWinSalA.reset();
-
-    if(pExtraRGB)
-    {
-        // #i123478# shockingly, BitmapBuffer does not free the memory it is 
controlling
-        // in its destructor, this *has to be done by hand*. Doing it here now
-        delete[] pExtraRGB->mpBits;
-        pExtraRGB.reset();
-    }
-    else
-    {
-        pSalRGB->ReleaseBuffer(pRGB, BitmapAccessMode::Read);
-    }
-
-    pExtraWinSalRGB.reset();
-
-    return pRetval;
-}
-
 bool WinSalBitmap::Create( HBITMAP hBitmap )
 {
     assert(hBitmap);

Reply via email to