diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-11-30 17:31:20 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-11-30 22:45:53 +0100 |
commit | 0ae1a8cd12187b1b7197782d30d91c6a0d56f608 (patch) | |
tree | da7dff0b09fd331e6e968fd378c1a907f6663cbe /vcl | |
parent | 9d7c622a9159ae17eb80bd4f0f9a865bd29deae1 (diff) |
Avoid a dynamic cross cast on macOS
...now causing
> In file included from vcl/osx/a11ytextattributeswrapper.mm:23:
> vcl/inc/quartz/salgdi.h:283:22: error: suspicious dynamic cross cast from 'AquaGraphicsBackendBase *' to 'SalGraphicsImpl *' [loplugin:crosscast]
> mpImpl = dynamic_cast<SalGraphicsImpl*>(this);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Change-Id: I0c9a4af0690c195c693f986e02284a48fe753a07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143505
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/quartz/salgdi.h | 10 | ||||
-rw-r--r-- | vcl/quartz/AquaGraphicsBackend.cxx | 2 | ||||
-rw-r--r-- | vcl/skia/osx/gdiimpl.cxx | 2 |
3 files changed, 6 insertions, 8 deletions
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 8a0fc4cfd3f0..61ff01c12e3a 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -272,15 +272,10 @@ struct AquaSharedAttributes class AquaGraphicsBackendBase { public: - AquaGraphicsBackendBase(AquaSharedAttributes& rShared) - : mrShared( rShared ) - {} virtual ~AquaGraphicsBackendBase() = 0; AquaSharedAttributes& GetShared() { return mrShared; } SalGraphicsImpl* GetImpl() { - if(mpImpl == nullptr) - mpImpl = dynamic_cast<SalGraphicsImpl*>(this); return mpImpl; } virtual void UpdateGeometryProvider(SalGeometryProvider*) {}; @@ -293,6 +288,9 @@ public: virtual void Flush() {} virtual void Flush( const tools::Rectangle& ) {} protected: + AquaGraphicsBackendBase(AquaSharedAttributes& rShared, SalGraphicsImpl * impl) + : mrShared( rShared ), mpImpl(impl) + {} static bool performDrawNativeControl(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, @@ -302,7 +300,7 @@ protected: AquaSalFrame* mpFrame); AquaSharedAttributes& mrShared; private: - SalGraphicsImpl* mpImpl = nullptr; + SalGraphicsImpl* mpImpl; }; inline AquaGraphicsBackendBase::~AquaGraphicsBackendBase() {} diff --git a/vcl/quartz/AquaGraphicsBackend.cxx b/vcl/quartz/AquaGraphicsBackend.cxx index aef2e3bb0f21..987ce5b784a5 100644 --- a/vcl/quartz/AquaGraphicsBackend.cxx +++ b/vcl/quartz/AquaGraphicsBackend.cxx @@ -190,7 +190,7 @@ void drawPattern50(void*, CGContextRef rContext) } AquaGraphicsBackend::AquaGraphicsBackend(AquaSharedAttributes& rShared) - : AquaGraphicsBackendBase(rShared) + : AquaGraphicsBackendBase(rShared, this) { } diff --git a/vcl/skia/osx/gdiimpl.cxx b/vcl/skia/osx/gdiimpl.cxx index 6d65eedd0ec4..38927e92c9ca 100644 --- a/vcl/skia/osx/gdiimpl.cxx +++ b/vcl/skia/osx/gdiimpl.cxx @@ -38,7 +38,7 @@ using namespace SkiaHelper; AquaSkiaSalGraphicsImpl::AquaSkiaSalGraphicsImpl(AquaSalGraphics& rParent, AquaSharedAttributes& rShared) : SkiaSalGraphicsImpl(rParent, rShared.mpFrame) - , AquaGraphicsBackendBase(rShared) + , AquaGraphicsBackendBase(rShared, this) { Init(); // mac code doesn't call Init() } |