diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-03-12 10:06:42 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-03-12 16:24:38 +0100 |
commit | 19edde184077eca38ce369304980a8a42fb3ab52 (patch) | |
tree | 1a15b76d09c8da2d843c03015c6391cf61e8cca3 /include/canvas | |
parent | 970160f78ef6cc7abacfa252daa8451e1f0117bb (diff) |
Mark overriding BitmapCanvasBase class template member funs as SAL_OVERRIDE
...which reveals that SpriteCanvasBase is not derived from XBitmapCanvas, so
split up BitmapCanvasBase (just XBitmap) and BitmapCanvasBase2 (plus
XBitmapCanvas) and make IntegerBitmapBase directly abstract over those two as
arguments.
Change-Id: Ieae87fe466bb9f1a861c8a95162ef25235ae5799
Diffstat (limited to 'include/canvas')
-rw-r--r-- | include/canvas/base/bitmapcanvasbase.hxx | 69 | ||||
-rw-r--r-- | include/canvas/base/canvascustomspritebase.hxx | 4 | ||||
-rw-r--r-- | include/canvas/base/integerbitmapbase.hxx | 80 | ||||
-rw-r--r-- | include/canvas/base/spritecanvasbase.hxx | 4 |
4 files changed, 70 insertions, 87 deletions
diff --git a/include/canvas/base/bitmapcanvasbase.hxx b/include/canvas/base/bitmapcanvasbase.hxx index 307b78cf2078..37c38c2ad1e7 100644 --- a/include/canvas/base/bitmapcanvasbase.hxx +++ b/include/canvas/base/bitmapcanvasbase.hxx @@ -67,6 +67,41 @@ namespace canvas public: typedef CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType; + // XBitmap + virtual ::com::sun::star::geometry::IntegerSize2D SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE + { + typename BaseType::MutexType aGuard( BaseType::m_aMutex ); + + return BaseType::maCanvasHelper.getSize(); + } + + virtual ::sal_Bool SAL_CALL hasAlpha( ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE + { + typename BaseType::MutexType aGuard( BaseType::m_aMutex ); + + return BaseType::maCanvasHelper.hasAlpha(); + } + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > SAL_CALL getScaledBitmap( const ::com::sun::star::geometry::RealSize2D& newSize, + sal_Bool beFast ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE + { + typename BaseType::MutexType aGuard( BaseType::m_aMutex ); + + return BaseType::maCanvasHelper.getScaledBitmap( newSize, beFast ); + } + + }; + + template< class Base, + class CanvasHelper, + class Mutex=::osl::MutexGuard, + class UnambiguousBase=::com::sun::star::uno::XInterface > class BitmapCanvasBase2 : + public BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > + { + typedef BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > + BaseType; + + public: // XBitmapCanvas virtual void SAL_CALL copyRect( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas >& sourceCanvas, const ::com::sun::star::geometry::RealRectangle2D& sourceRect, @@ -75,19 +110,19 @@ namespace canvas const ::com::sun::star::geometry::RealRectangle2D& destRect, const ::com::sun::star::rendering::ViewState& destViewState, const ::com::sun::star::rendering::RenderState& destRenderState ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) + ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE { tools::verifyArgs(sourceCanvas, sourceRect, sourceViewState, sourceRenderState, destRect, destViewState, destRenderState, BOOST_CURRENT_FUNCTION, static_cast< typename BaseType::UnambiguousBaseType* >(this)); - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); + typename BaseType::BaseType::MutexType aGuard( BaseType::m_aMutex ); - BaseType::mbSurfaceDirty = true; - BaseType::maCanvasHelper.modifying(); + BaseType::BaseType::mbSurfaceDirty = true; + BaseType::BaseType::maCanvasHelper.modifying(); - BaseType::maCanvasHelper.copyRect( this, + BaseType::BaseType::maCanvasHelper.copyRect( this, sourceCanvas, sourceRect, sourceViewState, @@ -96,30 +131,6 @@ namespace canvas destViewState, destRenderState ); } - - // XBitmap - virtual ::com::sun::star::geometry::IntegerSize2D SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maCanvasHelper.getSize(); - } - - virtual ::sal_Bool SAL_CALL hasAlpha( ) throw (::com::sun::star::uno::RuntimeException) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maCanvasHelper.hasAlpha(); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > SAL_CALL getScaledBitmap( const ::com::sun::star::geometry::RealSize2D& newSize, - sal_Bool beFast ) throw (::com::sun::star::uno::RuntimeException) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maCanvasHelper.getScaledBitmap( newSize, beFast ); - } - }; } diff --git a/include/canvas/base/canvascustomspritebase.hxx b/include/canvas/base/canvascustomspritebase.hxx index b6f6ac0c6c62..b244e6424655 100644 --- a/include/canvas/base/canvascustomspritebase.hxx +++ b/include/canvas/base/canvascustomspritebase.hxx @@ -75,10 +75,10 @@ namespace canvas class CanvasHelper, class Mutex=::osl::MutexGuard, class UnambiguousBase=::com::sun::star::uno::XInterface > class CanvasCustomSpriteBase : - public IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase > + public IntegerBitmapBase< BitmapCanvasBase2<Base, CanvasHelper, Mutex, UnambiguousBase> > { public: - typedef IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType; + typedef IntegerBitmapBase< BitmapCanvasBase2<Base, CanvasHelper, Mutex, UnambiguousBase> > BaseType; typedef SpriteHelper SpriteHelperType; CanvasCustomSpriteBase() : diff --git a/include/canvas/base/integerbitmapbase.hxx b/include/canvas/base/integerbitmapbase.hxx index ee396c2429b8..79863d69a7d5 100644 --- a/include/canvas/base/integerbitmapbase.hxx +++ b/include/canvas/base/integerbitmapbase.hxx @@ -33,53 +33,25 @@ namespace canvas implementation. @tpl Base - Base class to use, most probably one of the - WeakComponentImplHelperN templates with the appropriate - interfaces. At least XIntegerBitmap should be among them (why - else would you use this template, then?). Base class must have - an Base( const Mutex& ) constructor (like the - WeakComponentImplHelperN templates have). - - @tpl CanvasHelper - Canvas helper implementation for the backend in question - - @tpl Mutex - Lock strategy to use. Defaults to using the - OBaseMutex-provided lock. Everytime one of the methods is - entered, an object of type Mutex is created with m_aMutex as - the sole parameter, and destroyed again when the method scope - is left. - - @tpl UnambiguousBase - Optional unambiguous base class for XInterface of Base. It's - sometimes necessary to specify this parameter, e.g. if Base - derives from multiple UNO interface (were each provides its - own version of XInterface, making the conversion ambiguous) - - @see CanvasBase for further contractual requirements towards - the CanvasHelper type, and some examples. + Either BitmapCanvasBase (just XBitmap) or BitmapCanvasBase2 (XBitmap and + XBitmapCanvas). */ - template< class Base, - class CanvasHelper, - class Mutex=::osl::MutexGuard, - class UnambiguousBase=::com::sun::star::uno::XInterface > class IntegerBitmapBase : - public BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > + template< class Base > class IntegerBitmapBase : + public Base { public: - typedef BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType; - // XIntegerBitmap virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getData( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, const ::com::sun::star::geometry::IntegerRectangle2D& rect ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException) { tools::verifyArgs(rect, BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - tools::verifyIndexRange(rect, BaseType::getSize() ); + static_cast< typename Base::UnambiguousBaseType* >(this)); + tools::verifyIndexRange(rect, Base::getSize() ); - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); + typename Base::MutexType aGuard( Base::m_aMutex ); - return BaseType::maCanvasHelper.getData( bitmapLayout, + return Base::maCanvasHelper.getData( bitmapLayout, rect ); } @@ -89,15 +61,15 @@ namespace canvas { tools::verifyArgs(bitmapLayout, rect, BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - tools::verifyIndexRange(rect, BaseType::getSize() ); + static_cast< typename Base::UnambiguousBaseType* >(this)); + tools::verifyIndexRange(rect, Base::getSize() ); - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); + typename Base::MutexType aGuard( Base::m_aMutex ); - BaseType::mbSurfaceDirty = true; - BaseType::maCanvasHelper.modifying(); + Base::mbSurfaceDirty = true; + Base::maCanvasHelper.modifying(); - BaseType::maCanvasHelper.setData( data, bitmapLayout, rect ); + Base::maCanvasHelper.setData( data, bitmapLayout, rect ); } virtual void SAL_CALL setPixel( const ::com::sun::star::uno::Sequence< sal_Int8 >& color, @@ -106,15 +78,15 @@ namespace canvas { tools::verifyArgs(bitmapLayout, pos, BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - tools::verifyIndexRange(pos, BaseType::getSize() ); + static_cast< typename Base::UnambiguousBaseType* >(this)); + tools::verifyIndexRange(pos, Base::getSize() ); - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); + typename Base::MutexType aGuard( Base::m_aMutex ); - BaseType::mbSurfaceDirty = true; - BaseType::maCanvasHelper.modifying(); + Base::mbSurfaceDirty = true; + Base::maCanvasHelper.modifying(); - BaseType::maCanvasHelper.setPixel( color, bitmapLayout, pos ); + Base::maCanvasHelper.setPixel( color, bitmapLayout, pos ); } virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getPixel( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, @@ -122,20 +94,20 @@ namespace canvas { tools::verifyArgs(pos, BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - tools::verifyIndexRange(pos, BaseType::getSize() ); + static_cast< typename Base::UnambiguousBaseType* >(this)); + tools::verifyIndexRange(pos, Base::getSize() ); - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); + typename Base::MutexType aGuard( Base::m_aMutex ); - return BaseType::maCanvasHelper.getPixel( bitmapLayout, + return Base::maCanvasHelper.getPixel( bitmapLayout, pos ); } virtual ::com::sun::star::rendering::IntegerBitmapLayout SAL_CALL getMemoryLayout( ) throw (::com::sun::star::uno::RuntimeException) { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); + typename Base::MutexType aGuard( Base::m_aMutex ); - return BaseType::maCanvasHelper.getMemoryLayout(); + return Base::maCanvasHelper.getMemoryLayout(); } }; } diff --git a/include/canvas/base/spritecanvasbase.hxx b/include/canvas/base/spritecanvasbase.hxx index f536a2383fda..60e20391fa7f 100644 --- a/include/canvas/base/spritecanvasbase.hxx +++ b/include/canvas/base/spritecanvasbase.hxx @@ -66,10 +66,10 @@ namespace canvas class CanvasHelper, class Mutex=::osl::MutexGuard, class UnambiguousBase=::com::sun::star::uno::XInterface > class SpriteCanvasBase : - public IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase > + public IntegerBitmapBase< BitmapCanvasBase<Base, CanvasHelper, Mutex, UnambiguousBase> > { public: - typedef IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType; + typedef IntegerBitmapBase< BitmapCanvasBase<Base, CanvasHelper, Mutex, UnambiguousBase> > BaseType; typedef ::rtl::Reference< SpriteCanvasBase > Reference; SpriteCanvasBase() : |