remove support for BITMASK in vcl backends

Rather use a proper alpha channel if we need transparency.

This is another small step towards merged alpha in our vcl
layer.

I suspect the intent in a lot of this code was to save memory.
Which have been a thing way back then, but these days our
backends mostly end up doing a copy-and-convert to a real
alpha channel anyway, so the existing code is actually
now a pessimisation.

Change-Id: I4a2bcbb2f76b841f05bc00580f364492829c69de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114808
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/canvas/source/vcl/backbuffer.cxx b/canvas/source/vcl/backbuffer.cxx
index c2779cd..684a02c 100644
--- a/canvas/source/vcl/backbuffer.cxx
+++ b/canvas/source/vcl/backbuffer.cxx
@@ -27,14 +27,9 @@

namespace vclcanvas
{
    BackBuffer::BackBuffer( const OutputDevice& rRefDevice,
                            bool                bMonochromeBuffer ) :
        maVDev( VclPtr<VirtualDevice>::Create( rRefDevice,
                                   bMonochromeBuffer ? DeviceFormat::BITMASK : DeviceFormat::DEFAULT ) )
    BackBuffer::BackBuffer( const OutputDevice& rRefDevice ) :
        maVDev( VclPtr<VirtualDevice>::Create( rRefDevice, DeviceFormat::DEFAULT ) )
    {
        if( bMonochromeBuffer )
            return;

        tools::SetDefaultDeviceAntiAliasing( maVDev );
    }

diff --git a/canvas/source/vcl/backbuffer.hxx b/canvas/source/vcl/backbuffer.hxx
index 6bbeb85..0e31111 100644
--- a/canvas/source/vcl/backbuffer.hxx
+++ b/canvas/source/vcl/backbuffer.hxx
@@ -31,15 +31,8 @@ namespace vclcanvas
    class BackBuffer : public OutDevProvider
    {
    public:
        /** Create a backbuffer for given reference device

            @param bMonochromeBuffer
            When false, default depth of reference device is
            chosen. When true, the buffer will be monochrome, i.e. one
            bit deep.
         */
        BackBuffer( const OutputDevice& rRefDevice,
                    bool                bMonochromeBuffer=false );
        /** Create a backbuffer for given reference device */
        BackBuffer( const OutputDevice& rRefDevice );
        virtual ~BackBuffer() override;

        virtual OutputDevice&       getOutDev() override;
diff --git a/canvas/source/vcl/canvascustomsprite.cxx b/canvas/source/vcl/canvascustomsprite.cxx
index 9d1f83a..4bdebd4 100644
--- a/canvas/source/vcl/canvascustomsprite.cxx
+++ b/canvas/source/vcl/canvascustomsprite.cxx
@@ -58,9 +58,8 @@ namespace vclcanvas
        BackBufferSharedPtr pBackBuffer = std::make_shared<BackBuffer>( rOutDevProvider->getOutDev() );
        pBackBuffer->setSize( aSize );

        // create mask backbuffer, with one bit color depth
        BackBufferSharedPtr pBackBufferMask = std::make_shared<BackBuffer>( rOutDevProvider->getOutDev(),
                                                             true );
        // create mask backbuffer
        BackBufferSharedPtr pBackBufferMask = std::make_shared<BackBuffer>( rOutDevProvider->getOutDev() );
        pBackBufferMask->setSize( aSize );

        // TODO(F1): Implement alpha vdev (could prolly enable
diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx
index f5f214c..4f02452 100644
--- a/cui/source/dialogs/screenshotannotationdlg.cxx
+++ b/cui/source/dialogs/screenshotannotationdlg.cxx
@@ -234,7 +234,7 @@ ScreenshotAnnotationDlg_Impl::ScreenshotAnnotationDlg_Impl(
        maDimmedDialogBitmap.Adjust(-15, 0, 0, 0, 0);

        // init paint buffering VirtualDevice
        mxVirtualBufferDevice = VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), DeviceFormat::DEFAULT, DeviceFormat::BITMASK);
        mxVirtualBufferDevice = VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), DeviceFormat::DEFAULT);
        mxVirtualBufferDevice->SetOutputSizePixel(maParentDialogSize);
        mxVirtualBufferDevice->SetFillColor(COL_TRANSPARENT);

diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index ff0b830..e817473 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -367,7 +367,7 @@ namespace drawinglayer::primitive2d
            maGraphic(rGraphic),
            maAnimation(rGraphic.GetAnimation()),
            maVirtualDevice(*Application::GetDefaultDevice()),
            maVirtualDeviceMask(*Application::GetDefaultDevice(), DeviceFormat::BITMASK),
            maVirtualDeviceMask(*Application::GetDefaultDevice()),
            mnNextFrameToPrepare(SAL_MAX_UINT32),
            maBufferedFirstFrame(),
            maBufferedPrimitives(),
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 9b81426..cdd0365 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4472,7 +4472,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
                            rOutliner.SetStyleSheetPool(static_cast< SfxStyleSheetPool* >(pRet->getSdrModelFromSdrObject().GetStyleSheetPool()));
                            rOutliner.SetUpdateMode( false );
                            rOutliner.SetText( *pParaObj );
                            ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::BITMASK);
                            ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::DEFAULT);
                            pVirDev->SetMapMode(MapMode(MapUnit::Map100thMM));
                            sal_Int32 i, nParagraphs = rOutliner.GetParagraphCount();
                            if ( nParagraphs )
diff --git a/include/vcl/salgtype.hxx b/include/vcl/salgtype.hxx
index 1ab62fb..a6559d6 100644
--- a/include/vcl/salgtype.hxx
+++ b/include/vcl/salgtype.hxx
@@ -28,7 +28,6 @@
enum class DeviceFormat {
                            NONE = -1,
                            DEFAULT = 0,
                            BITMASK = 1,
#ifdef IOS
                            GRAYSCALE = 8
#endif
diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx
index 55a4a7f..459660e 100644
--- a/include/vcl/virdev.hxx
+++ b/include/vcl/virdev.hxx
@@ -82,13 +82,11 @@ protected:

        @param eFormat
        Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to
        indicate: take default screen depth. Only DeviceFormat::BITMASK
        is the other possibility to denote a binary mask.
        indicate: take default screen depth.

        @param eAlphaFormat
        Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to
        indicate: take default screen depth. Only DeviceFormat::BITMASK
        is the other possibility to denote a binary mask.
        indicate: take default screen depth.

        @param eOutDevType
        This real virtual output device type.
@@ -102,13 +100,11 @@ public:

        @param eFormat
        Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to
        indicate: take default screen depth. Only DeviceFormat::BITMASK
        is the other possibility to denote a binary mask.
        indicate: take default screen depth.

        @param eAlphaFormat
        Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to
        indicate: take default screen depth. Only DeviceFormat::BITMASK
        is the other possibility to denote a binary mask.
        indicate: take default screen depth.
     */
    explicit VirtualDevice(DeviceFormat eFormat = DeviceFormat::DEFAULT, DeviceFormat eAlphaFormat = DeviceFormat::NONE)
        : VirtualDevice(nullptr, eFormat, eAlphaFormat, OUTDEV_VIRDEV) {}
@@ -120,8 +116,7 @@ public:

        @param eFormat
        Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to
        indicate: take default screen depth. Only DeviceFormat::BITMASK
        is the other possibility to denote a binary mask.
        indicate: take default screen depth.
     */
    explicit VirtualDevice(const OutputDevice& rCompDev,
                           DeviceFormat eFormat = DeviceFormat::DEFAULT)
@@ -134,13 +129,11 @@ public:

        @param eFormat
        Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to
        indicate: take default screen depth. Only DeviceFormat::BITMASK
        is the other possibility to denote a binary mask.
        indicate: take default screen depth.

        @param eAlphaFormat
        Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to
        indicate: take default screen depth. Only DeviceFormat::BITMASK
        is the other possibility to denote a binary mask.
        indicate: take default screen depth.
     */
    explicit VirtualDevice(const OutputDevice& rCompDev,
                           DeviceFormat eFormat, DeviceFormat eAlphaFormat)
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 98ba25a..b9ee4c8 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -185,7 +185,7 @@ VirtualDevice* ScDocument::GetVirtualDevice_100th_mm()
#ifdef IOS
        mpVirtualDevice_100th_mm = VclPtr<VirtualDevice>::Create(DeviceFormat::GRAYSCALE);
#else
        mpVirtualDevice_100th_mm = VclPtr<VirtualDevice>::Create(DeviceFormat::BITMASK);
        mpVirtualDevice_100th_mm = VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT);
#endif
        mpVirtualDevice_100th_mm->SetReferenceDevice(VirtualDevice::RefDevMode::MSO1);
        MapMode aMapMode( mpVirtualDevice_100th_mm->GetMapMode() );
diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
index 9c5bbb1..ed8b05b 100644
--- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
+++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
@@ -395,7 +395,7 @@ void ScZoomSlider::DoPaint(vcl::RenderContext& rRenderContext)
    Size aSliderWindowSize(GetOutputSizePixel());
    tools::Rectangle aRect(Point(0, 0), aSliderWindowSize);

    ScopedVclPtrInstance< VirtualDevice > pVDev(rRenderContext, DeviceFormat::DEFAULT, DeviceFormat::BITMASK);
    ScopedVclPtrInstance< VirtualDevice > pVDev(rRenderContext);
    pVDev->SetOutputSizePixel(aSliderWindowSize);
    pVDev->SetFillColor( COL_TRANSPARENT );
    pVDev->SetLineColor( COL_TRANSPARENT );
diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx
index dfb33d9..0f8644c 100644
--- a/slideshow/source/engine/shapes/gdimtftools.cxx
+++ b/slideshow/source/engine/shapes/gdimtftools.cxx
@@ -274,7 +274,7 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames&   o_rFrames,
    pVDev->EnableMapMode( false );

    // setup mask VDev (alpha VDev is currently rather slow)
    ScopedVclPtrInstance<VirtualDevice> pVDevMask(DeviceFormat::BITMASK);
    ScopedVclPtrInstance<VirtualDevice> pVDevMask(DeviceFormat::DEFAULT);
    pVDevMask->SetOutputSizePixel( aAnimSize );
    pVDevMask->EnableMapMode( false );

diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index 7ea1dc3..5863c61 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -192,7 +192,7 @@ static void CalculateHorizontalScalingFactor(
    aFont.SetOrientation( 0_deg10 );
    // initializing virtual device

    ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::BITMASK);
    ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::DEFAULT);
    pVirDev->SetMapMode(MapMode(MapUnit::Map100thMM));
    pVirDev->SetFont( aFont );

@@ -303,7 +303,7 @@ static void GetTextAreaOutline(
            aFont.SetWeight( rWeightItem.GetWeight() );

            // initializing virtual device
            ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::BITMASK);
            ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::DEFAULT);
            pVirDev->SetMapMode(MapMode(MapUnit::Map100thMM));
            pVirDev->SetFont( aFont );
            pVirDev->EnableRTL();
diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx
index 5083838..5d80bb9 100644
--- a/sw/source/core/doc/DocumentDeviceManager.cxx
+++ b/sw/source/core/doc/DocumentDeviceManager.cxx
@@ -263,7 +263,7 @@ VirtualDevice& DocumentDeviceManager::CreateVirtualDevice_() const
#ifdef IOS
    VclPtr<VirtualDevice> pNewVir = VclPtr<VirtualDevice>::Create(DeviceFormat::GRAYSCALE);
#else
    VclPtr<VirtualDevice> pNewVir = VclPtr<VirtualDevice>::Create(DeviceFormat::BITMASK);
    VclPtr<VirtualDevice> pNewVir = VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT);
#endif

    pNewVir->SetReferenceDevice( VirtualDevice::RefDevMode::MSO1 );
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index 954f653..422928f 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -243,7 +243,7 @@ void SvpSalInstance::DestroyObject( SalObject* pObject )

std::unique_ptr<SalVirtualDevice> SvpSalInstance::CreateVirtualDevice(SalGraphics* pGraphics,
                                                       tools::Long &nDX, tools::Long &nDY,
                                                       DeviceFormat eFormat,
                                                       DeviceFormat /*eFormat*/,
                                                       const SystemGraphicsData* pGd)
{
    SvpSalGraphics *pSvpSalGraphics = dynamic_cast<SvpSalGraphics*>(pGraphics);
@@ -258,7 +258,7 @@ std::unique_ptr<SalVirtualDevice> SvpSalInstance::CreateVirtualDevice(SalGraphic
    (void)pGd;
    cairo_surface_t* pPreExistingTarget = nullptr;
#endif
    std::unique_ptr<SalVirtualDevice> pNew(new SvpSalVirtualDevice(eFormat, pSvpSalGraphics->getSurface(), pPreExistingTarget));
    std::unique_ptr<SalVirtualDevice> pNew(new SvpSalVirtualDevice(pSvpSalGraphics->getSurface(), pPreExistingTarget));
    pNew->SetSize( nDX, nDY );
    return pNew;
}
diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx
index 9025326..f8e9cb5 100644
--- a/vcl/headless/svpvd.cxx
+++ b/vcl/headless/svpvd.cxx
@@ -31,9 +31,8 @@

using namespace basegfx;

SvpSalVirtualDevice::SvpSalVirtualDevice(DeviceFormat eFormat, cairo_surface_t* pRefSurface, cairo_surface_t* pPreExistingTarget)
    : m_eFormat(eFormat)
    , m_pRefSurface(pRefSurface)
SvpSalVirtualDevice::SvpSalVirtualDevice(cairo_surface_t* pRefSurface, cairo_surface_t* pPreExistingTarget)
    : m_pRefSurface(pRefSurface)
    , m_pSurface(pPreExistingTarget)
    , m_bOwnsSurface(!pPreExistingTarget)
{
@@ -77,12 +76,7 @@ void SvpSalVirtualDevice::CreateSurface(tools::Long nNewDX, tools::Long nNewDY, 
        cairo_surface_destroy(m_pSurface);
    }

    if (m_eFormat == DeviceFormat::BITMASK)
    {
        m_pSurface = cairo_surface_create_similar(m_pRefSurface, CAIRO_CONTENT_ALPHA,
                            nNewDX, nNewDY);
    }
    else if (pBuffer)
    if (pBuffer)
    {
        double fXScale, fYScale;
        if (comphelper::LibreOfficeKit::isActive())
diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx
index f7270a3..ca9e38c 100644
--- a/vcl/inc/headless/svpvd.hxx
+++ b/vcl/inc/headless/svpvd.hxx
@@ -31,7 +31,6 @@ typedef struct _cairo_surface cairo_surface_t;

class VCL_DLLPUBLIC SvpSalVirtualDevice : public SalVirtualDevice
{
    DeviceFormat                        m_eFormat;
    cairo_surface_t*                    m_pRefSurface;
    cairo_surface_t*                    m_pSurface;
    bool                                m_bOwnsSurface; // nearly always true, except for edge case of tdf#127529
@@ -44,7 +43,7 @@ protected:
    SvpSalGraphics* AddGraphics(SvpSalGraphics* aGraphics);

public:
    SvpSalVirtualDevice(DeviceFormat eFormat, cairo_surface_t* pRefSurface, cairo_surface_t* pPreExistingTarget);
    SvpSalVirtualDevice(cairo_surface_t* pRefSurface, cairo_surface_t* pPreExistingTarget);
    virtual ~SvpSalVirtualDevice() override;

    // SalVirtualDevice
diff --git a/vcl/inc/qt5/Qt5VirtualDevice.hxx b/vcl/inc/qt5/Qt5VirtualDevice.hxx
index 0b94928..79e738e 100644
--- a/vcl/inc/qt5/Qt5VirtualDevice.hxx
+++ b/vcl/inc/qt5/Qt5VirtualDevice.hxx
@@ -34,12 +34,11 @@ class Qt5VirtualDevice final : public SalVirtualDevice
{
    std::vector<Qt5Graphics*> m_aGraphics;
    std::unique_ptr<QImage> m_pImage;
    DeviceFormat m_eFormat;
    QSize m_aFrameSize;
    double m_fScale;

public:
    Qt5VirtualDevice(DeviceFormat eFormat, double fScale);
    Qt5VirtualDevice(double fScale);

    // SalVirtualDevice
    virtual SalGraphics* AcquireGraphics() override;
diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx
index bf1ee35..ee70617 100644
--- a/vcl/qa/cppunit/lifecycle.cxx
+++ b/vcl/qa/cppunit/lifecycle.cxx
@@ -72,7 +72,7 @@ void LifecycleTest::testVirtualDevice()
    VclPtr<VirtualDevice> pVDev = VclPtr< VirtualDevice >::Create();
    ScopedVclPtrInstance< VirtualDevice > pVDev2;
    VclPtrInstance<VirtualDevice> pVDev3;
    VclPtrInstance<VirtualDevice> pVDev4(DeviceFormat::BITMASK);
    VclPtrInstance<VirtualDevice> pVDev4(DeviceFormat::DEFAULT);
    CPPUNIT_ASSERT(!!pVDev);
    CPPUNIT_ASSERT(!!pVDev2);
    CPPUNIT_ASSERT(!!pVDev3);
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 765ed60..6d6313f 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -311,7 +311,7 @@ void Qt5Instance::DestroyObject(SalObject* pObject)

std::unique_ptr<SalVirtualDevice>
Qt5Instance::CreateVirtualDevice(SalGraphics* pGraphics, tools::Long& nDX, tools::Long& nDY,
                                 DeviceFormat eFormat, const SystemGraphicsData* pGd)
                                 DeviceFormat /*eFormat*/, const SystemGraphicsData* pGd)
{
    if (m_bUseCairo)
    {
@@ -321,13 +321,13 @@ Qt5Instance::CreateVirtualDevice(SalGraphics* pGraphics, tools::Long& nDX, tools
        cairo_surface_t* pPreExistingTarget
            = pGd ? static_cast<cairo_surface_t*>(pGd->pSurface) : nullptr;
        std::unique_ptr<SalVirtualDevice> pVD(
            new Qt5SvpVirtualDevice(eFormat, pSvpSalGraphics->getSurface(), pPreExistingTarget));
            new Qt5SvpVirtualDevice(pSvpSalGraphics->getSurface(), pPreExistingTarget));
        pVD->SetSize(nDX, nDY);
        return pVD;
    }
    else
    {
        std::unique_ptr<SalVirtualDevice> pVD(new Qt5VirtualDevice(eFormat, 1));
        std::unique_ptr<SalVirtualDevice> pVD(new Qt5VirtualDevice(/*scale*/ 1));
        pVD->SetSize(nDX, nDY);
        return pVD;
    }
diff --git a/vcl/qt5/Qt5SvpVirtualDevice.hxx b/vcl/qt5/Qt5SvpVirtualDevice.hxx
index 0eb4ed26..f961d4c 100644
--- a/vcl/qt5/Qt5SvpVirtualDevice.hxx
+++ b/vcl/qt5/Qt5SvpVirtualDevice.hxx
@@ -25,9 +25,8 @@
class VCL_DLLPUBLIC Qt5SvpVirtualDevice : public SvpSalVirtualDevice
{
public:
    Qt5SvpVirtualDevice(DeviceFormat eFormat, cairo_surface_t* pRefSurface,
                        cairo_surface_t* pPreExistingTarget)
        : SvpSalVirtualDevice(eFormat, pRefSurface, pPreExistingTarget)
    Qt5SvpVirtualDevice(cairo_surface_t* pRefSurface, cairo_surface_t* pPreExistingTarget)
        : SvpSalVirtualDevice(pRefSurface, pPreExistingTarget)
    {
    }

diff --git a/vcl/qt5/Qt5VirtualDevice.cxx b/vcl/qt5/Qt5VirtualDevice.cxx
index 30b6e37..6b2c31c 100644
--- a/vcl/qt5/Qt5VirtualDevice.cxx
+++ b/vcl/qt5/Qt5VirtualDevice.cxx
@@ -24,9 +24,8 @@

#include <QtGui/QImage>

Qt5VirtualDevice::Qt5VirtualDevice(DeviceFormat eFormat, double fScale)
    : m_eFormat(eFormat)
    , m_fScale(fScale)
Qt5VirtualDevice::Qt5VirtualDevice(double fScale)
    : m_fScale(fScale)
{
}

@@ -67,17 +66,10 @@ bool Qt5VirtualDevice::SetSizeUsingBuffer(tools::Long nNewDX, tools::Long nNewDY
    nNewDX *= m_fScale;
    nNewDY *= m_fScale;

    if (m_eFormat == DeviceFormat::BITMASK)
    {
        m_pImage.reset(new QImage(nNewDX, nNewDY, QImage::Format_Mono));
    }
    if (pBuffer)
        m_pImage.reset(new QImage(pBuffer, nNewDX, nNewDY, Qt5_DefaultFormat32));
    else
    {
        if (pBuffer)
            m_pImage.reset(new QImage(pBuffer, nNewDX, nNewDY, Qt5_DefaultFormat32));
        else
            m_pImage.reset(new QImage(nNewDX, nNewDY, Qt5_DefaultFormat32));
    }
        m_pImage.reset(new QImage(nNewDX, nNewDY, Qt5_DefaultFormat32));

    m_pImage->fill(Qt::transparent);
    m_pImage->setDevicePixelRatio(m_fScale);
diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx
index 9f6bfdd..08997a3 100644
--- a/vcl/quartz/salvd.cxx
+++ b/vcl/quartz/salvd.cxx
@@ -116,9 +116,6 @@ AquaSalVirtualDevice::AquaSalVirtualDevice(
        mpGraphics = new AquaSalGraphics(); // never fails
        switch (eFormat)
        {
            case DeviceFormat::BITMASK:
                mnBitmapDepth = 1;
                break;
#ifdef IOS
            case DeviceFormat::GRAYSCALE:
                mnBitmapDepth = 8;
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index 8d931d3..90c0ca8 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -548,8 +548,7 @@ BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx const & aBitmap, const tools::Long 
    Size aStdSize( aStandardSize, aStandardSize );
    tools::Rectangle aRect(aEmptyPoint, aStdSize );

    ScopedVclPtrInstance< VirtualDevice > aVirDevice(*Application::GetDefaultDevice(),
                                                     DeviceFormat::DEFAULT, DeviceFormat::BITMASK);
    ScopedVclPtrInstance< VirtualDevice > aVirDevice(*Application::GetDefaultDevice());
    aVirDevice->SetOutputSizePixel( aStdSize );
    aVirDevice->SetFillColor( COL_TRANSPARENT );
    aVirDevice->SetLineColor( COL_TRANSPARENT );
diff --git a/vcl/source/filter/eps/eps.cxx b/vcl/source/filter/eps/eps.cxx
index fbea390..2da2833 100644
--- a/vcl/source/filter/eps/eps.cxx
+++ b/vcl/source/filter/eps/eps.cxx
@@ -2001,7 +2001,7 @@ void PSWriter::ImplText( const OUString& rUniString, const Point& rPos, const to
        vcl::Font    aNotRotatedFont( maFont );
        aNotRotatedFont.SetOrientation( 0_deg10 );

        ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::BITMASK);
        ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::DEFAULT);
        pVirDev->SetMapMode( rVDev.GetMapMode() );
        pVirDev->SetFont( aNotRotatedFont );
        pVirDev->SetTextAlign( eTextAlign );
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 7a2102b..be0c54b 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -157,21 +157,10 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
            css::uno::Reference< css::uno::XInterface >() );
    }

    switch (meFormat)
    {
        case DeviceFormat::BITMASK:
            mnBitCount = 1;
            break;
        default:
            mnBitCount = pOutDev->GetBitCount();
            break;
    }
    mnBitCount = pOutDev->GetBitCount();
    mnOutWidth      = nDX;
    mnOutHeight     = nDY;

    if (meFormat == DeviceFormat::BITMASK)
        SetAntialiasing( AntialiasingFlags::DisableText );

    mbScreenComp    = pOutDev->IsScreenComp();

    mbDevOutput     = true;
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 3229949..9a37ab2 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -215,7 +215,7 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout )

    // cache virtual device for rotation
    if (!mpOutDevData->mpRotateDev)
        mpOutDevData->mpRotateDev = VclPtr<VirtualDevice>::Create(*this, DeviceFormat::BITMASK);
        mpOutDevData->mpRotateDev = VclPtr<VirtualDevice>::Create(*this);
    VirtualDevice* pVDev = mpOutDevData->mpRotateDev;

    // size it accordingly
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index 415e3f1..10bfa559 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -380,7 +380,7 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly,

        if( !bDrawn )
        {
            ScopedVclPtrInstance< VirtualDevice > aVDev(*this, DeviceFormat::BITMASK);
            ScopedVclPtrInstance< VirtualDevice > aVDev(*this);
            const Size aDstSz( aDstRect.GetSize() );
            const sal_uInt8 cTrans = static_cast<sal_uInt8>(MinMax( FRound( nTransparencePercent * 2.55 ), 0, 255 ));

diff --git a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
index 2382240..3f2698b6 100644
--- a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
+++ b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
@@ -302,13 +302,8 @@ namespace cairo
    {
        if (!maSysData.pRenderFormat)
            return DeviceFormat::DEFAULT;
        switch (static_cast<XRenderPictFormat*>(maSysData.pRenderFormat)->depth)
        {
            case 1:
                return DeviceFormat::BITMASK;
            default:
                return DeviceFormat::DEFAULT;
        }
        assert (static_cast<XRenderPictFormat*>(maSysData.pRenderFormat)->depth != 1 && "unsupported");
        return DeviceFormat::DEFAULT;
    }
}

diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx
index 666be9c..0a824a4 100644
--- a/vcl/unx/generic/gdi/salvd.cxx
+++ b/vcl/unx/generic/gdi/salvd.cxx
@@ -87,7 +87,7 @@ void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, cairo_surface_t* pPreEx
}

X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics const * pGraphics, tools::Long &nDX, tools::Long &nDY,
                                         DeviceFormat eFormat, const SystemGraphicsData *pData,
                                         DeviceFormat /*eFormat*/, const SystemGraphicsData *pData,
                                         std::unique_ptr<X11SalGraphics> pNewGraphics) :
    pGraphics_(std::move(pNewGraphics)),
    m_nXScreen(0),
@@ -96,18 +96,7 @@ X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics const * pGraphics, tools::L
    SalColormap* pColormap = nullptr;
    bool bDeleteColormap = false;

    sal_uInt16 nBitCount;
    switch (eFormat)
    {
        case DeviceFormat::BITMASK:
            nBitCount = 1;
            break;
        default:
            nBitCount = pGraphics->GetBitCount();
            break;

    }

    sal_uInt16 nBitCount = pGraphics->GetBitCount();
    pDisplay_               = vcl_sal::getSalDisplay(GetGenericUnixSalData());
    nDepth_                 = nBitCount;

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 8f261d1..4318961 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -335,7 +335,7 @@ void GtkYieldMutex::ThreadsLeave()

std::unique_ptr<SalVirtualDevice> GtkInstance::CreateVirtualDevice( SalGraphics *pG,
                                                    tools::Long &nDX, tools::Long &nDY,
                                                    DeviceFormat eFormat,
                                                    DeviceFormat /*eFormat*/,
                                                    const SystemGraphicsData* pGd )
{
    EnsureInit();
@@ -343,7 +343,7 @@ std::unique_ptr<SalVirtualDevice> GtkInstance::CreateVirtualDevice( SalGraphics 
    assert(pSvpSalGraphics);
    // tdf#127529 see SvpSalInstance::CreateVirtualDevice for the rare case of a non-null pPreExistingTarget
    cairo_surface_t* pPreExistingTarget = pGd ? static_cast<cairo_surface_t*>(pGd->pSurface) : nullptr;
    std::unique_ptr<SalVirtualDevice> pNew(new SvpSalVirtualDevice(eFormat, pSvpSalGraphics->getSurface(), pPreExistingTarget));
    std::unique_ptr<SalVirtualDevice> pNew(new SvpSalVirtualDevice(pSvpSalGraphics->getSurface(), pPreExistingTarget));
    pNew->SetSize( nDX, nDY );
    return pNew;
}
diff --git a/vcl/win/gdi/salvd.cxx b/vcl/win/gdi/salvd.cxx
index 0645b06..158c1e6 100644
--- a/vcl/win/gdi/salvd.cxx
+++ b/vcl/win/gdi/salvd.cxx
@@ -73,7 +73,7 @@ HBITMAP WinSalVirtualDevice::ImplCreateVirDevBitmap(HDC hDC, tools::Long nDX, to

std::unique_ptr<SalVirtualDevice> WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics,
                                                       tools::Long &nDX, tools::Long &nDY,
                                                       DeviceFormat eFormat,
                                                       DeviceFormat /*eFormat*/,
                                                       const SystemGraphicsData* pData )
{
    WinSalGraphics* pGraphics = static_cast<WinSalGraphics*>(pSGraphics);
@@ -102,8 +102,7 @@ std::unique_ptr<SalVirtualDevice> WinSalInstance::CreateVirtualDevice( SalGraphi
    if (!hDC)
        return nullptr;

    sal_uInt16 nBitCount = (eFormat == DeviceFormat::BITMASK) ? 1 : 0;

    sal_uInt16 nBitCount = 0;
    HBITMAP hBmp = nullptr;
    if (!pData)
    {