25#include <com/sun/star/awt/XTopWindow.hpp>
26#include <com/sun/star/awt/Rectangle.hpp>
27#include <com/sun/star/lang/NoSupportException.hpp>
28#include <osl/mutex.hxx>
35using namespace ::
cairo;
41 const uno::Reference< uno::XComponentContext >& ) :
46 void SpriteCanvas::initialize()
48 SAL_INFO(
"canvas.cairo",
"CairoSpriteCanvas created " <<
this);
51 if( !maArguments.hasElements() )
62 maArguments[0].getValueTypeClass() == uno::TypeClass_HYPER &&
63 maArguments[3].getValueTypeClass() == uno::TypeClass_INTERFACE,
64 "CairoSpriteCanvas::initialize: wrong number of arguments, or wrong types" );
67 maArguments[1] >>= aRect;
69 bool bIsFullscreen(
false );
70 maArguments[2] >>= bIsFullscreen;
72 uno::Reference< awt::XWindow > xParentWindow;
73 maArguments[3] >>= xParentWindow;
77 throw lang::NoSupportException(
78 "Parent window not VCL window, or canvas out-of-process!",
nullptr);
80 bool bHasCairo = pParentWindow->GetOutDev()->SupportsCairo();
82 "CairoSpriteCanvas::SpriteCanvas: No Cairo capability");
84 Size aPixelSize( pParentWindow->GetOutputSizePixel() );
85 const ::basegfx::B2ISize aSize( aPixelSize.
Width(),
89 maDeviceHelper.init( *pParentWindow,
94 setWindow(uno::Reference<awt::XWindow2>(xParentWindow, uno::UNO_QUERY_THROW));
96 maCanvasHelper.init( maRedrawManager,
100 maArguments.realloc(0);
103 void SpriteCanvas::disposeThis()
105 ::osl::MutexGuard aGuard(
m_aMutex );
108 SpriteCanvasBaseT::disposeThis();
113 return updateScreen( bUpdateAll );
118 return updateScreen( bUpdateAll );
123 ::osl::MutexGuard aGuard(
m_aMutex );
128 return mbIsVisible && maCanvasHelper.updateScreen(
129 ::basegfx::unotools::b2IRectangleFromAwtRectangle(
maBounds),
134 OUString SAL_CALL SpriteCanvas::getServiceName( )
136 return "com.sun.star.rendering.SpriteCanvas.Cairo";
140 sal_Bool SpriteCanvas::supportsService(
const OUString& sServiceName)
145 OUString SpriteCanvas::getImplementationName()
147 return "com.sun.star.comp.rendering.SpriteCanvas.Cairo";
149 css::uno::Sequence< OUString > SpriteCanvas::getSupportedServiceNames()
151 return { getServiceName() };
156 return maDeviceHelper.getBufferSurface();
159 SurfaceSharedPtr SpriteCanvas::createSurface( const ::basegfx::B2ISize& rSize,
int aContent )
161 return maDeviceHelper.createSurface( rSize, aContent );
170 return maDeviceHelper.createSurface(
aData, rSize );
184 return maDeviceHelper.getOutputDevice();
189 return maDeviceHelper.getBufferSurface();
194 return maDeviceHelper.getWindowSurface();
197 const ::basegfx::B2ISize& SpriteCanvas::getSizePixel()
const
199 return maDeviceHelper.getSizePixel();
202 void SpriteCanvas::setSizePixel( const ::basegfx::B2ISize& rSize )
204 maCanvasHelper.setSize( rSize );
206 maCanvasHelper.setSurface( maDeviceHelper.getBufferSurface(),
210 void SpriteCanvas::flush()
212 maDeviceHelper.flush();
216 const rendering::ViewState& viewState,
217 const rendering::RenderState& renderState )
219 return maCanvasHelper.repaint( pSurface, viewState, renderState );
223extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
225 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const& args)
229 return cppu::acquire(
p.get());
constexpr OUStringLiteral sServiceName
::basegfx::B2DRectangle maBounds
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_rendering_SpriteCanvas_Cairo_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &args)
Size GetSizePixel() const
bool GetSystemData(BitmapSystemData &rData) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
Product of this component's factory.
SpriteCanvas(const css::uno::Sequence< css::uno::Any > &aArguments, const css::uno::Reference< css::uno::XComponentContext > &rxContext)
#define ENSURE_ARG_OR_THROW(c, m)
Sequence< PropertyValue > aArguments
#define SAL_INFO(area, stream)
constexpr OUStringLiteral aData
std::shared_ptr< Surface > SurfaceSharedPtr
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)