Kaydet (Commit) 19edde18 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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
üst 970160f7
......@@ -85,10 +85,12 @@ namespace cairocanvas
{
};
typedef ::canvas::IntegerBitmapBase< CanvasBaseSurfaceProvider_Base,
CanvasHelper,
::osl::MutexGuard,
::cppu::OWeakObject > CanvasBaseT;
typedef ::canvas::IntegerBitmapBase<
canvas::BitmapCanvasBase2<
CanvasBaseSurfaceProvider_Base,
CanvasHelper,
::osl::MutexGuard,
::cppu::OWeakObject> > CanvasBaseT;
/** Product of this component's factory.
......
......@@ -55,10 +55,11 @@ namespace cairocanvas
};
typedef ::canvas::IntegerBitmapBase<
CanvasBitmapSpriteSurface_Base,
CanvasHelper,
::osl::MutexGuard,
::cppu::OWeakObject > CanvasBitmap_Base;
canvas::BitmapCanvasBase2<
CanvasBitmapSpriteSurface_Base,
CanvasHelper,
::osl::MutexGuard,
::cppu::OWeakObject> > CanvasBitmap_Base;
class CanvasBitmap : public CanvasBitmap_Base,
public RepaintTarget
......
......@@ -115,10 +115,12 @@ namespace dxcanvas
DeviceHelper,
::osl::MutexGuard,
::cppu::OWeakObject > CanvasBase2_Base;
typedef ::canvas::IntegerBitmapBase< CanvasBase2_Base,
BitmapCanvasHelper,
::osl::MutexGuard,
::cppu::OWeakObject > BitmapCanvasBaseT;
typedef ::canvas::IntegerBitmapBase<
canvas::BitmapCanvasBase2<
CanvasBase2_Base,
BitmapCanvasHelper,
::osl::MutexGuard,
::cppu::OWeakObject> > BitmapCanvasBaseT;
/** Product of this component's factory.
......
......@@ -51,10 +51,12 @@ namespace dxcanvas
::com::sun::star::rendering::XIntegerBitmap,
::com::sun::star::lang::XServiceInfo,
::com::sun::star::beans::XFastPropertySet > CanvasBitmapBase_Base;
typedef ::canvas::IntegerBitmapBase< ::canvas::DisambiguationHelper< CanvasBitmapBase_Base >,
BitmapCanvasHelper,
::osl::MutexGuard,
::cppu::OWeakObject > CanvasBitmap_Base;
typedef ::canvas::IntegerBitmapBase<
canvas::BitmapCanvasBase2<
::canvas::DisambiguationHelper< CanvasBitmapBase_Base >,
BitmapCanvasHelper,
::osl::MutexGuard,
::cppu::OWeakObject> > CanvasBitmap_Base;
class CanvasBitmap : public CanvasBitmap_Base, public BitmapProvider
{
......
......@@ -32,10 +32,11 @@ namespace oglcanvas
typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XBitmapCanvas,
::com::sun::star::rendering::XIntegerBitmap > CanvasBitmapBase_Base;
typedef ::canvas::IntegerBitmapBase<
::canvas::DisambiguationHelper< CanvasBitmapBase_Base >,
BitmapCanvasHelper,
::osl::MutexGuard,
::cppu::OWeakObject > CanvasBitmapBaseT;
canvas::BitmapCanvasBase2<
::canvas::DisambiguationHelper< CanvasBitmapBase_Base >,
BitmapCanvasHelper,
::osl::MutexGuard,
::cppu::OWeakObject> > CanvasBitmapBaseT;
class CanvasBitmap : public CanvasBitmapBaseT
{
......
......@@ -59,10 +59,12 @@ namespace vclcanvas
DeviceHelper,
tools::LocalGuard,
::cppu::OWeakObject > CanvasBase_Base;
typedef ::canvas::IntegerBitmapBase< CanvasBase_Base,
CanvasHelper,
tools::LocalGuard,
::cppu::OWeakObject > CanvasBaseT;
typedef ::canvas::IntegerBitmapBase<
canvas::BitmapCanvasBase2<
CanvasBase_Base,
CanvasHelper,
tools::LocalGuard,
::cppu::OWeakObject> > CanvasBaseT;
/** Product of this component's factory.
......
......@@ -48,10 +48,12 @@ namespace vclcanvas
::com::sun::star::rendering::XIntegerBitmap,
::com::sun::star::lang::XServiceInfo,
::com::sun::star::beans::XFastPropertySet > CanvasBitmapBase_Base;
typedef ::canvas::IntegerBitmapBase< ::canvas::DisambiguationHelper< CanvasBitmapBase_Base >,
CanvasBitmapHelper,
tools::LocalGuard,
::cppu::OWeakObject > CanvasBitmap_Base;
typedef ::canvas::IntegerBitmapBase<
canvas::BitmapCanvasBase2<
::canvas::DisambiguationHelper< CanvasBitmapBase_Base >,
CanvasBitmapHelper,
tools::LocalGuard,
::cppu::OWeakObject> > CanvasBitmap_Base;
class CanvasBitmap : public CanvasBitmap_Base,
public RepaintTarget
......
......@@ -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 );
}
};
}
......
......@@ -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() :
......
......@@ -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();
}
};
}
......
......@@ -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() :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment