vcl/Library_vcl.mk                         |    1 
 vcl/inc/unx/GenPspGfxBackend.hxx           |  126 ++++++++
 vcl/inc/unx/genpspgraphics.h               |   14 
 vcl/unx/generic/print/GenPspGfxBackend.cxx |  412 +++++++++++++++++++++++++++++
 vcl/unx/generic/print/genpspgraphics.cxx   |  388 +++++++--------------------
 5 files changed, 654 insertions(+), 287 deletions(-)

New commits:
commit 40e007a7de0da660753b8ecfcb1ec90236d9532d
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Sat Apr 3 21:26:11 2021 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Mon Apr 5 07:44:07 2021 +0200

    vcl: move GenPspGraphics into a subclass of SalGraphicsImpl
    
    This is an effort to make SalGraphicsImpl mandatory for all
    backends. So we can rearange the interfaces of backends to a more
    logical structure, where we can have multiple graphic rendering
    backends for an VCL (windowing) backend (like we already do for
    Windows with GDI and skia backends).
    
    In this case we changed GenPspGraphics, introduced a new GFX
    backend "GenPspGfxBackend" - a subclass of SalGraphicsImpl, and
    moved the graphic functions into it.
    
    Change-Id: I148b460ff71c3e6b7548e9e2b933390151b6d82f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113593
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index c788fb164ce9..998eed0e0766 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -572,6 +572,7 @@ vcl_headless_freetype_code=\
     vcl/unx/generic/print/glyphset \
     vcl/unx/generic/print/printerjob \
     vcl/unx/generic/print/psputil \
+    vcl/unx/generic/print/GenPspGfxBackend \
     vcl/unx/generic/print/genpspgraphics \
     vcl/unx/generic/print/genprnpsp \
     vcl/unx/generic/print/prtsetup \
diff --git a/vcl/inc/unx/GenPspGfxBackend.hxx b/vcl/inc/unx/GenPspGfxBackend.hxx
new file mode 100644
index 000000000000..662bca8cc854
--- /dev/null
+++ b/vcl/inc/unx/GenPspGfxBackend.hxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <salgdiimpl.hxx>
+
+namespace psp
+{
+class PrinterGfx;
+}
+
+class VCL_DLLPUBLIC GenPspGfxBackend final : public SalGraphicsImpl
+{
+private:
+    psp::PrinterGfx* m_pPrinterGfx;
+
+public:
+    GenPspGfxBackend(psp::PrinterGfx* pPrinterGfx);
+    ~GenPspGfxBackend() override;
+
+    void Init() override;
+    void freeResources() override;
+    OUString getRenderBackendName() const override { return "genpsp"; }
+
+    bool setClipRegion(vcl::Region const& rRegion) override;
+    void ResetClipRegion() override;
+
+    sal_uInt16 GetBitCount() const override;
+
+    tools::Long GetGraphicsWidth() const override;
+
+    void SetLineColor() override;
+    void SetLineColor(Color nColor) override;
+    void SetFillColor() override;
+    void SetFillColor(Color nColor) override;
+    void SetXORMode(bool bSet, bool bInvertOnly) override;
+    void SetROPLineColor(SalROPColor nROPColor) override;
+    void SetROPFillColor(SalROPColor nROPColor) override;
+
+    void drawPixel(tools::Long nX, tools::Long nY) override;
+    void drawPixel(tools::Long nX, tools::Long nY, Color nColor) override;
+
+    void drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, 
tools::Long nY2) override;
+    void drawRect(tools::Long nX, tools::Long nY, tools::Long nWidth, 
tools::Long nHeight) override;
+    void drawPolyLine(sal_uInt32 nPoints, const Point* pPointArray) override;
+    void drawPolygon(sal_uInt32 nPoints, const Point* pPointArray) override;
+    void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints,
+                         const Point** pPointArray) override;
+
+    bool drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice,
+                         const basegfx::B2DPolyPolygon&, double fTransparency) 
override;
+
+    bool drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDevice, const 
basegfx::B2DPolygon&,
+                      double fTransparency, double fLineWidth, const 
std::vector<double>* pStroke,
+                      basegfx::B2DLineJoin, css::drawing::LineCap, double 
fMiterMinimumAngle,
+                      bool bPixelSnapHairline) override;
+
+    bool drawPolyLineBezier(sal_uInt32 nPoints, const Point* pPointArray,
+                            const PolyFlags* pFlagArray) override;
+
+    bool drawPolygonBezier(sal_uInt32 nPoints, const Point* pPointArray,
+                           const PolyFlags* pFlagArray) override;
+
+    bool drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32* pPoints,
+                               const Point* const* pPointArray,
+                               const PolyFlags* const* pFlagArray) override;
+
+    void copyArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, 
tools::Long nSrcY,
+                  tools::Long nSrcWidth, tools::Long nSrcHeight, bool 
bWindowInvalidate) override;
+
+    void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) 
override;
+
+    void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) 
override;
+
+    void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
+                    const SalBitmap& rMaskBitmap) override;
+
+    void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
+                  Color nMaskColor) override;
+
+    std::shared_ptr<SalBitmap> getBitmap(tools::Long nX, tools::Long nY, 
tools::Long nWidth,
+                                         tools::Long nHeight) override;
+
+    Color getPixel(tools::Long nX, tools::Long nY) override;
+
+    void invert(tools::Long nX, tools::Long nY, tools::Long nWidth, 
tools::Long nHeight,
+                SalInvert nFlags) override;
+
+    void invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert nFlags) 
override;
+
+    bool drawEPS(tools::Long nX, tools::Long nY, tools::Long nWidth, 
tools::Long nHeight,
+                 void* pPtr, sal_uInt32 nSize) override;
+
+    bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override;
+
+    bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap,
+                          const SalBitmap& rMaskBitmap, const SalBitmap& 
rAlphaBitmap) override;
+
+    bool drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap,
+                         const SalBitmap& rAlphaBitmap) override;
+
+    bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const 
basegfx::B2DPoint& rX,
+                               const basegfx::B2DPoint& rY, const SalBitmap& 
rSourceBitmap,
+                               const SalBitmap* pAlphaBitmap, double fAlpha) 
override;
+
+    bool hasFastDrawTransformedBitmap() const override;
+
+    bool drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWidth, 
tools::Long nHeight,
+                       sal_uInt8 nTransparency) override;
+
+    bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& 
rGradient) override;
+    bool implDrawGradient(basegfx::B2DPolyPolygon const& rPolyPolygon,
+                          SalGradient const& rGradient) override;
+
+    bool supportsOperation(OutDevSupportType eType) const override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h
index d3ff919a9778..6c6c60cdf762 100644
--- a/vcl/inc/unx/genpspgraphics.h
+++ b/vcl/inc/unx/genpspgraphics.h
@@ -27,6 +27,8 @@
 #include <salgdi.hxx>
 #include <sallayout.hxx>
 
+#include <unx/GenPspGfxBackend.hxx>
+
 class PhysicalFontFace;
 class PhysicalFontCollection;
 
@@ -39,6 +41,8 @@ class ImplFontMetricData;
 
 class VCL_DLLPUBLIC GenPspGraphics final : public SalGraphics
 {
+    std::unique_ptr<GenPspGfxBackend> m_pBackend;
+
     psp::JobData*           m_pJobData;
     psp::PrinterGfx*        m_pPrinterGfx;
 
@@ -65,7 +69,11 @@ public:
                                            const psp::FastPrintFontInfo& );
 
     // override all pure virtual methods
-    virtual SalGraphicsImpl*GetImpl() const override { return nullptr; };
+    virtual SalGraphicsImpl* GetImpl() const override
+    {
+        return m_pBackend.get();
+    }
+
     virtual void            GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY 
) override;
     virtual sal_uInt16      GetBitCount() const override;
     virtual tools::Long            GetGraphicsWidth() const override;
@@ -148,7 +156,6 @@ public:
                                                    const sal_uInt32* pPoints,
                                                    const Point* const* pPtAry,
                                                    const PolyFlags* const* 
pFlgAry ) override;
-    virtual bool            drawGradient( const tools::PolyPolygon&, const 
Gradient& ) override { return false; };
 
     virtual void            copyArea( tools::Long nDestX,
                                       tools::Long nDestY,
@@ -195,6 +202,9 @@ public:
     virtual bool            drawAlphaRect( tools::Long nX, tools::Long nY, 
tools::Long nWidth, tools::Long nHeight,
                                            sal_uInt8 nTransparency ) override;
 
+    virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const 
Gradient& rGradient) override;
+    virtual bool implDrawGradient(basegfx::B2DPolyPolygon const& rPolyPolygon, 
SalGradient const& rGradient) override;
+
     virtual SystemGraphicsData GetGraphicsData() const override;
 
     virtual OUString getRenderBackendName() const override { return "genpsp"; }
diff --git a/vcl/unx/generic/print/GenPspGfxBackend.cxx 
b/vcl/unx/generic/print/GenPspGfxBackend.cxx
new file mode 100644
index 000000000000..7b461ff4f5c6
--- /dev/null
+++ b/vcl/unx/generic/print/GenPspGfxBackend.cxx
@@ -0,0 +1,412 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <unx/GenPspGfxBackend.hxx>
+#include <unx/printergfx.hxx>
+#include <vcl/BitmapReadAccess.hxx>
+#include <salbmp.hxx>
+
+// ----- Implementation of PrinterBmp by means of SalBitmap/BitmapBuffer 
---------------
+
+namespace
+{
+class SalPrinterBmp : public psp::PrinterBmp
+{
+private:
+    BitmapBuffer* mpBmpBuffer;
+
+    FncGetPixel mpFncGetPixel;
+    Scanline mpScanAccess;
+    sal_PtrDiff mnScanOffset;
+
+public:
+    explicit SalPrinterBmp(BitmapBuffer* pBitmap);
+
+    virtual sal_uInt32 GetPaletteColor(sal_uInt32 nIdx) const override;
+    virtual sal_uInt32 GetPaletteEntryCount() const override;
+    virtual sal_uInt32 GetPixelRGB(sal_uInt32 nRow, sal_uInt32 nColumn) const 
override;
+    virtual sal_uInt8 GetPixelGray(sal_uInt32 nRow, sal_uInt32 nColumn) const 
override;
+    virtual sal_uInt8 GetPixelIdx(sal_uInt32 nRow, sal_uInt32 nColumn) const 
override;
+    virtual sal_uInt32 GetDepth() const override;
+};
+}
+
+SalPrinterBmp::SalPrinterBmp(BitmapBuffer* pBuffer)
+    : mpBmpBuffer(pBuffer)
+{
+    assert(mpBmpBuffer && "SalPrinterBmp::SalPrinterBmp () can't acquire 
Bitmap");
+
+    // calibrate scanline buffer
+    if (mpBmpBuffer->mnFormat & ScanlineFormat::TopDown)
+    {
+        mpScanAccess = mpBmpBuffer->mpBits;
+        mnScanOffset = mpBmpBuffer->mnScanlineSize;
+    }
+    else
+    {
+        mpScanAccess
+            = mpBmpBuffer->mpBits + (mpBmpBuffer->mnHeight - 1) * 
mpBmpBuffer->mnScanlineSize;
+        mnScanOffset = -mpBmpBuffer->mnScanlineSize;
+    }
+
+    // request read access to the pixels
+    mpFncGetPixel = BitmapReadAccess::GetPixelFunction(mpBmpBuffer->mnFormat);
+}
+
+sal_uInt32 SalPrinterBmp::GetDepth() const
+{
+    sal_uInt32 nDepth;
+
+    switch (mpBmpBuffer->mnBitCount)
+    {
+        case 1:
+            nDepth = 1;
+            break;
+
+        case 4:
+        case 8:
+            nDepth = 8;
+            break;
+
+        case 24:
+        case 32:
+            nDepth = 24;
+            break;
+
+        default:
+            nDepth = 1;
+            assert(false && "Error: unsupported bitmap depth in 
SalPrinterBmp::GetDepth()");
+            break;
+    }
+
+    return nDepth;
+}
+
+sal_uInt32 SalPrinterBmp::GetPaletteEntryCount() const
+{
+    return mpBmpBuffer->maPalette.GetEntryCount();
+}
+
+sal_uInt32 SalPrinterBmp::GetPaletteColor(sal_uInt32 nIdx) const
+{
+    BitmapColor aColor(mpBmpBuffer->maPalette[nIdx]);
+
+    return ((aColor.GetBlue()) & 0x000000ff) | ((aColor.GetGreen() << 8) & 
0x0000ff00)
+           | ((aColor.GetRed() << 16) & 0x00ff0000);
+}
+
+sal_uInt32 SalPrinterBmp::GetPixelRGB(sal_uInt32 nRow, sal_uInt32 nColumn) 
const
+{
+    Scanline pScan = mpScanAccess + nRow * mnScanOffset;
+    BitmapColor aColor = mpFncGetPixel(pScan, nColumn, 
mpBmpBuffer->maColorMask);
+
+    if (!!mpBmpBuffer->maPalette)
+        GetPaletteColor(aColor.GetIndex());
+
+    return ((aColor.GetBlue()) & 0x000000ff) | ((aColor.GetGreen() << 8) & 
0x0000ff00)
+           | ((aColor.GetRed() << 16) & 0x00ff0000);
+}
+
+sal_uInt8 SalPrinterBmp::GetPixelGray(sal_uInt32 nRow, sal_uInt32 nColumn) 
const
+{
+    Scanline pScan = mpScanAccess + nRow * mnScanOffset;
+    BitmapColor aColor = mpFncGetPixel(pScan, nColumn, 
mpBmpBuffer->maColorMask);
+
+    if (!!mpBmpBuffer->maPalette)
+        aColor = mpBmpBuffer->maPalette[aColor.GetIndex()];
+
+    return (aColor.GetBlue() * 28UL + aColor.GetGreen() * 151UL + 
aColor.GetRed() * 77UL) >> 8;
+}
+
+sal_uInt8 SalPrinterBmp::GetPixelIdx(sal_uInt32 nRow, sal_uInt32 nColumn) const
+{
+    Scanline pScan = mpScanAccess + nRow * mnScanOffset;
+    BitmapColor aColor = mpFncGetPixel(pScan, nColumn, 
mpBmpBuffer->maColorMask);
+
+    if (!!mpBmpBuffer->maPalette)
+        return aColor.GetIndex();
+    else
+        return 0;
+}
+
+GenPspGfxBackend::GenPspGfxBackend(psp::PrinterGfx* pPrinterGfx)
+    : m_pPrinterGfx(pPrinterGfx)
+{
+}
+
+GenPspGfxBackend::~GenPspGfxBackend() {}
+
+void GenPspGfxBackend::Init() {}
+void GenPspGfxBackend::freeResources() {}
+
+bool GenPspGfxBackend::setClipRegion(vcl::Region const& rRegion)
+{
+    // TODO: support polygonal clipregions here
+    RectangleVector aRectangles;
+    rRegion.GetRegionRectangles(aRectangles);
+    m_pPrinterGfx->BeginSetClipRegion();
+
+    for (auto const& rectangle : aRectangles)
+    {
+        const tools::Long nWidth(rectangle.GetWidth());
+        const tools::Long nHeight(rectangle.GetHeight());
+
+        if (nWidth && nHeight)
+        {
+            m_pPrinterGfx->UnionClipRegion(rectangle.Left(), rectangle.Top(), 
nWidth, nHeight);
+        }
+    }
+
+    m_pPrinterGfx->EndSetClipRegion();
+
+    return true;
+}
+
+void GenPspGfxBackend::ResetClipRegion() { m_pPrinterGfx->ResetClipRegion(); }
+
+sal_uInt16 GenPspGfxBackend::GetBitCount() const { return 
m_pPrinterGfx->GetBitCount(); }
+
+tools::Long GenPspGfxBackend::GetGraphicsWidth() const { return 0; }
+
+void GenPspGfxBackend::SetLineColor() { m_pPrinterGfx->SetLineColor(); }
+
+void GenPspGfxBackend::SetLineColor(Color nColor)
+{
+    psp::PrinterColor aColor(nColor.GetRed(), nColor.GetGreen(), 
nColor.GetBlue());
+    m_pPrinterGfx->SetLineColor(aColor);
+}
+
+void GenPspGfxBackend::SetFillColor() { m_pPrinterGfx->SetFillColor(); }
+
+void GenPspGfxBackend::SetFillColor(Color nColor)
+{
+    psp::PrinterColor aColor(nColor.GetRed(), nColor.GetGreen(), 
nColor.GetBlue());
+    m_pPrinterGfx->SetFillColor(aColor);
+}
+
+void GenPspGfxBackend::SetXORMode(bool bSet, bool /*bInvertOnly*/)
+{
+    SAL_WARN_IF(bSet, "vcl", "Error: PrinterGfx::SetXORMode() not 
implemented");
+}
+
+void GenPspGfxBackend::SetROPLineColor(SalROPColor /*nROPColor*/)
+{
+    SAL_WARN("vcl", "Error: PrinterGfx::SetROPLineColor() not implemented");
+}
+
+void GenPspGfxBackend::SetROPFillColor(SalROPColor /*nROPColor*/)
+{
+    SAL_WARN("vcl", "Error: PrinterGfx::SetROPFillColor() not implemented");
+}
+
+void GenPspGfxBackend::drawPixel(tools::Long nX, tools::Long nY)
+{
+    m_pPrinterGfx->DrawPixel(Point(nX, nY));
+}
+void GenPspGfxBackend::drawPixel(tools::Long nX, tools::Long nY, Color nColor)
+{
+    psp::PrinterColor aColor(nColor.GetRed(), nColor.GetGreen(), 
nColor.GetBlue());
+    m_pPrinterGfx->DrawPixel(Point(nX, nY), aColor);
+}
+
+void GenPspGfxBackend::drawLine(tools::Long nX1, tools::Long nY1, tools::Long 
nX2, tools::Long nY2)
+{
+    m_pPrinterGfx->DrawLine(Point(nX1, nY1), Point(nX2, nY2));
+}
+void GenPspGfxBackend::drawRect(tools::Long nX, tools::Long nY, tools::Long 
nWidth,
+                                tools::Long nHeight)
+{
+    m_pPrinterGfx->DrawRect(tools::Rectangle(Point(nX, nY), Size(nWidth, 
nHeight)));
+}
+
+void GenPspGfxBackend::drawPolyLine(sal_uInt32 nPoints, const Point* 
pPointArray)
+{
+    m_pPrinterGfx->DrawPolyLine(nPoints, pPointArray);
+}
+
+void GenPspGfxBackend::drawPolygon(sal_uInt32 nPoints, const Point* 
pPointArray)
+{
+    // Point must be equal to Point! see include/vcl/salgtype.hxx
+    m_pPrinterGfx->DrawPolygon(nPoints, pPointArray);
+}
+
+void GenPspGfxBackend::drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* 
pPoints,
+                                       const Point** pPointArray)
+{
+    m_pPrinterGfx->DrawPolyPolygon(nPoly, pPoints, pPointArray);
+}
+
+bool GenPspGfxBackend::drawPolyPolygon(const basegfx::B2DHomMatrix& 
/*rObjectToDevice*/,
+                                       const basegfx::B2DPolyPolygon&, double 
/*fTransparency*/)
+{
+    // TODO: implement and advertise OutDevSupportType::B2DDraw support
+    return false;
+}
+
+bool GenPspGfxBackend::drawPolyLine(const basegfx::B2DHomMatrix& 
/*rObjectToDevice*/,
+                                    const basegfx::B2DPolygon& /*rPolygon*/,
+                                    double /*fTransparency*/, double 
/*fLineWidth*/,
+                                    const std::vector<double>* /*pStroke*/, 
basegfx::B2DLineJoin,
+                                    css::drawing::LineCap, double 
/*fMiterMinimumAngle*/,
+                                    bool /*bPixelSnapHairline*/)
+{
+    // TODO: a PS printer can draw B2DPolyLines almost directly
+    return false;
+}
+
+bool GenPspGfxBackend::drawPolyLineBezier(sal_uInt32 nPoints, const Point* 
pPointArray,
+                                          const PolyFlags* pFlagArray)
+{
+    m_pPrinterGfx->DrawPolyLineBezier(nPoints, pPointArray, pFlagArray);
+    return true;
+}
+
+bool GenPspGfxBackend::drawPolygonBezier(sal_uInt32 nPoints, const Point* 
pPointArray,
+                                         const PolyFlags* pFlagArray)
+{
+    m_pPrinterGfx->DrawPolygonBezier(nPoints, pPointArray, pFlagArray);
+    return true;
+}
+
+bool GenPspGfxBackend::drawPolyPolygonBezier(sal_uInt32 nPoly, const 
sal_uInt32* pPoints,
+                                             const Point* const* pPointArray,
+                                             const PolyFlags* const* 
pFlagArray)
+{
+    // Point must be equal to Point! see include/vcl/salgtype.hxx
+    m_pPrinterGfx->DrawPolyPolygonBezier(nPoly, pPoints, pPointArray, 
pFlagArray);
+    return true;
+}
+
+void GenPspGfxBackend::copyArea(tools::Long /*nDestX*/, tools::Long /*nDestY*/,
+                                tools::Long /*nSrcX*/, tools::Long /*nSrcY*/,
+                                tools::Long /*nSrcWidth*/, tools::Long 
/*nSrcHeight*/,
+                                bool /*bWindowInvalidate*/)
+{
+    OSL_FAIL("Error: PrinterGfx::CopyArea() not implemented");
+}
+
+void GenPspGfxBackend::copyBits(const SalTwoRect& /*rPosAry*/, SalGraphics* 
/*pSrcGraphics*/)
+{
+    OSL_FAIL("Error: PrinterGfx::CopyBits() not implemented");
+}
+
+void GenPspGfxBackend::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& 
rSalBitmap)
+{
+    tools::Rectangle aSrc(Point(rPosAry.mnSrcX, rPosAry.mnSrcY),
+                          Size(rPosAry.mnSrcWidth, rPosAry.mnSrcHeight));
+
+    tools::Rectangle aDst(Point(rPosAry.mnDestX, rPosAry.mnDestY),
+                          Size(rPosAry.mnDestWidth, rPosAry.mnDestHeight));
+
+    BitmapBuffer* pBuffer
+        = 
const_cast<SalBitmap&>(rSalBitmap).AcquireBuffer(BitmapAccessMode::Read);
+
+    SalPrinterBmp aBmp(pBuffer);
+    m_pPrinterGfx->DrawBitmap(aDst, aSrc, aBmp);
+
+    const_cast<SalBitmap&>(rSalBitmap).ReleaseBuffer(pBuffer, 
BitmapAccessMode::Read);
+}
+
+void GenPspGfxBackend::drawBitmap(const SalTwoRect& /*rPosAry*/, const 
SalBitmap& /*rSalBitmap*/,
+                                  const SalBitmap& /*rMaskBitmap*/)
+{
+    OSL_FAIL("Error: no PrinterGfx::DrawBitmap() for transparent bitmap");
+}
+
+void GenPspGfxBackend::drawMask(const SalTwoRect& /*rPosAry*/, const 
SalBitmap& /*rSalBitmap*/,
+                                Color /*nMaskColor*/)
+{
+    OSL_FAIL("Error: PrinterGfx::DrawMask() not implemented");
+}
+
+std::shared_ptr<SalBitmap> GenPspGfxBackend::getBitmap(tools::Long /*nX*/, 
tools::Long /*nY*/,
+                                                       tools::Long /*nWidth*/,
+                                                       tools::Long /*nHeight*/)
+{
+    SAL_INFO("vcl", "Warning: PrinterGfx::GetBitmap() not implemented");
+    return nullptr;
+}
+
+Color GenPspGfxBackend::getPixel(tools::Long /*nX*/, tools::Long /*nY*/)
+{
+    OSL_FAIL("Warning: PrinterGfx::GetPixel() not implemented");
+    return Color();
+}
+
+void GenPspGfxBackend::invert(tools::Long /*nX*/, tools::Long /*nY*/, 
tools::Long /*nWidth*/,
+                              tools::Long /*nHeight*/, SalInvert /*nFlags*/)
+{
+    OSL_FAIL("Warning: PrinterGfx::Invert() not implemented");
+}
+
+void GenPspGfxBackend::invert(sal_uInt32 /*nPoints*/, const Point* /*pPtAry*/, 
SalInvert /*nFlags*/)
+{
+    SAL_WARN("vcl", "Error: PrinterGfx::Invert() not implemented");
+}
+
+bool GenPspGfxBackend::drawEPS(tools::Long nX, tools::Long nY, tools::Long 
nWidth,
+                               tools::Long nHeight, void* pPtr, sal_uInt32 
nSize)
+{
+    return m_pPrinterGfx->DrawEPS(tools::Rectangle(Point(nX, nY), Size(nWidth, 
nHeight)), pPtr,
+                                  nSize);
+}
+
+bool GenPspGfxBackend::blendBitmap(const SalTwoRect& /*rPosAry*/, const 
SalBitmap& /*rBitmap*/)
+{
+    return false;
+}
+
+bool GenPspGfxBackend::blendAlphaBitmap(const SalTwoRect& /*rPosAry*/,
+                                        const SalBitmap& /*rSrcBitmap*/,
+                                        const SalBitmap& /*rMaskBitmap*/,
+                                        const SalBitmap& /*rAlphaBitmap*/)
+{
+    return false;
+}
+
+bool GenPspGfxBackend::drawAlphaBitmap(const SalTwoRect& /*rPosAry*/,
+                                       const SalBitmap& /*rSourceBitmap*/,
+                                       const SalBitmap& /*rAlphaBitmap*/)
+{
+    return false;
+}
+
+bool GenPspGfxBackend::drawTransformedBitmap(const basegfx::B2DPoint& 
/*rNull*/,
+                                             const basegfx::B2DPoint& /*rX*/,
+                                             const basegfx::B2DPoint& /*rY*/,
+                                             const SalBitmap& 
/*rSourceBitmap*/,
+                                             const SalBitmap* 
/*pAlphaBitmap*/, double /*fAlpha*/)
+{
+    return false;
+}
+
+bool GenPspGfxBackend::hasFastDrawTransformedBitmap() const { return false; }
+
+bool GenPspGfxBackend::drawAlphaRect(tools::Long /*nX*/, tools::Long /*nY*/, 
tools::Long /*nWidth*/,
+                                     tools::Long /*nHeight*/, sal_uInt8 
/*nTransparency*/)
+{
+    return false;
+}
+
+bool GenPspGfxBackend::drawGradient(const tools::PolyPolygon& /*rPolygon*/,
+                                    const Gradient& /*rGradient*/)
+{
+    return false;
+}
+
+bool GenPspGfxBackend::implDrawGradient(basegfx::B2DPolyPolygon const& 
/*rPolyPolygon*/,
+                                        SalGradient const& /*rGradient*/)
+{
+    return false;
+}
+
+bool GenPspGfxBackend::supportsOperation(OutDevSupportType /*eType*/) const { 
return false; }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx 
b/vcl/unx/generic/print/genpspgraphics.cxx
index da5092da4809..0d255e2ec79d 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -30,7 +30,6 @@
 #include <sys/stat.h>
 
 #include <i18nlangtag/mslangid.hxx>
-#include <vcl/BitmapReadAccess.hxx>
 #include <jobdata.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
@@ -49,157 +48,23 @@
 #include <impfontmetricdata.hxx>
 #include <PhysicalFontCollection.hxx>
 #include <PhysicalFontFace.hxx>
-#include <salbmp.hxx>
 #include <sallayout.hxx>
 
 using namespace psp;
 
-// ----- Implementation of PrinterBmp by means of SalBitmap/BitmapBuffer 
---------------
-
-namespace {
-
-class SalPrinterBmp : public psp::PrinterBmp
-{
-private:
-    BitmapBuffer*       mpBmpBuffer;
-
-    FncGetPixel         mpFncGetPixel;
-    Scanline            mpScanAccess;
-    sal_PtrDiff         mnScanOffset;
-
-public:
-    explicit            SalPrinterBmp (BitmapBuffer* pBitmap);
-
-    virtual sal_uInt32  GetPaletteColor (sal_uInt32 nIdx) const override;
-    virtual sal_uInt32  GetPaletteEntryCount () const override;
-    virtual sal_uInt32  GetPixelRGB  (sal_uInt32 nRow, sal_uInt32 nColumn) 
const override;
-    virtual sal_uInt8   GetPixelGray (sal_uInt32 nRow, sal_uInt32 nColumn) 
const override;
-    virtual sal_uInt8   GetPixelIdx  (sal_uInt32 nRow, sal_uInt32 nColumn) 
const override;
-    virtual sal_uInt32  GetDepth () const override;
-};
-
-}
-
-SalPrinterBmp::SalPrinterBmp (BitmapBuffer* pBuffer)
-    : mpBmpBuffer(pBuffer)
-{
-    assert(mpBmpBuffer && "SalPrinterBmp::SalPrinterBmp () can't acquire 
Bitmap");
-
-    // calibrate scanline buffer
-    if( mpBmpBuffer->mnFormat & ScanlineFormat::TopDown )
-    {
-        mpScanAccess = mpBmpBuffer->mpBits;
-        mnScanOffset = mpBmpBuffer->mnScanlineSize;
-    }
-    else
-    {
-        mpScanAccess = mpBmpBuffer->mpBits
-                       + (mpBmpBuffer->mnHeight - 1) * 
mpBmpBuffer->mnScanlineSize;
-        mnScanOffset = - mpBmpBuffer->mnScanlineSize;
-    }
-
-    // request read access to the pixels
-    mpFncGetPixel = BitmapReadAccess::GetPixelFunction( mpBmpBuffer->mnFormat 
);
-}
-
-sal_uInt32
-SalPrinterBmp::GetDepth () const
-{
-    sal_uInt32 nDepth;
-
-    switch (mpBmpBuffer->mnBitCount)
-    {
-        case 1:
-            nDepth = 1;
-            break;
-
-        case 4:
-        case 8:
-            nDepth = 8;
-            break;
-
-        case 24:
-        case 32:
-            nDepth = 24;
-            break;
-
-        default:
-            nDepth = 1;
-            assert(false && "Error: unsupported bitmap depth in 
SalPrinterBmp::GetDepth()");
-            break;
-    }
-
-    return nDepth;
-}
-
-sal_uInt32
-SalPrinterBmp::GetPaletteEntryCount () const
-{
-    return mpBmpBuffer->maPalette.GetEntryCount ();
-}
-
-sal_uInt32
-SalPrinterBmp::GetPaletteColor(sal_uInt32 nIdx) const
-{
-    BitmapColor aColor(mpBmpBuffer->maPalette[nIdx]);
-
-    return ((aColor.GetBlue())        & 0x000000ff)
-         | ((aColor.GetGreen() <<  8) & 0x0000ff00)
-         | ((aColor.GetRed()   << 16) & 0x00ff0000);
-}
-
-sal_uInt32
-SalPrinterBmp::GetPixelRGB (sal_uInt32 nRow, sal_uInt32 nColumn) const
-{
-    Scanline pScan = mpScanAccess + nRow * mnScanOffset;
-    BitmapColor aColor = mpFncGetPixel (pScan, nColumn, 
mpBmpBuffer->maColorMask);
-
-    if (!!mpBmpBuffer->maPalette)
-        GetPaletteColor(aColor.GetIndex());
-
-    return ((aColor.GetBlue())        & 0x000000ff)
-         | ((aColor.GetGreen() <<  8) & 0x0000ff00)
-         | ((aColor.GetRed()   << 16) & 0x00ff0000);
-}
-
-sal_uInt8
-SalPrinterBmp::GetPixelGray (sal_uInt32 nRow, sal_uInt32 nColumn) const
-{
-    Scanline pScan = mpScanAccess + nRow * mnScanOffset;
-    BitmapColor aColor = mpFncGetPixel (pScan, nColumn, 
mpBmpBuffer->maColorMask);
-
-    if (!!mpBmpBuffer->maPalette)
-        aColor = mpBmpBuffer->maPalette[aColor.GetIndex()];
-
-    return (  aColor.GetBlue()  *  28UL
-            + aColor.GetGreen() * 151UL
-            + aColor.GetRed()   *  77UL ) >> 8;
-
-}
-
-sal_uInt8
-SalPrinterBmp::GetPixelIdx (sal_uInt32 nRow, sal_uInt32 nColumn) const
-{
-    Scanline pScan = mpScanAccess + nRow * mnScanOffset;
-    BitmapColor aColor = mpFncGetPixel (pScan, nColumn, 
mpBmpBuffer->maColorMask);
-
-    if (!!mpBmpBuffer->maPalette)
-        return aColor.GetIndex();
-    else
-        return 0;
-}
-
 /*******************************************************
- * GenPspGraphics                                         *
+ * GenPspGraphics
  *******************************************************/
+
 GenPspGraphics::GenPspGraphics()
-    : m_pJobData( nullptr ),
-      m_pPrinterGfx( nullptr )
+    : m_pJobData( nullptr )
+    , m_pPrinterGfx( nullptr )
 {
 }
 
 void GenPspGraphics::Init(psp::JobData* pJob, psp::PrinterGfx* pGfx)
 {
+    m_pBackend = std::make_unique<GenPspGfxBackend>(pGfx);
     m_pJobData = pJob;
     m_pPrinterGfx = pGfx;
     SetLayout( SalLayoutFlags::NONE );
@@ -223,166 +88,126 @@ void GenPspGraphics::GetResolution( sal_Int32 &rDPIX, 
sal_Int32 &rDPIY )
 
 sal_uInt16 GenPspGraphics::GetBitCount() const
 {
-    return m_pPrinterGfx->GetBitCount();
+    return m_pBackend->GetBitCount();
 }
 
 tools::Long GenPspGraphics::GetGraphicsWidth() const
 {
-    return 0;
+    return m_pBackend->GetGraphicsWidth();
 }
 
 void GenPspGraphics::ResetClipRegion()
 {
-    m_pPrinterGfx->ResetClipRegion();
+    m_pBackend->ResetClipRegion();
 }
 
 bool GenPspGraphics::setClipRegion( const vcl::Region& i_rClip )
 {
-    // TODO: support polygonal clipregions here
-    RectangleVector aRectangles;
-    i_rClip.GetRegionRectangles(aRectangles);
-    m_pPrinterGfx->BeginSetClipRegion();
-
-    for (auto const& rectangle : aRectangles)
-    {
-        const tools::Long nW(rectangle.GetWidth());
-
-        if(nW)
-        {
-            const tools::Long nH(rectangle.GetHeight());
-
-            if(nH)
-            {
-                m_pPrinterGfx->UnionClipRegion(
-                    rectangle.Left(),
-                    rectangle.Top(),
-                    nW,
-                    nH);
-            }
-        }
-    }
-
-    m_pPrinterGfx->EndSetClipRegion();
-
-    return true;
+    return m_pBackend->setClipRegion(i_rClip);
 }
 
 void GenPspGraphics::SetLineColor()
 {
-    m_pPrinterGfx->SetLineColor ();
+    m_pBackend->SetLineColor();
 }
 
 void GenPspGraphics::SetLineColor( Color nColor )
 {
-    psp::PrinterColor aColor (nColor.GetRed(),
-                              nColor.GetGreen(),
-                              nColor.GetBlue());
-    m_pPrinterGfx->SetLineColor (aColor);
+    m_pBackend->SetLineColor(nColor);
 }
 
 void GenPspGraphics::SetFillColor()
 {
-    m_pPrinterGfx->SetFillColor ();
+    m_pBackend->SetFillColor();
 }
 
 void GenPspGraphics::SetFillColor( Color nColor )
 {
-    psp::PrinterColor aColor (nColor.GetRed(),
-                              nColor.GetGreen(),
-                              nColor.GetBlue());
-    m_pPrinterGfx->SetFillColor (aColor);
+    m_pBackend->SetFillColor (nColor);
 }
 
-void GenPspGraphics::SetROPLineColor( SalROPColor )
+void GenPspGraphics::SetROPLineColor(SalROPColor aColor)
 {
-    SAL_WARN( "vcl", "Error: PrinterGfx::SetROPLineColor() not implemented" );
+    m_pBackend->SetROPLineColor(aColor);
 }
 
-void GenPspGraphics::SetROPFillColor( SalROPColor )
+void GenPspGraphics::SetROPFillColor( SalROPColor aColor)
 {
-    SAL_WARN( "vcl", "Error: PrinterGfx::SetROPFillColor() not implemented" );
+    m_pBackend->SetROPFillColor(aColor);
 }
 
-void GenPspGraphics::SetXORMode( bool bSet, bool )
+void GenPspGraphics::SetXORMode(bool bSet, bool bInvertOnly)
 {
-    SAL_WARN_IF( bSet, "vcl", "Error: PrinterGfx::SetXORMode() not 
implemented" );
+    m_pBackend->SetXORMode(bSet, bInvertOnly);
 }
 
 void GenPspGraphics::drawPixel( tools::Long nX, tools::Long nY )
 {
-    m_pPrinterGfx->DrawPixel (Point(nX, nY));
+    m_pBackend->drawPixel(nX, nY);
 }
 
 void GenPspGraphics::drawPixel( tools::Long nX, tools::Long nY, Color nColor )
 {
-    psp::PrinterColor aColor (nColor.GetRed(),
-                              nColor.GetGreen(),
-                              nColor.GetBlue());
-    m_pPrinterGfx->DrawPixel (Point(nX, nY), aColor);
+    m_pBackend->drawPixel(nX, nY, nColor);
 }
 
 void GenPspGraphics::drawLine( tools::Long nX1, tools::Long nY1, tools::Long 
nX2, tools::Long nY2 )
 {
-    m_pPrinterGfx->DrawLine (Point(nX1, nY1), Point(nX2, nY2));
+    m_pBackend->drawLine(nX1, nY1, nX2, nY2);
 }
 
 void GenPspGraphics::drawRect( tools::Long nX, tools::Long nY, tools::Long 
nDX, tools::Long nDY )
 {
-    m_pPrinterGfx->DrawRect (tools::Rectangle(Point(nX, nY), Size(nDX, nDY)));
+    m_pBackend->drawRect(nX, nY, nDX, nDY);
 }
 
 void GenPspGraphics::drawPolyLine( sal_uInt32 nPoints, const Point *pPtAry )
 {
-    m_pPrinterGfx->DrawPolyLine (nPoints, pPtAry);
+    m_pBackend->drawPolyLine(nPoints, pPtAry);
 }
 
 void GenPspGraphics::drawPolygon( sal_uInt32 nPoints, const Point* pPtAry )
 {
-    // Point must be equal to Point! see include/vcl/salgtype.hxx
-    m_pPrinterGfx->DrawPolygon (nPoints, pPtAry);
+    m_pBackend->drawPolygon(nPoints, pPtAry);
 }
 
 void GenPspGraphics::drawPolyPolygon( sal_uInt32           nPoly,
                                    const sal_uInt32   *pPoints,
                                    const Point*  *pPtAry )
 {
-    m_pPrinterGfx->DrawPolyPolygon (nPoly, pPoints, pPtAry);
+    m_pBackend->drawPolyPolygon (nPoly, pPoints, pPtAry);
 }
 
 bool GenPspGraphics::drawPolyPolygon(
-    const basegfx::B2DHomMatrix& /*rObjectToDevice*/,
-    const basegfx::B2DPolyPolygon&,
-    double /*fTransparency*/)
+    const basegfx::B2DHomMatrix& rObjectToDevice,
+    const basegfx::B2DPolyPolygon& rPolyPolygon,
+    double fTransparency)
 {
-        // TODO: implement and advertise OutDevSupportType::B2DDraw support
-        return false;
+    return m_pBackend->drawPolyPolygon(rObjectToDevice, rPolyPolygon, 
fTransparency);
 }
 
 bool GenPspGraphics::drawPolyLine(
-    const basegfx::B2DHomMatrix& /* rObjectToDevice */,
-    const basegfx::B2DPolygon&,
-    double /*fTransparency*/,
-    double /*fLineWidth*/,
-    const std::vector< double >* /*pStroke*/, // MM01
-    basegfx::B2DLineJoin /*eJoin*/,
-    css::drawing::LineCap /*eLineCap*/,
-    double /*fMiterMinimumAngle*/,
-    bool /* bPixelSnapHairline */)
-{
-    // TODO: a PS printer can draw B2DPolyLines almost directly
-    return false;
+    const basegfx::B2DHomMatrix& rObjectToDevice,
+    const basegfx::B2DPolygon& rPolygon,
+    double fTransparency,
+    double fLineWidth,
+    const std::vector< double >* pStroke, // MM01
+    basegfx::B2DLineJoin eJoin,
+    css::drawing::LineCap eLineCap,
+    double fMiterMinimumAngle,
+    bool bPixelSnapHairline)
+{
+    return m_pBackend->drawPolyLine(rObjectToDevice, rPolygon, fTransparency, 
fLineWidth, pStroke, eJoin, eLineCap, fMiterMinimumAngle, bPixelSnapHairline);
 }
 
 bool GenPspGraphics::drawPolyLineBezier( sal_uInt32 nPoints, const Point* 
pPtAry, const PolyFlags* pFlgAry )
 {
-    m_pPrinterGfx->DrawPolyLineBezier (nPoints, pPtAry, pFlgAry);
-    return true;
+    return m_pBackend->drawPolyLineBezier(nPoints, pPtAry, pFlgAry);
 }
 
 bool GenPspGraphics::drawPolygonBezier( sal_uInt32 nPoints, const Point* 
pPtAry, const PolyFlags* pFlgAry )
 {
-    m_pPrinterGfx->DrawPolygonBezier (nPoints, pPtAry, pFlgAry);
-    return true;
+    return m_pBackend->drawPolygonBezier(nPoints, pPtAry, pFlgAry);
 }
 
 bool GenPspGraphics::drawPolyPolygonBezier( sal_uInt32 nPoly,
@@ -390,78 +215,62 @@ bool GenPspGraphics::drawPolyPolygonBezier( sal_uInt32 
nPoly,
                                              const Point* const* pPtAry,
                                              const PolyFlags* const* pFlgAry )
 {
-    // Point must be equal to Point! see include/vcl/salgtype.hxx
-    m_pPrinterGfx->DrawPolyPolygonBezier (nPoly, pPoints, pPtAry, pFlgAry);
-    return true;
+    return m_pBackend->drawPolyPolygonBezier(nPoly, pPoints, pPtAry, pFlgAry);
 }
 
-void GenPspGraphics::invert( sal_uInt32,
-                          const Point*,
-                          SalInvert )
+void GenPspGraphics::invert(tools::Long nX, tools::Long nY, tools::Long 
nWidth, tools::Long nHeight,
+                                    SalInvert nFlags)
 {
-    SAL_WARN( "vcl", "Error: PrinterGfx::Invert() not implemented" );
+   m_pBackend->invert(nX, nY, nWidth, nHeight, nFlags);
 }
 
-bool GenPspGraphics::drawEPS( tools::Long nX, tools::Long nY, tools::Long 
nWidth, tools::Long nHeight, void* pPtr, sal_uInt32 nSize )
+void GenPspGraphics::invert(sal_uInt32 nPoints, const Point* pPtAry, SalInvert 
nFlags)
 {
-    return m_pPrinterGfx->DrawEPS( tools::Rectangle( Point( nX, nY ), Size( 
nWidth, nHeight ) ), pPtr, nSize );
+   m_pBackend->invert(nPoints, pPtAry, nFlags);
 }
 
-void GenPspGraphics::copyBits( const SalTwoRect&,
-                            SalGraphics* )
+bool GenPspGraphics::drawEPS(tools::Long nX, tools::Long nY, tools::Long 
nWidth,
+                               tools::Long nHeight, void* pPtr, sal_uInt32 
nSize)
 {
-    OSL_FAIL( "Error: PrinterGfx::CopyBits() not implemented" );
+    return m_pBackend->drawEPS(nX, nY, nWidth, nHeight, pPtr, nSize);
 }
 
-void GenPspGraphics::copyArea ( 
tools::Long,tools::Long,tools::Long,tools::Long,tools::Long,tools::Long,bool )
+void GenPspGraphics::copyBits(const SalTwoRect& rPosAry, SalGraphics* 
pSrcGraphics)
 {
-    OSL_FAIL( "Error: PrinterGfx::CopyArea() not implemented" );
+    m_pBackend->copyBits(rPosAry, pSrcGraphics);
 }
 
-void GenPspGraphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& 
rSalBitmap )
+void GenPspGraphics::copyArea (tools::Long nDestX, tools::Long nDestY, 
tools::Long nSrcX,
+                                tools::Long nSrcY, tools::Long nSrcWidth, 
tools::Long nSrcHeight,
+                                bool bWindowInvalidate)
 {
-    tools::Rectangle aSrc (Point(rPosAry.mnSrcX, rPosAry.mnSrcY),
-                    Size(rPosAry.mnSrcWidth, rPosAry.mnSrcHeight));
-    tools::Rectangle aDst (Point(rPosAry.mnDestX, rPosAry.mnDestY),
-                    Size(rPosAry.mnDestWidth, rPosAry.mnDestHeight));
-
-    BitmapBuffer* pBuffer= 
const_cast<SalBitmap&>(rSalBitmap).AcquireBuffer(BitmapAccessMode::Read);
-
-    SalPrinterBmp aBmp (pBuffer);
-    m_pPrinterGfx->DrawBitmap (aDst, aSrc, aBmp);
-
-    const_cast<SalBitmap&>(rSalBitmap).ReleaseBuffer (pBuffer, 
BitmapAccessMode::Read);
+    m_pBackend->copyArea(nDestX, nDestY, nSrcX, nSrcY, nSrcWidth, nSrcHeight, 
bWindowInvalidate);
 }
 
-void GenPspGraphics::drawBitmap( const SalTwoRect&,
-                              const SalBitmap&,
-                              const SalBitmap& )
+void GenPspGraphics::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& 
rSalBitmap)
 {
-    OSL_FAIL("Error: no PrinterGfx::DrawBitmap() for transparent bitmap");
+    m_pBackend->drawBitmap(rPosAry, rSalBitmap);
 }
 
-void GenPspGraphics::drawMask( const SalTwoRect&,
-                            const SalBitmap &,
-                            Color )
+void GenPspGraphics::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& 
rSalBitmap, const SalBitmap& rMaskBitmap)
 {
-    OSL_FAIL("Error: PrinterGfx::DrawMask() not implemented");
+
+    m_pBackend->drawBitmap(rPosAry, rSalBitmap, rMaskBitmap);
 }
 
-std::shared_ptr<SalBitmap> GenPspGraphics::getBitmap( tools::Long, 
tools::Long, tools::Long, tools::Long )
+void GenPspGraphics::drawMask(const SalTwoRect& rPosAry, const SalBitmap& 
rSalBitmap, Color nMaskColor)
 {
-    SAL_INFO("vcl", "Warning: PrinterGfx::GetBitmap() not implemented");
-    return nullptr;
+    m_pBackend->drawMask(rPosAry, rSalBitmap, nMaskColor);
 }
 
-Color GenPspGraphics::getPixel( tools::Long, tools::Long )
+std::shared_ptr<SalBitmap> GenPspGraphics::getBitmap(tools::Long nX, 
tools::Long nY, tools::Long nWidth, tools::Long nHeight)
 {
-    OSL_FAIL("Warning: PrinterGfx::GetPixel() not implemented");
-    return 0;
+    return m_pBackend->getBitmap(nX, nY, nWidth, nHeight);
 }
 
-void 
GenPspGraphics::invert(tools::Long,tools::Long,tools::Long,tools::Long,SalInvert)
+Color GenPspGraphics::getPixel(tools::Long nX, tools::Long nY)
 {
-    OSL_FAIL("Warning: PrinterGfx::Invert() not implemented");
+    return m_pBackend->getPixel(nX, nY);
 }
 
 namespace {
@@ -812,43 +621,57 @@ void GenPspGraphics::AnnounceFonts( 
PhysicalFontCollection* pFontCollection, con
     pFontCollection->Add( pFD.get() );
 }
 
-bool GenPspGraphics::blendBitmap( const SalTwoRect&, const SalBitmap& )
+bool GenPspGraphics::blendBitmap(const SalTwoRect& rPosAry, const SalBitmap& 
rBitmap)
 {
-    return false;
+    return m_pBackend->blendBitmap(rPosAry, rBitmap);
 }
 
-bool GenPspGraphics::blendAlphaBitmap( const SalTwoRect&, const SalBitmap&, 
const SalBitmap&, const SalBitmap& )
+bool GenPspGraphics::blendAlphaBitmap(const SalTwoRect& rPosAry, const 
SalBitmap& rSourceBitmap,
+                                      const SalBitmap& rMaskBitmap, const 
SalBitmap& rAlphaBitmap)
 {
-    return false;
+    return m_pBackend->blendAlphaBitmap(rPosAry, rSourceBitmap, rMaskBitmap, 
rAlphaBitmap);
 }
 
-bool GenPspGraphics::drawAlphaBitmap( const SalTwoRect&,
-                                   const SalBitmap&,
-                                   const SalBitmap& )
+bool GenPspGraphics::drawAlphaBitmap(const SalTwoRect& rPosAry, const 
SalBitmap& rSourceBitmap,
+                                     const SalBitmap& rAlphaBitmap)
 {
-    return false;
+    return m_pBackend->drawAlphaBitmap(rPosAry, rSourceBitmap, rAlphaBitmap);
 }
 
-bool GenPspGraphics::drawTransformedBitmap(
-    const basegfx::B2DPoint&,
-    const basegfx::B2DPoint&,
-    const basegfx::B2DPoint&,
-    const SalBitmap&,
-    const SalBitmap*,
-    double)
+bool GenPspGraphics::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
+                                             const basegfx::B2DPoint& rX,
+                                             const basegfx::B2DPoint& rY,
+                                             const SalBitmap& rSourceBitmap,
+                                             const SalBitmap* pAlphaBitmap, 
double fAlpha)
 {
-    // here direct support for transformed bitmaps can be implemented
-    return false;
+    return m_pBackend->drawTransformedBitmap(rNull, rX, rY, rSourceBitmap, 
pAlphaBitmap, fAlpha);
 }
 
 bool GenPspGraphics::hasFastDrawTransformedBitmap() const
 {
-    return false;
+    return m_pBackend->hasFastDrawTransformedBitmap();
 }
 
-bool GenPspGraphics::drawAlphaRect( tools::Long, tools::Long, tools::Long, 
tools::Long, sal_uInt8 )
+bool GenPspGraphics::drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long 
nWidth,
+                                   tools::Long nHeight, sal_uInt8 
nTransparency)
 {
-    return false;
+    return m_pBackend->drawAlphaRect(nX, nY, nWidth, nHeight, nTransparency);
+}
+
+bool GenPspGraphics::drawGradient(const tools::PolyPolygon& rPolygon, const 
Gradient& rGradient)
+{
+    return m_pBackend->drawGradient(rPolygon, rGradient);
+}
+
+bool GenPspGraphics::implDrawGradient(basegfx::B2DPolyPolygon const& 
rPolyPolygon,
+                                        SalGradient const& rGradient)
+{
+    return m_pBackend->implDrawGradient(rPolyPolygon, rGradient);
+}
+
+bool GenPspGraphics::supportsOperation(OutDevSupportType eType) const
+{
+    return m_pBackend->supportsOperation(eType);
 }
 
 SystemGraphicsData GenPspGraphics::GetGraphicsData() const
@@ -885,11 +708,6 @@ css::uno::Any 
GenPspGraphics::GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& /*
 
 #endif // ENABLE_CAIRO_CANVAS
 
-bool GenPspGraphics::supportsOperation( OutDevSupportType ) const
-{
-    return false;
-}
-
 void GenPspGraphics::DoFreeEmbedFontData( const void* pData, tools::Long nLen )
 {
     if( pData )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to