[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/qt5 vcl/quartz vcl/skia vcl/source vcl/unx vcl/win

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sat May 1 15:09:26 UTC 2021


 vcl/headless/svpinst.cxx      |    4 ++--
 vcl/inc/headless/svpinst.hxx  |    2 +-
 vcl/inc/osx/salinst.h         |    2 +-
 vcl/inc/qt5/Qt5Instance.hxx   |    2 +-
 vcl/inc/salinst.hxx           |    2 +-
 vcl/inc/skia/x11/salvd.hxx    |    2 +-
 vcl/inc/unx/gtk/gtkinst.hxx   |    2 +-
 vcl/inc/unx/salinst.h         |    4 ++--
 vcl/inc/unx/salvd.h           |    2 +-
 vcl/inc/win/salinst.h         |    2 +-
 vcl/qt5/Qt5Instance.cxx       |    4 ++--
 vcl/quartz/salvd.cxx          |    6 +++---
 vcl/skia/x11/salvd.cxx        |    5 ++---
 vcl/source/gdi/virdev.cxx     |    4 ++--
 vcl/unx/generic/gdi/salvd.cxx |   18 ++++++++----------
 vcl/unx/gtk3/gtk3gtkinst.cxx  |    4 ++--
 vcl/win/gdi/salvd.cxx         |   10 +++++-----
 17 files changed, 36 insertions(+), 39 deletions(-)

New commits:
commit 3d65c10f39e191b7e1ceb6fc94fed9e6196de0aa
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Apr 30 21:14:57 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat May 1 17:08:41 2021 +0200

    Related: cid#1478001 CreateVirtualDevice never passed a null pGraphics arg
    
    Change-Id: I0701b15a28ab3583586c0c8018c511e100b41a93
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114948
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index 422928f98d38..700c6b87f645 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -241,12 +241,12 @@ void SvpSalInstance::DestroyObject( SalObject* pObject )
 
 #ifndef IOS
 
-std::unique_ptr<SalVirtualDevice> SvpSalInstance::CreateVirtualDevice(SalGraphics* pGraphics,
+std::unique_ptr<SalVirtualDevice> SvpSalInstance::CreateVirtualDevice(SalGraphics& rGraphics,
                                                        tools::Long &nDX, tools::Long &nDY,
                                                        DeviceFormat /*eFormat*/,
                                                        const SystemGraphicsData* pGd)
 {
-    SvpSalGraphics *pSvpSalGraphics = dynamic_cast<SvpSalGraphics*>(pGraphics);
+    SvpSalGraphics *pSvpSalGraphics = dynamic_cast<SvpSalGraphics*>(&rGraphics);
     assert(pSvpSalGraphics);
 #ifndef ANDROID
     // tdf#127529 normally pPreExistingTarget is null and we are a true virtualdevice drawing to a backing buffer.
diff --git a/vcl/inc/headless/svpinst.hxx b/vcl/inc/headless/svpinst.hxx
index e95353a0c227..2f48049b4839 100644
--- a/vcl/inc/headless/svpinst.hxx
+++ b/vcl/inc/headless/svpinst.hxx
@@ -134,7 +134,7 @@ public:
     // nBitCount: 0 == Default(=as window) / 1 == Mono
     // pData allows for using a system dependent graphics or device context
     virtual std::unique_ptr<SalVirtualDevice>
-                            CreateVirtualDevice( SalGraphics* pGraphics,
+                            CreateVirtualDevice( SalGraphics& rGraphics,
                                                      tools::Long &nDX, tools::Long &nDY,
                                                      DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) override;
 
diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h
index 97cbe37e2038..e143f970db0d 100644
--- a/vcl/inc/osx/salinst.h
+++ b/vcl/inc/osx/salinst.h
@@ -101,7 +101,7 @@ public:
                                           bool bShow ) override;
     virtual void            DestroyObject( SalObject* pObject ) override;
     virtual std::unique_ptr<SalVirtualDevice>
-                            CreateVirtualDevice( SalGraphics* pGraphics,
+                            CreateVirtualDevice( SalGraphics& rGraphics,
                                                    tools::Long &nDX, tools::Long &nDY,
                                                    DeviceFormat eFormat,
                                                    const SystemGraphicsData *pData = nullptr ) override;
diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx
index 111e86f0878a..41b9aca894d0 100644
--- a/vcl/inc/qt5/Qt5Instance.hxx
+++ b/vcl/inc/qt5/Qt5Instance.hxx
@@ -111,7 +111,7 @@ public:
     virtual void DestroyObject(SalObject* pObject) override;
 
     virtual std::unique_ptr<SalVirtualDevice>
-    CreateVirtualDevice(SalGraphics* pGraphics, tools::Long& nDX, tools::Long& nDY,
+    CreateVirtualDevice(SalGraphics& rGraphics, tools::Long& nDX, tools::Long& nDY,
                         DeviceFormat eFormat, const SystemGraphicsData* pData = nullptr) override;
 
     virtual SalInfoPrinter* CreateInfoPrinter(SalPrinterQueueInfo* pQueueInfo,
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index 1a6ce96cf809..6ce6a3d2743d 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -105,7 +105,7 @@ public:
     // if a system context is passed in nDX and nDY are updated to reflect
     // its size; otherwise these remain unchanged.
     virtual std::unique_ptr<SalVirtualDevice>
-                            CreateVirtualDevice( SalGraphics* pGraphics,
+                            CreateVirtualDevice( SalGraphics& rGraphics,
                                                  tools::Long &rDX, tools::Long &rDY,
                                                  DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) = 0;
 
diff --git a/vcl/inc/skia/x11/salvd.hxx b/vcl/inc/skia/x11/salvd.hxx
index 7beada38daf6..47813a467a96 100644
--- a/vcl/inc/skia/x11/salvd.hxx
+++ b/vcl/inc/skia/x11/salvd.hxx
@@ -22,7 +22,7 @@ class X11SkiaSalVirtualDevice : public SalVirtualDevice
     int mnHeight;
 
 public:
-    X11SkiaSalVirtualDevice(SalGraphics const* pGraphics, tools::Long nDX, tools::Long nDY,
+    X11SkiaSalVirtualDevice(const SalGraphics& rGraphics, tools::Long nDX, tools::Long nDY,
                             const SystemGraphicsData* pData,
                             std::unique_ptr<X11SalGraphics> pNewGraphics);
     virtual ~X11SkiaSalVirtualDevice() override;
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 6d88211fdc44..0d3c16bfdbb5 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -202,7 +202,7 @@ public:
     virtual SalTimer*           CreateSalTimer() override;
     virtual void                AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) override;
     virtual std::unique_ptr<SalVirtualDevice>
-                                CreateVirtualDevice( SalGraphics*,
+                                CreateVirtualDevice( SalGraphics&,
                                                      tools::Long &nDX, tools::Long &nDY,
                                                      DeviceFormat eFormat,
                                                      const SystemGraphicsData* = nullptr ) override;
diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h
index 69c686de1c0d..9378b243a58e 100644
--- a/vcl/inc/unx/salinst.h
+++ b/vcl/inc/unx/salinst.h
@@ -52,11 +52,11 @@ public:
     virtual void                DestroyObject( SalObject* pObject ) override;
 
     /// Gtk vclplug needs to pass GtkSalGraphics to X11SalVirtualDevice, so create it, and pass as pNewGraphics.
-    static std::unique_ptr<SalVirtualDevice> CreateX11VirtualDevice(SalGraphics const * pGraphics, tools::Long &nDX, tools::Long &nDY,
+    static std::unique_ptr<SalVirtualDevice> CreateX11VirtualDevice(const SalGraphics& rGraphics, tools::Long &nDX, tools::Long &nDY,
             DeviceFormat eFormat, const SystemGraphicsData* pData, std::unique_ptr<X11SalGraphics> pNewGraphics);
 
     virtual std::unique_ptr<SalVirtualDevice>
-                                CreateVirtualDevice( SalGraphics* pGraphics,
+                                CreateVirtualDevice( SalGraphics& rGraphics,
                                                      tools::Long &nDX, tools::Long &nDY,
                                                      DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) override;
     virtual void                PostPrintersChanged() override;
diff --git a/vcl/inc/unx/salvd.h b/vcl/inc/unx/salvd.h
index f01e3b5076f2..ea362ba0bfb9 100644
--- a/vcl/inc/unx/salvd.h
+++ b/vcl/inc/unx/salvd.h
@@ -46,7 +46,7 @@ class X11SalVirtualDevice : public SalVirtualDevice
     bool        bExternPixmap_;
 
 public:
-    X11SalVirtualDevice(SalGraphics const *pGraphics, tools::Long &nDX, tools::Long &nDY,
+    X11SalVirtualDevice(const SalGraphics& rGraphics, tools::Long &nDX, tools::Long &nDY,
             DeviceFormat eFormat, const SystemGraphicsData *pData, std::unique_ptr<X11SalGraphics> pNewGraphics);
 
     virtual ~X11SalVirtualDevice() override;
diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h
index bd923390d077..975baff282ec 100644
--- a/vcl/inc/win/salinst.h
+++ b/vcl/inc/win/salinst.h
@@ -49,7 +49,7 @@ public:
     virtual SalObject*      CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow ) override;
     virtual void            DestroyObject( SalObject* pObject ) override;
     virtual std::unique_ptr<SalVirtualDevice>
-                            CreateVirtualDevice( SalGraphics* pGraphics,
+                            CreateVirtualDevice( SalGraphics& rGraphics,
                                                      tools::Long &nDX, tools::Long &nDY,
                                                      DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) override;
     virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 6d6313f76c65..f0c1f56f6690 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -310,12 +310,12 @@ void Qt5Instance::DestroyObject(SalObject* pObject)
 }
 
 std::unique_ptr<SalVirtualDevice>
-Qt5Instance::CreateVirtualDevice(SalGraphics* pGraphics, tools::Long& nDX, tools::Long& nDY,
+Qt5Instance::CreateVirtualDevice(SalGraphics& rGraphics, tools::Long& nDX, tools::Long& nDY,
                                  DeviceFormat /*eFormat*/, const SystemGraphicsData* pGd)
 {
     if (m_bUseCairo)
     {
-        SvpSalGraphics* pSvpSalGraphics = dynamic_cast<Qt5SvpGraphics*>(pGraphics);
+        SvpSalGraphics* pSvpSalGraphics = dynamic_cast<Qt5SvpGraphics*>(&rGraphics);
         assert(pSvpSalGraphics);
         // tdf#127529 see SvpSalInstance::CreateVirtualDevice for the rare case of a non-null pPreExistingTarget
         cairo_surface_t* pPreExistingTarget
diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx
index 08997a300e57..4e84e33a13b5 100644
--- a/vcl/quartz/salvd.cxx
+++ b/vcl/quartz/salvd.cxx
@@ -36,7 +36,7 @@
 #include <quartz/salvd.h>
 #include <quartz/utils.h>
 
-std::unique_ptr<SalVirtualDevice> AquaSalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
+std::unique_ptr<SalVirtualDevice> AquaSalInstance::CreateVirtualDevice( SalGraphics& rGraphics,
                                                         tools::Long &nDX, tools::Long &nDY,
                                                         DeviceFormat eFormat,
                                                         const SystemGraphicsData *pData )
@@ -47,7 +47,7 @@ std::unique_ptr<SalVirtualDevice> AquaSalInstance::CreateVirtualDevice( SalGraph
 #ifdef IOS
     if( pData )
     {
-        return std::unique_ptr<SalVirtualDevice>(new AquaSalVirtualDevice( static_cast< AquaSalGraphics* >( pGraphics ),
+        return std::unique_ptr<SalVirtualDevice>(new AquaSalVirtualDevice( static_cast< AquaSalGraphics* >(&rGraphics),
                                          nDX, nDY, eFormat, pData ));
     }
     else
@@ -57,7 +57,7 @@ std::unique_ptr<SalVirtualDevice> AquaSalInstance::CreateVirtualDevice( SalGraph
         return pNew;
     }
 #else
-    return std::unique_ptr<SalVirtualDevice>(new AquaSalVirtualDevice( static_cast< AquaSalGraphics* >( pGraphics ),
+    return std::unique_ptr<SalVirtualDevice>(new AquaSalVirtualDevice( static_cast< AquaSalGraphics* >(&rGraphics),
                                      nDX, nDY, eFormat, pData ));
 #endif
 }
diff --git a/vcl/skia/x11/salvd.cxx b/vcl/skia/x11/salvd.cxx
index 20ba5bfd001d..bb007962f11c 100644
--- a/vcl/skia/x11/salvd.cxx
+++ b/vcl/skia/x11/salvd.cxx
@@ -32,7 +32,7 @@ void X11SalGraphics::Init(X11SkiaSalVirtualDevice* pDevice)
     mxImpl->Init();
 }
 
-X11SkiaSalVirtualDevice::X11SkiaSalVirtualDevice(SalGraphics const* pGraphics, tools::Long nDX,
+X11SkiaSalVirtualDevice::X11SkiaSalVirtualDevice(const SalGraphics& rGraphics, tools::Long nDX,
                                                  tools::Long nDY, const SystemGraphicsData* pData,
                                                  std::unique_ptr<X11SalGraphics> pNewGraphics)
     : mpGraphics(std::move(pNewGraphics))
@@ -46,8 +46,7 @@ X11SkiaSalVirtualDevice::X11SkiaSalVirtualDevice(SalGraphics const* pGraphics, t
     (void)pData;
 
     mpDisplay = vcl_sal::getSalDisplay(GetGenericUnixSalData());
-    mnXScreen = pGraphics ? static_cast<X11SalGraphics const*>(pGraphics)->GetScreenNumber()
-                          : vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetDefaultXScreen();
+    mnXScreen = static_cast<const X11SalGraphics&>(rGraphics).GetScreenNumber();
     mnWidth = nDX;
     mnHeight = nDY;
     mpGraphics->Init(this);
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index be0c54bdc71c..35d7088fee7e 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -146,7 +146,7 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
         (void)pOutDev->AcquireGraphics();
     pGraphics = pOutDev->mpGraphics;
     if ( pGraphics )
-        mpVirDev = pSVData->mpDefInst->CreateVirtualDevice(pGraphics, nDX, nDY, meFormat, pData);
+        mpVirDev = pSVData->mpDefInst->CreateVirtualDevice(*pGraphics, nDX, nDY, meFormat, pData);
     else
         mpVirDev = nullptr;
     if ( !mpVirDev )
@@ -295,7 +295,7 @@ bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bEra
 
         assert(mpGraphics);
 
-        pNewVirDev = pSVData->mpDefInst->CreateVirtualDevice(mpGraphics, nNewWidth, nNewHeight, meFormat);
+        pNewVirDev = pSVData->mpDefInst->CreateVirtualDevice(*mpGraphics, nNewWidth, nNewHeight, meFormat);
         if ( pNewVirDev )
         {
             SalGraphics* pGraphics = pNewVirDev->AcquireGraphics();
diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx
index ab9d2b65cb4a..dcb3a5e897b8 100644
--- a/vcl/unx/generic/gdi/salvd.cxx
+++ b/vcl/unx/generic/gdi/salvd.cxx
@@ -34,23 +34,23 @@
 #include <skia/x11/salvd.hxx>
 #endif
 
-std::unique_ptr<SalVirtualDevice> X11SalInstance::CreateX11VirtualDevice(SalGraphics const * pGraphics,
+std::unique_ptr<SalVirtualDevice> X11SalInstance::CreateX11VirtualDevice(const SalGraphics& rGraphics,
         tools::Long &nDX, tools::Long &nDY, DeviceFormat eFormat, const SystemGraphicsData *pData,
         std::unique_ptr<X11SalGraphics> pNewGraphics)
 {
     assert(pNewGraphics);
 #if HAVE_FEATURE_SKIA
     if (SkiaHelper::isVCLSkiaEnabled())
-        return std::unique_ptr<SalVirtualDevice>(new X11SkiaSalVirtualDevice( pGraphics, nDX, nDY, pData, std::move(pNewGraphics) ));
+        return std::unique_ptr<SalVirtualDevice>(new X11SkiaSalVirtualDevice(rGraphics, nDX, nDY, pData, std::move(pNewGraphics)));
     else
 #endif
-        return std::unique_ptr<SalVirtualDevice>(new X11SalVirtualDevice(pGraphics, nDX, nDY, eFormat, pData, std::move(pNewGraphics)));
+        return std::unique_ptr<SalVirtualDevice>(new X11SalVirtualDevice(rGraphics, nDX, nDY, eFormat, pData, std::move(pNewGraphics)));
 }
 
-std::unique_ptr<SalVirtualDevice> X11SalInstance::CreateVirtualDevice(SalGraphics* pGraphics,
+std::unique_ptr<SalVirtualDevice> X11SalInstance::CreateVirtualDevice(SalGraphics& rGraphics,
         tools::Long &nDX, tools::Long &nDY, DeviceFormat eFormat, const SystemGraphicsData *pData)
 {
-    return CreateX11VirtualDevice(pGraphics, nDX, nDY, eFormat, pData, std::make_unique<X11SalGraphics>());
+    return CreateX11VirtualDevice(rGraphics, nDX, nDY, eFormat, pData, std::make_unique<X11SalGraphics>());
 }
 
 void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, cairo_surface_t* pPreExistingTarget, SalColormap* pColormap,
@@ -86,19 +86,17 @@ void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, cairo_surface_t* pPreEx
     mxImpl->Init();
 }
 
-X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics const * pGraphics, tools::Long &nDX, tools::Long &nDY,
+X11SalVirtualDevice::X11SalVirtualDevice(const SalGraphics& rGraphics, tools::Long &nDX, tools::Long &nDY,
                                          DeviceFormat /*eFormat*/, const SystemGraphicsData *pData,
                                          std::unique_ptr<X11SalGraphics> pNewGraphics) :
     pGraphics_(std::move(pNewGraphics)),
     m_nXScreen(0),
     bGraphics_(false)
 {
-    assert(pGraphics);
-
     SalColormap* pColormap = nullptr;
     bool bDeleteColormap = false;
 
-    sal_uInt16 nBitCount = pGraphics->GetBitCount();
+    sal_uInt16 nBitCount = rGraphics.GetBitCount();
     pDisplay_               = vcl_sal::getSalDisplay(GetGenericUnixSalData());
     nDepth_                 = nBitCount;
 
@@ -129,7 +127,7 @@ X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics const * pGraphics, tools::L
     {
         nDX_ = nDX;
         nDY_ = nDY;
-        m_nXScreen = static_cast<X11SalGraphics const *>(pGraphics)->GetScreenNumber();
+        m_nXScreen = static_cast<const X11SalGraphics&>(rGraphics).GetScreenNumber();
         hDrawable_ = limitXCreatePixmap( GetXDisplay(),
                                          pDisplay_->GetDrawable( m_nXScreen ),
                                          nDX_, nDY_,
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index af252ea05bfa..2ecd35cb89b5 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -333,13 +333,13 @@ void GtkYieldMutex::ThreadsLeave()
     release(true);
 }
 
-std::unique_ptr<SalVirtualDevice> GtkInstance::CreateVirtualDevice( SalGraphics *pG,
+std::unique_ptr<SalVirtualDevice> GtkInstance::CreateVirtualDevice( SalGraphics &rG,
                                                     tools::Long &nDX, tools::Long &nDY,
                                                     DeviceFormat /*eFormat*/,
                                                     const SystemGraphicsData* pGd )
 {
     EnsureInit();
-    SvpSalGraphics *pSvpSalGraphics = dynamic_cast<SvpSalGraphics*>(pG);
+    SvpSalGraphics *pSvpSalGraphics = dynamic_cast<SvpSalGraphics*>(&rG);
     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;
diff --git a/vcl/win/gdi/salvd.cxx b/vcl/win/gdi/salvd.cxx
index 158c1e6908a1..74e458dc7244 100644
--- a/vcl/win/gdi/salvd.cxx
+++ b/vcl/win/gdi/salvd.cxx
@@ -71,12 +71,12 @@ HBITMAP WinSalVirtualDevice::ImplCreateVirDevBitmap(HDC hDC, tools::Long nDX, to
     return hBitmap;
 }
 
-std::unique_ptr<SalVirtualDevice> WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics,
+std::unique_ptr<SalVirtualDevice> WinSalInstance::CreateVirtualDevice( SalGraphics& rSGraphics,
                                                        tools::Long &nDX, tools::Long &nDY,
                                                        DeviceFormat /*eFormat*/,
                                                        const SystemGraphicsData* pData )
 {
-    WinSalGraphics* pGraphics = static_cast<WinSalGraphics*>(pSGraphics);
+    WinSalGraphics& rGraphics = static_cast<WinSalGraphics&>(rSGraphics);
     HDC hDC = nullptr;
 
     if( pData )
@@ -95,7 +95,7 @@ std::unique_ptr<SalVirtualDevice> WinSalInstance::CreateVirtualDevice( SalGraphi
     }
     else
     {
-        hDC = CreateCompatibleDC( pGraphics->getHDC() );
+        hDC = CreateCompatibleDC( rGraphics.getHDC() );
         SAL_WARN_IF( !hDC, "vcl", "CreateCompatibleDC failed: " << WindowsErrorString( GetLastError() ) );
     }
 
@@ -109,7 +109,7 @@ std::unique_ptr<SalVirtualDevice> WinSalInstance::CreateVirtualDevice( SalGraphi
         // #124826# continue even if hBmp could not be created
         // if we would return a failure in this case, the process
         // would terminate which is not required
-        hBmp = WinSalVirtualDevice::ImplCreateVirDevBitmap(pGraphics->getHDC(),
+        hBmp = WinSalVirtualDevice::ImplCreateVirDevBitmap(rGraphics.getHDC(),
                                                            nDX, nDY, nBitCount,
                                                            &o3tl::temporary<void*>(nullptr));
     }
@@ -121,7 +121,7 @@ std::unique_ptr<SalVirtualDevice> WinSalInstance::CreateVirtualDevice( SalGraphi
                                                          bForeignDC, nDX, nDY);
 
     WinSalGraphics* pVirGraphics = new WinSalGraphics(WinSalGraphics::VIRTUAL_DEVICE,
-                                                      pGraphics->isScreen(), nullptr, pVDev);
+                                                      rGraphics.isScreen(), nullptr, pVDev);
 
     // by default no! mirroring for VirtualDevices, can be enabled with EnableRTL()
     pVirGraphics->SetLayout( SalLayoutFlags::NONE );


More information about the Libreoffice-commits mailing list