include/vcl/outdev.hxx                          |    5 
 vcl/headless/CairoCommon.cxx                    |    5 
 vcl/headless/SvpGraphicsBackend.cxx             |    3 
 vcl/inc/headless/CairoCommon.hxx                |    2 
 vcl/inc/headless/SvpGraphicsBackend.hxx         |    2 
 vcl/inc/qt5/QtGraphics.hxx                      |    2 
 vcl/inc/quartz/salgdi.h                         |    2 
 vcl/inc/salgdi.hxx                              |   12 -
 vcl/inc/salgdiimpl.hxx                          |    2 
 vcl/inc/skia/gdiimpl.hxx                        |    6 
 vcl/inc/win/salgdi.h                            |    2 
 vcl/qt5/QtGraphics_GDI.cxx                      |    3 
 vcl/quartz/AquaGraphicsBackend.cxx              |   11 -
 vcl/skia/gdiimpl.cxx                            |    3 
 vcl/source/gdi/salgdilayout.cxx                 |    6 
 vcl/source/outdev/bitmap.cxx                    |  220 ------------------------
 vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx |    3 
 vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx |    6 
 vcl/win/gdi/gdiimpl.cxx                         |    3 
 vcl/win/gdi/gdiimpl.hxx                         |    6 
 vcl/win/gdi/salgdi_gdiplus.cxx                  |    4 
 21 files changed, 40 insertions(+), 268 deletions(-)

New commits:
commit 49e84a4f359357fe220e9f874c69d309c6501af0
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Sep 1 12:43:16 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue Sep 2 07:53:56 2025 +0200

    simplify drawAlphaBitmap paths
    
    they either return true, or they fail in ways that cannot usefully be 
recovered from.
    
    So just remove the bool return value, and drop the fallback code.
    
    Change-Id: I8a6ac9925defd0a304281f223f11393106b63e28
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190497
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index f8aae0a57ecb..39667e63d719 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1469,11 +1469,6 @@ private:
                                     const Point& rSrcPtPixel,
                                     const Size& rSrcSizePixel );
 
-    SAL_DLLPRIVATE void DrawDeviceAlphaBitmapSlowPath(
-                                const Bitmap& rBitmap,
-                                const tools::Rectangle& rDstRect, const 
tools::Rectangle& rBmpRect,
-                                Size const& rOutSz, Point const& rOutPt);
-
     ///@}
 
 
diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx
index f115637d8179..ddfa97f14bcd 100644
--- a/vcl/headless/CairoCommon.cxx
+++ b/vcl/headless/CairoCommon.cxx
@@ -1680,7 +1680,7 @@ void CairoCommon::drawBitmap(const SalTwoRect& rPosAry, 
const SalBitmap& rSalBit
 #endif
 }
 
-bool CairoCommon::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& 
rSalBitmap,
+void CairoCommon::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& 
rSalBitmap,
                                   bool bAntiAlias)
 {
     // MM02 try to access buffered BitmapHelper
@@ -1691,11 +1691,10 @@ bool CairoCommon::drawAlphaBitmap(const SalTwoRect& 
rPosAry, const SalBitmap& rS
     if (!source)
     {
         SAL_WARN("vcl.gdi", "unsupported SvpSalGraphics::drawAlphaBitmap 
case");
-        return false;
+        return;
     }
 
     copyWithOperator(rPosAry, source, CAIRO_OPERATOR_OVER, bAntiAlias);
-    return true;
 }
 
 bool CairoCommon::drawTransformedBitmap(const basegfx::B2DPoint& rNull, const 
basegfx::B2DPoint& rX,
diff --git a/vcl/headless/SvpGraphicsBackend.cxx 
b/vcl/headless/SvpGraphicsBackend.cxx
index cdcc4d802302..14b5d72b0423 100644
--- a/vcl/headless/SvpGraphicsBackend.cxx
+++ b/vcl/headless/SvpGraphicsBackend.cxx
@@ -206,10 +206,9 @@ void SvpGraphicsBackend::invert(sal_uInt32 nPoints, const 
Point* pPtAry, SalInve
     m_rCairoCommon.invert(nPoints, pPtAry, nFlags, getAntiAlias());
 }
 
-bool SvpGraphicsBackend::drawAlphaBitmap(const SalTwoRect& rTR, const 
SalBitmap& rSourceBitmap)
+void SvpGraphicsBackend::drawAlphaBitmap(const SalTwoRect& rTR, const 
SalBitmap& rSourceBitmap)
 {
     m_rCairoCommon.drawAlphaBitmap(rTR, rSourceBitmap, getAntiAlias());
-    return true;
 }
 
 bool SvpGraphicsBackend::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
diff --git a/vcl/inc/headless/CairoCommon.hxx b/vcl/inc/headless/CairoCommon.hxx
index 54fa12e2b0ea..8b8eb9763797 100644
--- a/vcl/inc/headless/CairoCommon.hxx
+++ b/vcl/inc/headless/CairoCommon.hxx
@@ -214,7 +214,7 @@ struct VCL_DLLPUBLIC CairoCommon
 
     void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, 
bool bAntiAlias);
 
-    bool drawAlphaBitmap(const SalTwoRect& rTR, const SalBitmap& 
rSourceBitmap, bool bAntiAlias);
+    void drawAlphaBitmap(const SalTwoRect& rTR, const SalBitmap& 
rSourceBitmap, bool bAntiAlias);
 
     bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const 
basegfx::B2DPoint& rX,
                                const basegfx::B2DPoint& rY, const SalBitmap& 
rSourceBitmap,
diff --git a/vcl/inc/headless/SvpGraphicsBackend.hxx 
b/vcl/inc/headless/SvpGraphicsBackend.hxx
index 45f8414da807..b388b8a9245a 100644
--- a/vcl/inc/headless/SvpGraphicsBackend.hxx
+++ b/vcl/inc/headless/SvpGraphicsBackend.hxx
@@ -99,7 +99,7 @@ public:
 
     void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) 
override;
 
-    bool drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap) 
override;
+    void drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap) 
override;
 
     bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const 
basegfx::B2DPoint& rX,
                                const basegfx::B2DPoint& rY, const SalBitmap& 
rSourceBitmap,
diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx
index c4fb3e20c7cc..6bd243d8d077 100644
--- a/vcl/inc/qt5/QtGraphics.hxx
+++ b/vcl/inc/qt5/QtGraphics.hxx
@@ -128,7 +128,7 @@ public:
 
     void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) 
override;
 
-    bool drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap) 
override;
+    void drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap) 
override;
 
     bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const 
basegfx::B2DPoint& rX,
                                const basegfx::B2DPoint& rY, const SalBitmap& 
rSourceBitmap,
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index f30b4d0bc837..2cbfa4392450 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -340,7 +340,7 @@ public:
     bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, 
tools::Long nHeight,
                  void* pPtr, sal_uInt32 nSize) override;
 
-    bool drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap) 
override;
+    void drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap) 
override;
 
     bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const 
basegfx::B2DPoint& rX,
                                const basegfx::B2DPoint& rY, const SalBitmap& 
rSourceBitmap,
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 7e1e99e14488..64c858fdfb6a 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -353,7 +353,7 @@ public:
      */
     inline bool UpdateSettings(AllSettings&);
 
-    SAL_DLLPRIVATE bool                        DrawAlphaBitmap(
+    SAL_DLLPRIVATE void                        DrawAlphaBitmap(
                                     const SalTwoRect&,
                                     const SalBitmap& rSourceBitmap,
                                     const OutputDevice& rOutDev );
@@ -507,12 +507,8 @@ protected:
 
         @param rSourceBitmap
         Source bitmap to blit
-
-        @return true, if the operation succeeded, and false
-        otherwise. In this case, clients should try to emulate alpha
-        compositing themselves
      */
-    virtual bool                drawAlphaBitmap(
+    virtual void                drawAlphaBitmap(
                                     const SalTwoRect&,
                                     const SalBitmap& rSourceBitmap ) = 0;
 
@@ -788,9 +784,9 @@ public:
         return GetImpl()->getPixel(nX, nY);
     }
 
-    bool drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& 
rSourceBitmap) override
+    void drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& 
rSourceBitmap) override
     {
-        return GetImpl()->drawAlphaBitmap(rPosAry, rSourceBitmap);
+        GetImpl()->drawAlphaBitmap(rPosAry, rSourceBitmap);
     }
 
     bool drawTransformedBitmap(const basegfx::B2DPoint& rNull,
diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx
index c6bde85d4e2d..3f6c20785db6 100644
--- a/vcl/inc/salgdiimpl.hxx
+++ b/vcl/inc/salgdiimpl.hxx
@@ -176,7 +176,7 @@ public:
                 void* /*pPtr*/,
                 sal_uInt32 /*nSize*/ ) { return false; }
 
-    virtual bool drawAlphaBitmap(
+    virtual void drawAlphaBitmap(
                 const SalTwoRect&,
                 const SalBitmap& rSourceBitmap ) = 0;
 
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index 551382de7b5b..ff9d68e9f7f8 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -144,12 +144,8 @@ public:
 
         @param rSourceBitmap
         Source bitmap to blit
-
-        @return true, if the operation succeeded, and false
-        otherwise. In this case, clients should try to emulate alpha
-        compositing themselves
      */
-    virtual bool drawAlphaBitmap(const SalTwoRect&, const SalBitmap& 
rSourceBitmap) override;
+    virtual void drawAlphaBitmap(const SalTwoRect&, const SalBitmap& 
rSourceBitmap) override;
 
     /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the 
coordinate system */
     virtual bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const 
basegfx::B2DPoint& rX,
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 266fa02421eb..8904b8627ee5 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -119,7 +119,7 @@ public:
     void setHWND(HWND hWnd);
     void Flush();
 
-    virtual bool        drawAlphaBitmap( const SalTwoRect&,
+    virtual void       drawAlphaBitmap( const SalTwoRect&,
                                          const SalBitmap& rSourceBitmap ) 
override;
     virtual bool       drawTransformedBitmap(
                            const basegfx::B2DPoint& rNull,
diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx
index 3bb51df1e78b..06a2ad33dce6 100644
--- a/vcl/qt5/QtGraphics_GDI.cxx
+++ b/vcl/qt5/QtGraphics_GDI.cxx
@@ -572,10 +572,9 @@ static QImage getAlphaImage(const SalBitmap& 
rSourceBitmap, const SalBitmap& rAl
     return aImage;
 }
 
-bool QtGraphicsBackend::drawAlphaBitmap(const SalTwoRect& rPosAry, const 
SalBitmap& rSourceBitmap)
+void QtGraphicsBackend::drawAlphaBitmap(const SalTwoRect& rPosAry, const 
SalBitmap& rSourceBitmap)
 {
     drawBitmap(rPosAry, rSourceBitmap);
-    return true;
 }
 
 bool QtGraphicsBackend::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
diff --git a/vcl/quartz/AquaGraphicsBackend.cxx 
b/vcl/quartz/AquaGraphicsBackend.cxx
index d2fbf7dd725c..4f0ffc6c130e 100644
--- a/vcl/quartz/AquaGraphicsBackend.cxx
+++ b/vcl/quartz/AquaGraphicsBackend.cxx
@@ -1190,16 +1190,20 @@ bool AquaGraphicsBackend::drawEPS(tools::Long /*nX*/, 
tools::Long /*nY*/, tools:
 }
 #endif
 
-bool AquaGraphicsBackend::drawAlphaBitmap(const SalTwoRect& rPosAry, const 
SalBitmap& rSalBitmap)
+void AquaGraphicsBackend::drawAlphaBitmap(const SalTwoRect& rPosAry, const 
SalBitmap& rSalBitmap)
 {
     if (!mrShared.checkContext())
-        return false;
+    {
+        assert(false);
+        return;
+    }
 
     CGImageRef xImage = rSalBitmap.CreateCroppedImage(
         static_cast<int>(rPosAry.mnSrcX), static_cast<int>(rPosAry.mnSrcY),
         static_cast<int>(rPosAry.mnSrcWidth), 
static_cast<int>(rPosAry.mnSrcHeight));
+    assert(xImage);
     if (!xImage)
-        return false;
+        return;
 
     const CGRect aDstRect
         = CGRectMake(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth, 
rPosAry.mnDestHeight);
@@ -1207,7 +1211,6 @@ bool AquaGraphicsBackend::drawAlphaBitmap(const 
SalTwoRect& rPosAry, const SalBi
 
     CGImageRelease(xImage);
     refreshRect(aDstRect);
-    return true;
 }
 
 bool AquaGraphicsBackend::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index d2ccf0076788..f123237c9b3d 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -1727,7 +1727,7 @@ OString SkiaSalGraphicsImpl::makeCachedImageKey(const 
SkiaSalBitmap& bitmap,
     return key;
 }
 
-bool SkiaSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rPosAry, const 
SalBitmap& rSourceBitmap)
+void SkiaSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rPosAry, const 
SalBitmap& rSourceBitmap)
 {
     assert(dynamic_cast<const SkiaSalBitmap*>(&rSourceBitmap));
     const SkiaSalBitmap& rSkiaSourceBitmap = static_cast<const 
SkiaSalBitmap&>(rSourceBitmap);
@@ -1750,7 +1750,6 @@ bool SkiaSalGraphicsImpl::drawAlphaBitmap(const 
SalTwoRect& rPosAry, const SalBi
         drawImage(imagePosAry, image, mScaling);
     else
         drawShader(rPosAry, 
rSkiaSourceBitmap.GetSkShader(makeSamplingOptions(rPosAry, mScaling)));
-    return true;
 }
 
 void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const 
SkiaSalBitmap& bitmap,
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 0498437dea12..584143b2b6e4 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -822,7 +822,7 @@ bool SalGraphics::GetNativeControlRegion( ControlType 
nType, ControlPart nPart,
         return forWidget()->getNativeControlRegion(nType, nPart, 
rControlRegion, nState, aValue, OUString(), rNativeBoundingRegion, 
rNativeContentRegion);
 }
 
-bool SalGraphics::DrawAlphaBitmap( const SalTwoRect& rPosAry,
+void SalGraphics::DrawAlphaBitmap( const SalTwoRect& rPosAry,
                                    const SalBitmap& rSourceBitmap,
                                    const OutputDevice& rOutDev )
 {
@@ -830,10 +830,10 @@ bool SalGraphics::DrawAlphaBitmap( const SalTwoRect& 
rPosAry,
     {
         SalTwoRect aPosAry2 = rPosAry;
         mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, rOutDev );
-        return drawAlphaBitmap( aPosAry2, rSourceBitmap );
+        drawAlphaBitmap( aPosAry2, rSourceBitmap );
     }
     else
-        return drawAlphaBitmap( rPosAry, rSourceBitmap );
+        drawAlphaBitmap( rPosAry, rSourceBitmap );
 }
 
 bool SalGraphics::DrawTransformedBitmap(
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 6030a6766d3c..12f63cc8b892 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -307,224 +307,20 @@ void OutputDevice::DrawDeviceAlphaBitmap( const Bitmap& 
rBmp,
     if (aDstRect.Intersection(tools::Rectangle(aOutPt, aOutSz)).IsEmpty())
         return;
 
-    {
-        Point aRelPt = aOutPt + Point(mnOutOffX, mnOutOffY);
-        SalTwoRect aTR(
-            rSrcPtPixel.X(), rSrcPtPixel.Y(),
-            rSrcSizePixel.Width(), rSrcSizePixel.Height(),
-            aRelPt.X(), aRelPt.Y(),
-            aOutSz.Width(), aOutSz.Height());
-
-        Bitmap bitmap(rBmp);
-        if(bHMirr || bVMirr)
-        {
-            bitmap.Mirror(mirrorFlags);
-        }
-        SalBitmap* pSalSrcBmp = bitmap.ImplGetSalBitmap().get();
-
-        if (mpGraphics->DrawAlphaBitmap(aTR, *pSalSrcBmp, *this))
-            return;
-
-        // we need to make sure Skia never reaches this slow code path
-        // (but do not fail in no-op cases)
-        assert(!SkiaHelper::isVCLSkiaEnabled() || 
!SkiaHelper::isAlphaMaskBlendingEnabled()
-            || tools::Rectangle(Point(), rBmp.GetSizePixel())
-                .Intersection(tools::Rectangle(rSrcPtPixel, 
rSrcSizePixel)).IsEmpty());
-    }
-
-    tools::Rectangle aBmpRect(Point(), rBmp.GetSizePixel());
-    if (aBmpRect.Intersection(tools::Rectangle(rSrcPtPixel, 
rSrcSizePixel)).IsEmpty())
-        return;
+    Point aRelPt = aOutPt + Point(mnOutOffX, mnOutOffY);
+    SalTwoRect aTR(
+        rSrcPtPixel.X(), rSrcPtPixel.Y(),
+        rSrcSizePixel.Width(), rSrcSizePixel.Height(),
+        aRelPt.X(), aRelPt.Y(),
+        aOutSz.Width(), aOutSz.Height());
 
-    Point     auxOutPt(LogicToPixel(rDestPt));
-    Size      auxOutSz(LogicToPixel(rDestSize));
-
-    // HACK: The function is broken with alpha vdev and mirroring, mirror here.
     Bitmap bitmap(rBmp);
     if(bHMirr || bVMirr)
     {
         bitmap.Mirror(mirrorFlags);
-        auxOutPt = aOutPt;
-        auxOutSz = aOutSz;
     }
-    DrawDeviceAlphaBitmapSlowPath(bitmap, aDstRect, aBmpRect, auxOutSz, 
auxOutPt);
-}
-
-namespace
-{
-
-struct TradScaleContext
-{
-    std::unique_ptr<sal_Int32[]> mpMapX;
-    std::unique_ptr<sal_Int32[]> mpMapY;
-
-    TradScaleContext(tools::Rectangle const & aDstRect, tools::Rectangle const 
& aBitmapRect,
-                 Size const & aOutSize, tools::Long nOffX, tools::Long nOffY)
-
-        : mpMapX(new sal_Int32[aDstRect.GetWidth()])
-        , mpMapY(new sal_Int32[aDstRect.GetHeight()])
-    {
-        const tools::Long nSrcWidth = aBitmapRect.GetWidth();
-        const tools::Long nSrcHeight = aBitmapRect.GetHeight();
-
-        const bool bHMirr = aOutSize.Width() < 0;
-        const bool bVMirr = aOutSize.Height() < 0;
-
-        generateSimpleMap(
-            nSrcWidth, aDstRect.GetWidth(), aBitmapRect.Left(),
-            aOutSize.Width(), nOffX, bHMirr, mpMapX.get());
-
-        generateSimpleMap(
-            nSrcHeight, aDstRect.GetHeight(), aBitmapRect.Top(),
-            aOutSize.Height(), nOffY, bVMirr, mpMapY.get());
-    }
-
-private:
-
-    static void generateSimpleMap(tools::Long nSrcDimension, tools::Long 
nDstDimension, tools::Long nDstLocation,
-                                  tools::Long nOutDimension, tools::Long 
nOffset, bool bMirror, sal_Int32* pMap)
-    {
-        tools::Long nMirrorOffset = 0;
-
-        if (bMirror)
-            nMirrorOffset = (nDstLocation << 1) + nSrcDimension - 1;
-
-        for (tools::Long i = 0; i < nDstDimension; ++i, ++nOffset)
-        {
-            pMap[i] = nDstLocation + nOffset * nSrcDimension / nOutDimension;
-            if (bMirror)
-                pMap[i] = nMirrorOffset - pMap[i];
-        }
-    }
-};
-
-
-// Co = Cs + Cd*(1-As) premultiplied alpha -or-
-// Co = (AsCs + AdCd*(1-As)) / Ao
-sal_uInt8 lcl_CalcColor( const sal_uInt8 nSourceColor, const sal_uInt8 
nSourceAlpha,
-                            const sal_uInt8 nDstAlpha, const sal_uInt8 
nResAlpha, const sal_uInt8 nDestColor )
-{
-    int c = nResAlpha ? ( static_cast<int>(nSourceAlpha)*nSourceColor + 
static_cast<int>(nDstAlpha)*nDestColor -
-                          
static_cast<int>(nDstAlpha)*nDestColor*nSourceAlpha/255 ) / 
static_cast<int>(nResAlpha) : 0;
-    return sal_uInt8( c );
-}
-
-// blend one color with another color with an alpha value
-
-BitmapColor lcl_AlphaBlendColors(const BitmapColor& rCol1, const BitmapColor& 
rCol2)
-{
-    const sal_uInt8 nAlpha = rCol1.GetAlpha();
-    BitmapColor aCol(rCol2);
-
-    // Perform porter-duff compositing 'over' operation
-
-    // Co = Cs + Cd*(1-As)
-    // Ad = As + Ad*(1-As)
-    const sal_uInt8 nResAlpha = static_cast<int>(nAlpha) + 
static_cast<int>(rCol2.GetAlpha())
-              - static_cast<int>(rCol2.GetAlpha()) * nAlpha / 255;
-
-    aCol.SetAlpha(nResAlpha);
-    aCol.SetRed(lcl_CalcColor(rCol1.GetRed(), nAlpha, rCol2.GetAlpha(), 
nResAlpha, aCol.GetRed()));
-    aCol.SetBlue(lcl_CalcColor(rCol1.GetBlue(), nAlpha, rCol2.GetAlpha(), 
nResAlpha, aCol.GetBlue()));
-    aCol.SetGreen(lcl_CalcColor(rCol1.GetGreen(), nAlpha, rCol2.GetAlpha(), 
nResAlpha, aCol.GetGreen()));
-
-    return aCol;
-}
-
-Bitmap lcl_BlendBitmapWithAlpha(
-            Bitmap&             aBmp,
-            const Bitmap&       rBitmap,
-            const sal_Int32     nDstHeight,
-            const sal_Int32     nDstWidth,
-            const sal_Int32*    pMapX,
-            const sal_Int32*    pMapY )
-
-{
-    Bitmap      res;
-
-    BitmapScopedReadAccess pSrcBmp(rBitmap);
-
-    {
-        BitmapScopedWriteAccess pDstBmp(aBmp);
-        if (pDstBmp && pSrcBmp)
-        {
-            for( int nY = 0; nY < nDstHeight; nY++ )
-            {
-                const tools::Long  nMapY = pMapY[ nY ];
-                Scanline pDstScanline = pDstBmp->GetScanline(nY);
-
-                for( int nX = 0; nX < nDstWidth; nX++ )
-                {
-                    pDstBmp->SetPixelOnData(pDstScanline, nX,
-                                            
lcl_AlphaBlendColors(pSrcBmp->GetColor(nMapY, pMapX[nX]),
-                                                                 
pDstBmp->GetColor(nY, nX)));
-                }
-            }
-        }
-
-        pDstBmp.reset();
-        res = aBmp;
-    }
-
-    return res;
-}
-
-} // end anonymous namespace
-
-void OutputDevice::DrawDeviceAlphaBitmapSlowPath(const Bitmap& rBitmap,
-    const tools::Rectangle& rDstRect, const tools::Rectangle& rBmpRect, Size 
const& rOutSize, Point const& rOutPoint)
-{
-    assert(!is_double_buffered_window());
-
-    // The scaling in this code path produces really ugly results - it
-    // does the most trivial scaling with no smoothing.
-    GDIMetaFile* pOldMetaFile = mpMetaFile;
-    const bool   bOldMap = mbMap;
-
-    mpMetaFile = nullptr; // fdo#55044 reset before GetBitmap!
-    mbMap = false;
-
-    Bitmap aDeviceBmp(GetBitmap(rDstRect.TopLeft(), rDstRect.GetSize()));
-
-    // #109044# The generated bitmap need not necessarily be
-    // of aDstRect dimensions, it's internally clipped to
-    // window bounds. Thus, we correct the dest size here,
-    // since we later use it (in nDstWidth/Height) for pixel
-    // access)
-    // #i38887# reading from screen may sometimes fail
-
-    tools::Rectangle aDstRect(rDstRect);
-
-    if (aDeviceBmp.ImplGetSalBitmap())
-        aDstRect.SetSize(aDeviceBmp.GetSizePixel());
-
-    // calculate offset in original bitmap
-    // in RTL case this is a little more complicated since the contents of the
-    // bitmap is not mirrored (it never is), however the paint region and bmp 
region
-    // are in mirrored coordinates, so the intersection of (aOutPt,aOutSz) 
with these
-    // is content wise somewhere else and needs to take mirroring into account
-    const tools::Long nOffX = IsRTLEnabled()
-                            ? rOutSize.Width() - aDstRect.GetWidth() - 
(aDstRect.Left() - rOutPoint.X())
-                            : aDstRect.Left() - rOutPoint.X();
-
-    const tools::Long nOffY = aDstRect.Top() - rOutPoint.Y();
-
-    const TradScaleContext aTradContext(aDstRect, rBmpRect, rOutSize, nOffX, 
nOffY);
-
-    // #i38887# reading from screen may sometimes fail
-    if (aDeviceBmp.ImplGetSalBitmap())
-    {
-        Bitmap aNewBitmap;
-
-        aNewBitmap = lcl_BlendBitmapWithAlpha(
-                        aDeviceBmp, rBitmap, aDstRect.GetHeight(), 
aDstRect.GetWidth(),
-                        aTradContext.mpMapX.get(), aTradContext.mpMapY.get() );
-
-        DrawBitmap(aDstRect.TopLeft(), aNewBitmap);
-    }
-
-    mbMap = bOldMap;
-    mpMetaFile = pOldMetaFile;
+    SalBitmap* pSalSrcBmp = bitmap.ImplGetSalBitmap().get();
+    mpGraphics->DrawAlphaBitmap(aTR, *pSalSrcBmp, *this);
 }
 
 bool OutputDevice::HasFastDrawTransformedBitmap() const
diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx 
b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx
index 63221894e1b7..c80caf4c23e1 100644
--- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx
+++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx
@@ -166,10 +166,9 @@ void X11CairoSalGraphicsImpl::drawBitmap(const SalTwoRect& 
rPosAry, const SalBit
     mrCairoCommon.drawBitmap(rPosAry, rSalBitmap, getAntiAlias());
 }
 
-bool X11CairoSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rTR, const 
SalBitmap& rSrcBitmap)
+void X11CairoSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rTR, const 
SalBitmap& rSrcBitmap)
 {
     mrCairoCommon.drawAlphaBitmap(rTR, rSrcBitmap, getAntiAlias());
-    return true;
 }
 
 void X11CairoSalGraphicsImpl::drawMask(const SalTwoRect& rTR, const SalBitmap& 
rSalBitmap,
diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx 
b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx
index eea98176aa1b..b95d2c90b684 100644
--- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx
+++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx
@@ -134,12 +134,8 @@ public:
 
         @param rAlphaBitmap
         Alpha channel to use for blitting
-
-        @return true, if the operation succeeded, and false
-        otherwise. In this case, clients should try to emulate alpha
-        compositing themselves
      */
-    bool drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap) 
override;
+    void drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap) 
override;
 
     void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
                   Color nMaskColor) override;
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index ca20fba63c8c..7f6484bf9cda 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2372,12 +2372,11 @@ bool WinSalGraphicsImpl::TryDrawBitmapGDIPlus(const 
SalTwoRect& rTR, const SalBi
     return true;
 }
 
-bool WinSalGraphicsImpl::drawAlphaBitmap(
+void WinSalGraphicsImpl::drawAlphaBitmap(
     const SalTwoRect& rTR,
     const SalBitmap& rSrcBitmap)
 {
     drawBitmap(rTR, rSrcBitmap);
-    return true;
 }
 
 bool WinSalGraphicsImpl::drawTransformedBitmap(
diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index f022afde41c5..9eb69fe55974 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -181,12 +181,8 @@ public:
 
         @param rSourceBitmap
         Source bitmap to blit
-
-        @return true, if the operation succeeded, and false
-        otherwise. In this case, clients should try to emulate alpha
-        compositing themselves
      */
-    virtual bool drawAlphaBitmap(
+    virtual void drawAlphaBitmap(
                 const SalTwoRect&,
                 const SalBitmap& rSourceBitmap ) override;
 
diff --git a/vcl/win/gdi/salgdi_gdiplus.cxx b/vcl/win/gdi/salgdi_gdiplus.cxx
index 48379f0e1c1a..17fa6264247e 100644
--- a/vcl/win/gdi/salgdi_gdiplus.cxx
+++ b/vcl/win/gdi/salgdi_gdiplus.cxx
@@ -67,11 +67,11 @@ bool WinSalGraphics::drawPolyLine(
         bPixelSnapHairline);
 }
 
-bool WinSalGraphics::drawAlphaBitmap(
+void WinSalGraphics::drawAlphaBitmap(
     const SalTwoRect& rTR,
     const SalBitmap& rSrcBitmap)
 {
-    return mpImpl->drawAlphaBitmap(rTR, rSrcBitmap);
+    mpImpl->drawAlphaBitmap(rTR, rSrcBitmap);
 }
 
 bool WinSalGraphics::drawTransformedBitmap(

Reply via email to