loplugin:unocast (cairocanvas::CanvasBitmap)

(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)

Change-Id: I6044567e4027fe1fdc361917d5233157d4ce98d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144399
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2022-12-18 17:19:58 +00:00
parent 51be46640a
commit 9a0b523e0a
3 changed files with 10 additions and 3 deletions
+7 -1
View File
@@ -144,7 +144,13 @@ namespace cairocanvas
}
sal_Int64 CanvasBitmap::getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) {
return RepaintTarget::getSomething(aIdentifier);
return comphelper::getSomethingImpl(
aIdentifier, this, comphelper::FallbackToGetSomethingOf<RepaintTarget>{});
}
css::uno::Sequence<sal_Int8> const & CanvasBitmap::getUnoTunnelId() {
static comphelper::UnoIdInit const id;
return id.getSeq();
}
OUString SAL_CALL CanvasBitmap::getImplementationName( )
+1 -1
View File
@@ -115,8 +115,8 @@ namespace cairocanvas
virtual css::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) override;
virtual void SAL_CALL setFastPropertyValue(sal_Int32, const css::uno::Any&) override {}
// XUnoTunnel
sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) override;
static css::uno::Sequence<sal_Int8> const & getUnoTunnelId();
private:
SurfaceProviderRef mpSurfaceProvider;
+2 -1
View File
@@ -40,6 +40,7 @@
#include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp>
#include <com/sun/star/util/Endianness.hpp>
#include <comphelper/sequence.hxx>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/implbase.hxx>
#include <rtl/math.hxx>
#include <comphelper/diagnose_ex.hxx>
@@ -294,7 +295,7 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas::
**/
static SurfaceSharedPtr surfaceFromXBitmap( const uno::Reference< rendering::XBitmap >& xBitmap )
{
CanvasBitmap* pBitmapImpl = dynamic_cast< CanvasBitmap* >( xBitmap.get() );
CanvasBitmap* pBitmapImpl = comphelper::getFromUnoTunnel< CanvasBitmap >( xBitmap );
if( pBitmapImpl )
return pBitmapImpl->getSurface();