From f1ab6d3e046c261ac0cc0de35bed3e61ba052dca Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 18 Nov 2024 19:49:51 +0200 Subject: Simplify SalGraphicsImpl::Init it is only used for one thing, so rename it, and use a default implementation to avoid having empty implementations everywhere Change-Id: Ib650bb520ccbfcc27537b754db4d3de4ad10e638 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176733 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/headless/SvpGraphicsBackend.cxx | 2 -- vcl/inc/headless/SvpGraphicsBackend.hxx | 2 -- vcl/inc/qt5/QtGraphics.hxx | 2 -- vcl/inc/quartz/salgdi.h | 2 -- vcl/inc/salgdiimpl.hxx | 3 ++- vcl/inc/skia/gdiimpl.hxx | 2 -- vcl/inc/skia/x11/gdiimpl.hxx | 2 +- vcl/quartz/AquaGraphicsBackend.cxx | 2 -- vcl/skia/gdiimpl.cxx | 2 -- vcl/skia/osx/gdiimpl.cxx | 1 - vcl/skia/x11/gdiimpl.cxx | 3 +-- vcl/skia/x11/salvd.cxx | 2 +- vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx | 2 -- vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx | 2 -- vcl/unx/generic/gdi/salgdi.cxx | 2 +- vcl/unx/generic/gdi/salvd.cxx | 2 +- vcl/win/gdi/gdiimpl.cxx | 4 ---- vcl/win/gdi/gdiimpl.hxx | 2 -- vcl/win/gdi/salgdi.cxx | 2 -- vcl/win/gdi/salvd.cxx | 3 --- 20 files changed, 7 insertions(+), 37 deletions(-) diff --git a/vcl/headless/SvpGraphicsBackend.cxx b/vcl/headless/SvpGraphicsBackend.cxx index ddd85978dd82..58a50653a743 100644 --- a/vcl/headless/SvpGraphicsBackend.cxx +++ b/vcl/headless/SvpGraphicsBackend.cxx @@ -24,8 +24,6 @@ SvpGraphicsBackend::SvpGraphicsBackend(CairoCommon& rCairoCommon) { } -void SvpGraphicsBackend::Init() {} - void SvpGraphicsBackend::setClipRegion(const vcl::Region& i_rClip) { m_rCairoCommon.m_aClipRegion = i_rClip; diff --git a/vcl/inc/headless/SvpGraphicsBackend.hxx b/vcl/inc/headless/SvpGraphicsBackend.hxx index 4e2322148376..53678d619198 100644 --- a/vcl/inc/headless/SvpGraphicsBackend.hxx +++ b/vcl/inc/headless/SvpGraphicsBackend.hxx @@ -34,8 +34,6 @@ class SAL_DLLPUBLIC_RTTI SvpGraphicsBackend final : public SalGraphicsImpl public: SvpGraphicsBackend(CairoCommon& rCairoCommon); - void Init() override; - OUString getRenderBackendName() const override { return u"svp"_ustr; } void setClipRegion(vcl::Region const& rRegion) override; diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx index 5212d30873b2..fea1a2a0de18 100644 --- a/vcl/inc/qt5/QtGraphics.hxx +++ b/vcl/inc/qt5/QtGraphics.hxx @@ -59,8 +59,6 @@ public: QtGraphicsBackend(QtFrame* pFrame, QImage* pQImage); ~QtGraphicsBackend() override; - void Init() override {} - QImage* getQImage() { return m_pQImage; } void setQImage(QImage* pQImage) { m_pQImage = pQImage; } diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 00abbc6df182..e0ccbfbb4fd1 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -269,8 +269,6 @@ public: AquaGraphicsBackend(AquaSharedAttributes & rShared); ~AquaGraphicsBackend() override; - void Init() override; - OUString getRenderBackendName() const override { return "aqua"; diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx index 8fa7b54ca3f0..56e303b2806e 100644 --- a/vcl/inc/salgdiimpl.hxx +++ b/vcl/inc/salgdiimpl.hxx @@ -72,7 +72,8 @@ public: // so see the SalGraphics class for documentation (both uppercase and lowercase // function variants). - virtual void Init() = 0; + /// Only used by the X11SkiaSalGraphicsImpl backend + virtual void UpdateX11GeometryProvider() {} virtual void DeInit() {} diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx index 88d066aaafdb..7fad579d0db2 100644 --- a/vcl/inc/skia/gdiimpl.hxx +++ b/vcl/inc/skia/gdiimpl.hxx @@ -41,8 +41,6 @@ public: SkiaSalGraphicsImpl(SalGraphics& pParent, SalGeometryProvider* pProvider); virtual ~SkiaSalGraphicsImpl() override; - virtual void Init() override; - virtual void DeInit() override; virtual OUString getRenderBackendName() const override { return u"skia"_ustr; } diff --git a/vcl/inc/skia/x11/gdiimpl.hxx b/vcl/inc/skia/x11/gdiimpl.hxx index 835f565e9c36..990c3d60b64a 100644 --- a/vcl/inc/skia/x11/gdiimpl.hxx +++ b/vcl/inc/skia/x11/gdiimpl.hxx @@ -24,7 +24,7 @@ private: public: X11SkiaSalGraphicsImpl(X11SalGraphics& rParent); - virtual void Init() override; + virtual void UpdateX11GeometryProvider() override; virtual void Flush() override; static void prepareSkia(); diff --git a/vcl/quartz/AquaGraphicsBackend.cxx b/vcl/quartz/AquaGraphicsBackend.cxx index daf413165f8f..61a09efebc4f 100644 --- a/vcl/quartz/AquaGraphicsBackend.cxx +++ b/vcl/quartz/AquaGraphicsBackend.cxx @@ -196,8 +196,6 @@ AquaGraphicsBackend::AquaGraphicsBackend(AquaSharedAttributes& rShared) AquaGraphicsBackend::~AquaGraphicsBackend() {} -void AquaGraphicsBackend::Init() {} - void AquaGraphicsBackend::setClipRegion(vcl::Region const& rRegion) { // release old clip path diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index eaf0051bacea..938c640ca34a 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -301,8 +301,6 @@ SkiaSalGraphicsImpl::~SkiaSalGraphicsImpl() assert(!mWindowContext); } -void SkiaSalGraphicsImpl::Init() {} - void SkiaSalGraphicsImpl::createSurface() { SkiaZone zone; diff --git a/vcl/skia/osx/gdiimpl.cxx b/vcl/skia/osx/gdiimpl.cxx index 4874b056dad7..45216340492c 100644 --- a/vcl/skia/osx/gdiimpl.cxx +++ b/vcl/skia/osx/gdiimpl.cxx @@ -59,7 +59,6 @@ AquaSkiaSalGraphicsImpl::AquaSkiaSalGraphicsImpl(AquaSalGraphics& rParent, : SkiaSalGraphicsImpl(rParent, rShared.mpFrame) , AquaGraphicsBackendBase(rShared, this) { - Init(); // mac code doesn't call Init() } AquaSkiaSalGraphicsImpl::~AquaSkiaSalGraphicsImpl() diff --git a/vcl/skia/x11/gdiimpl.cxx b/vcl/skia/x11/gdiimpl.cxx index ffad26bd9b1f..34df45fa7d09 100644 --- a/vcl/skia/x11/gdiimpl.cxx +++ b/vcl/skia/x11/gdiimpl.cxx @@ -35,11 +35,10 @@ X11SkiaSalGraphicsImpl::X11SkiaSalGraphicsImpl(X11SalGraphics& rParent) { } -void X11SkiaSalGraphicsImpl::Init() +void X11SkiaSalGraphicsImpl::UpdateX11GeometryProvider() { // The m_pFrame and m_pVDev pointers are updated late in X11 setProvider(mX11Parent.GetGeometryProvider()); - SkiaSalGraphicsImpl::Init(); } void X11SkiaSalGraphicsImpl::createWindowSurfaceInternal(bool forceRaster) diff --git a/vcl/skia/x11/salvd.cxx b/vcl/skia/x11/salvd.cxx index 464793305896..8979f36d32b3 100644 --- a/vcl/skia/x11/salvd.cxx +++ b/vcl/skia/x11/salvd.cxx @@ -26,7 +26,7 @@ void X11SalGraphics::Init(X11SkiaSalVirtualDevice* pDevice) m_pVDev = pDevice; m_pFrame = nullptr; - mxImpl->Init(); + mxImpl->UpdateX11GeometryProvider(); } X11SkiaSalVirtualDevice::X11SkiaSalVirtualDevice(const SalGraphics& rGraphics, tools::Long nDX, diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx index 4ec2b453a622..c4cda27cd006 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx @@ -196,8 +196,6 @@ std::shared_ptr X11CairoSalGraphicsImpl::getBitmap(tools::Long nX, to return mrCairoCommon.getBitmap(nX, nY, nWidth, nHeight); } -void X11CairoSalGraphicsImpl::Init() {} - bool X11CairoSalGraphicsImpl::drawPolyLineBezier(sal_uInt32, const Point*, const PolyFlags*) { return false; diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx index 607809d1421f..f6a9b2e83ab0 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx @@ -33,8 +33,6 @@ private: public: X11CairoSalGraphicsImpl(X11SalGraphics& rParent, CairoCommon& rCairoCommon); - void Init() override; - OUString getRenderBackendName() const override { return u"gen"_ustr; } // get the depth of the device diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index e765919d6528..a9f0a3c0cbb8 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -143,7 +143,7 @@ void X11SalGraphics::Init( X11SalFrame& rFrame, Drawable aTarget, m_pVDev = nullptr; SetDrawable(aTarget, rFrame.GetSurface(), nXScreen); - mxImpl->Init(); + mxImpl->UpdateX11GeometryProvider(); } void X11SalGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) // const diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx index e0a9d33f6e87..33ba19c95d59 100644 --- a/vcl/unx/generic/gdi/salvd.cxx +++ b/vcl/unx/generic/gdi/salvd.cxx @@ -79,7 +79,7 @@ void X11SalGraphics::Init(X11SalVirtualDevice *pDevice, SalColormap* pColormap, m_pFrame = nullptr; SetDrawable(pDevice->GetDrawable(), pDevice->GetSurface(), m_nXScreen); - mxImpl->Init(); + mxImpl->UpdateX11GeometryProvider(); } X11SalVirtualDevice::X11SalVirtualDevice(const SalGraphics& rGraphics, tools::Long &nDX, tools::Long &nDY, diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index ca222660e458..7438f6a4ded7 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -235,10 +235,6 @@ WinSalGraphicsImpl::~WinSalGraphicsImpl() } } -void WinSalGraphicsImpl::Init() -{ -} - bool WinSalGraphicsImpl::drawEPS(tools::Long, tools::Long, tools::Long, tools::Long, void*, sal_uInt32) { return false; diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx index 15f1a20b5881..980454ebc303 100644 --- a/vcl/win/gdi/gdiimpl.hxx +++ b/vcl/win/gdi/gdiimpl.hxx @@ -66,8 +66,6 @@ public: virtual ~WinSalGraphicsImpl() override; - virtual void Init() override; - virtual OUString getRenderBackendName() const override { return "gdi"; } virtual void setClipRegion( const vcl::Region& ) override; diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx index 8da350105afd..1040810975c6 100644 --- a/vcl/win/gdi/salgdi.cxx +++ b/vcl/win/gdi/salgdi.cxx @@ -464,8 +464,6 @@ void WinSalGraphics::InitGraphics() ::SetTextAlign( getHDC(), TA_BASELINE | TA_LEFT | TA_NOUPDATECP ); ::SetBkMode( getHDC(), TRANSPARENT ); ::SetROP2( getHDC(), R2_COPYPEN ); - - mpImpl->Init(); } void WinSalGraphics::DeInitGraphics() diff --git a/vcl/win/gdi/salvd.cxx b/vcl/win/gdi/salvd.cxx index 7b3e7e11fc5c..2f6d3456a748 100644 --- a/vcl/win/gdi/salvd.cxx +++ b/vcl/win/gdi/salvd.cxx @@ -214,9 +214,6 @@ bool WinSalVirtualDevice::SetSize( tools::Long nDX, tools::Long nDY ) SelectBitmap(getHDC(), hNewBmp); mhBmp.reset(hNewBmp); - if (mpGraphics) - mpGraphics->GetImpl()->Init(); - return true; } -- cgit v1.2.3