canvas/opengl: create instances with uno constructors
See tdf#74608 for motivation Change-Id: I2189622106e0c013567662c7bd81a057da65bf92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97935 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
9be078ae0d
commit
0e60923e83
@@ -11,7 +11,6 @@
|
|||||||
#include <sal/log.hxx>
|
#include <sal/log.hxx>
|
||||||
|
|
||||||
#include <com/sun/star/lang/NoSupportException.hpp>
|
#include <com/sun/star/lang/NoSupportException.hpp>
|
||||||
#include <comphelper/servicedecl.hxx>
|
|
||||||
#include <osl/mutex.hxx>
|
#include <osl/mutex.hxx>
|
||||||
#include <toolkit/helper/vclunohelper.hxx>
|
#include <toolkit/helper/vclunohelper.hxx>
|
||||||
#include <tools/diagnose_ex.h>
|
#include <tools/diagnose_ex.h>
|
||||||
@@ -19,14 +18,8 @@
|
|||||||
#include "ogl_canvascustomsprite.hxx"
|
#include "ogl_canvascustomsprite.hxx"
|
||||||
#include "ogl_spritecanvas.hxx"
|
#include "ogl_spritecanvas.hxx"
|
||||||
|
|
||||||
#define SPRITECANVAS_SERVICE_NAME "com.sun.star.rendering.SpriteCanvas.OGL"
|
|
||||||
#define SPRITECANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.SpriteCanvas.OGL"
|
|
||||||
|
|
||||||
|
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
|
|
||||||
namespace sdecl = comphelper::service_decl;
|
|
||||||
|
|
||||||
namespace oglcanvas
|
namespace oglcanvas
|
||||||
{
|
{
|
||||||
SpriteCanvas::SpriteCanvas( const uno::Sequence< uno::Any >& aArguments,
|
SpriteCanvas::SpriteCanvas( const uno::Sequence< uno::Any >& aArguments,
|
||||||
@@ -134,7 +127,7 @@ namespace oglcanvas
|
|||||||
|
|
||||||
OUString SAL_CALL SpriteCanvas::getServiceName( )
|
OUString SAL_CALL SpriteCanvas::getServiceName( )
|
||||||
{
|
{
|
||||||
return SPRITECANVAS_SERVICE_NAME;
|
return "com.sun.star.rendering.SpriteCanvas.OGL";
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteCanvas::show( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
|
void SpriteCanvas::show( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
|
||||||
@@ -154,26 +147,17 @@ namespace oglcanvas
|
|||||||
maCanvasHelper.renderRecordedActions();
|
maCanvasHelper.renderRecordedActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
static uno::Reference<uno::XInterface> initCanvas( SpriteCanvas* pCanvas )
|
|
||||||
{
|
|
||||||
uno::Reference<uno::XInterface> xRet(static_cast<cppu::OWeakObject*>(pCanvas));
|
|
||||||
pCanvas->initialize();
|
|
||||||
return xRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
sdecl::class_<SpriteCanvas, sdecl::with_args<true> > const serviceImpl(&initCanvas);
|
|
||||||
const sdecl::ServiceDecl oglSpriteCanvasDecl(
|
|
||||||
serviceImpl,
|
|
||||||
SPRITECANVAS_IMPLEMENTATION_NAME,
|
|
||||||
SPRITECANVAS_SERVICE_NAME );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The C shared lib entry points
|
|
||||||
extern "C"
|
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||||
SAL_DLLPUBLIC_EXPORT void* oglcanvas_component_getFactory( char const* pImplName,
|
com_sun_star_comp_rendering_SpriteCanvas_OGL_get_implementation(
|
||||||
void*, void* )
|
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args)
|
||||||
{
|
{
|
||||||
return sdecl::component_getFactoryHelper( pImplName, {&oglcanvas::oglSpriteCanvasDecl} );
|
auto p = new oglcanvas::SpriteCanvas(args, context);
|
||||||
|
cppu::acquire(p);
|
||||||
|
p->initialize();
|
||||||
|
return static_cast<cppu::OWeakObject*>(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -9,8 +9,9 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
|
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
|
||||||
prefix="oglcanvas" xmlns="http://openoffice.org/2010/uno-components">
|
xmlns="http://openoffice.org/2010/uno-components">
|
||||||
<implementation name="com.sun.star.comp.rendering.SpriteCanvas.OGL">
|
<implementation name="com.sun.star.comp.rendering.SpriteCanvas.OGL"
|
||||||
|
constructor="com_sun_star_comp_rendering_SpriteCanvas_OGL_get_implementation">
|
||||||
<service name="com.sun.star.rendering.SpriteCanvas.OGL"/>
|
<service name="com.sun.star.rendering.SpriteCanvas.OGL"/>
|
||||||
</implementation>
|
</implementation>
|
||||||
</component>
|
</component>
|
||||||
|
Reference in New Issue
Block a user