diff options
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() : |