27#include <com/sun/star/lang/NoSupportException.hpp>
28#include <com/sun/star/lang/XSingleServiceFactory.hpp>
29#include <com/sun/star/registry/XRegistryKey.hpp>
30#include <com/sun/star/uno/XComponentContext.hpp>
32#include <osl/mutex.hxx>
47 const uno::Reference< uno::XComponentContext >& rxContext ) :
53 void SpriteCanvas::initialize()
56 if( maArguments.getLength() == 0 )
59 SAL_INFO(
"canvas.directx",
"SpriteCanvas::initialize called" );
70 maArguments[3].getValueTypeClass() == uno::TypeClass_INTERFACE,
71 "VCLSpriteCanvas::initialize: wrong number of arguments, or wrong types" );
73 uno::Reference< awt::XWindow > xParentWindow;
74 maArguments[3] >>= xParentWindow;
77 throw lang::NoSupportException(
"Parent window not VCL window, or canvas out-of-process!" );
80 maArguments[1] >>= aRect;
82 bool bIsFullscreen(
false );
83 maArguments[2] >>= bIsFullscreen;
86 maDeviceHelper.init( *pParentWindow,
90 maCanvasHelper.init( *
this,
92 maDeviceHelper.getRenderModule(),
93 maDeviceHelper.getSurfaceProxy(),
94 maDeviceHelper.getBackBuffer(),
96 maArguments.realloc(0);
99 void SpriteCanvas::disposeThis()
101 ::osl::MutexGuard aGuard(
m_aMutex );
106 SpriteCanvasBaseT::disposeThis();
111 ::osl::MutexGuard aGuard(
m_aMutex );
116 return mbIsVisible && SpriteCanvasBaseT::showBuffer( bUpdateAll );
121 ::osl::MutexGuard aGuard(
m_aMutex );
126 return mbIsVisible && SpriteCanvasBaseT::switchBuffer( bUpdateAll );
131 ::osl::MutexGuard aGuard(
m_aMutex );
136 return mbIsVisible && maCanvasHelper.updateScreen(
137 ::basegfx::unotools::b2IRectangleFromAwtRectangle(
maBounds),
142 OUString SAL_CALL SpriteCanvas::getServiceName( )
144 return "com.sun.star.rendering.SpriteCanvas.DX9";
148 css::uno::Sequence<OUString> SpriteCanvas::getSupportedServiceNames( )
150 return {
"com.sun.star.rendering.SpriteCanvas.DX9" };
152 OUString SpriteCanvas::getImplementationName( )
154 return "com.sun.star.comp.rendering.SpriteCanvas.DX9";
156 sal_Bool SpriteCanvas::supportsService(
const OUString& sServiceName )
163 ::osl::MutexGuard aGuard(
m_aMutex );
165 return maDeviceHelper.getRenderModule();
170 ::osl::MutexGuard aGuard(
m_aMutex );
172 return maDeviceHelper.getBackBuffer();
177 return maDeviceHelper.getBackBuffer();
180 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
182 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const& args)
185 xCanvas->initialize();
186 return cppu::acquire(xCanvas.get());
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
constexpr OUStringLiteral sServiceName
::basegfx::B2DRectangle maBounds
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)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::shared_ptr< IBitmap > IBitmapSharedPtr
std::shared_ptr< DXSurfaceBitmap > DXSurfaceBitmapSharedPtr
std::shared_ptr< IDXRenderModule > IDXRenderModuleSharedPtr
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * canvas_directx9_SpriteCanvas_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &args)