diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-05-08 16:39:25 +0200 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-05-08 18:34:32 +0200 |
commit | 05c141bc3ab264c8e1f4fba57c4a82fa93e91261 (patch) | |
tree | 0e5dee5d9f261b675b79aa34e32ad32b20fbd61b /canvas | |
parent | 3a61db17545e0cee9eccaf02a3372068bb0768d4 (diff) |
DX canvas: provide a OutputDevice pointer as a device handler instead of HDC
With it all canvas can be handled on the same way.
avmedia/source/win/window.cxx: always comes a HWND
Change-Id: Id6b8e6d52b8a136143f724daf8feff5c85cf5804
Diffstat (limited to 'canvas')
-rw-r--r-- | canvas/source/directx/dx_canvas.cxx | 20 | ||||
-rw-r--r-- | canvas/source/directx/dx_devicehelper.cxx | 14 | ||||
-rw-r--r-- | canvas/source/directx/dx_devicehelper.hxx | 5 | ||||
-rw-r--r-- | canvas/source/directx/dx_spritedevicehelper.cxx | 3 |
4 files changed, 25 insertions, 17 deletions
diff --git a/canvas/source/directx/dx_canvas.cxx b/canvas/source/directx/dx_canvas.cxx index 6ad7ee10dbac..2c471eefe593 100644 --- a/canvas/source/directx/dx_canvas.cxx +++ b/canvas/source/directx/dx_canvas.cxx @@ -89,7 +89,7 @@ namespace dxcanvas // At index 2, we expect the current window bound rect ENSURE_ARG_OR_THROW( maArguments.getLength() >= 6 && maArguments[5].getValueTypeClass() == uno::TypeClass_SEQUENCE, - "SpriteCanvas::initialize: wrong number of arguments, or wrong types" ); + "Canvas::initialize: wrong number of arguments, or wrong types" ); uno::Sequence<sal_Int8> aSeq; maArguments[5] >>= aSeq; @@ -98,9 +98,13 @@ namespace dxcanvas if( !pSysData || !pSysData->hDC ) throw lang::NoSupportException("Passed SystemGraphicsData or HDC invalid!", NULL); + sal_Int64 nPtr = 0; + maArguments[0] >>= nPtr; + OutputDevice* pOutDev = reinterpret_cast<OutputDevice*>(nPtr); + ENSURE_ARG_OR_THROW( pOutDev != NULL,"Canvas::initialize: invalid OutDev pointer" ); + // setup helper - maDeviceHelper.init( pSysData->hDC, - *this ); + maDeviceHelper.init( pSysData->hDC, pOutDev, *this ); maCanvasHelper.setDevice( *this ); maCanvasHelper.setTarget( GraphicsProviderSharedPtr( @@ -146,7 +150,7 @@ namespace dxcanvas // At index 2, we expect the current window bound rect ENSURE_ARG_OR_THROW( maArguments.getLength() >= 6 && maArguments[5].getValueTypeClass() == uno::TypeClass_SEQUENCE, - "SpriteCanvas::initialize: wrong number of arguments, or wrong types" ); + "Canvas::initialize: wrong number of arguments, or wrong types" ); uno::Sequence<sal_Int8> aSeq; maArguments[5] >>= aSeq; @@ -155,9 +159,13 @@ namespace dxcanvas if( !pSysData || !pSysData->hDC ) throw lang::NoSupportException( "Passed SystemGraphicsData or HDC invalid!", NULL); + sal_Int64 nPtr = 0; + maArguments[0] >>= nPtr; + OutputDevice* pOutDev = reinterpret_cast<OutputDevice*>(nPtr); + ENSURE_ARG_OR_THROW( pOutDev != NULL,"Canvas::initialize: invalid OutDev pointer" ); + // setup helper - maDeviceHelper.init( pSysData->hDC, - *this ); + maDeviceHelper.init( pSysData->hDC, pOutDev, *this ); maCanvasHelper.setDevice( *this ); // check whether we can actually provide a BitmapCanvas diff --git a/canvas/source/directx/dx_devicehelper.cxx b/canvas/source/directx/dx_devicehelper.cxx index 673b9f426c9c..cd233994eb54 100644 --- a/canvas/source/directx/dx_devicehelper.cxx +++ b/canvas/source/directx/dx_devicehelper.cxx @@ -44,6 +44,7 @@ #include <vcl/sysdata.hxx> +#include <vcl/outdev.hxx> using namespace ::com::sun::star; @@ -51,15 +52,17 @@ namespace dxcanvas { DeviceHelper::DeviceHelper() : mpDevice( NULL ), - mnHDC(0) + mnHDC(0), + mpOutDev(0) { } - void DeviceHelper::init( HDC hdc, + void DeviceHelper::init( HDC hdc, OutputDevice* pOutDev, rendering::XGraphicDevice& rDevice ) { mnHDC = hdc; mpDevice = &rDevice; + mpOutDev = pOutDev; } void DeviceHelper::disposing() @@ -67,6 +70,7 @@ namespace dxcanvas // release all references mnHDC = 0; mpDevice = NULL; + mpOutDev = 0; } geometry::RealSize2D DeviceHelper::getPhysicalResolution() @@ -192,11 +196,7 @@ namespace dxcanvas uno::Any DeviceHelper::getDeviceHandle() const { - HDC hdc( getHDC() ); - if( hdc ) - return uno::makeAny( reinterpret_cast< sal_Int64 >(hdc) ); - else - return uno::Any(); + return uno::makeAny( reinterpret_cast< sal_Int64 >(mpOutDev) ); } uno::Any DeviceHelper::getSurfaceHandle() const diff --git a/canvas/source/directx/dx_devicehelper.hxx b/canvas/source/directx/dx_devicehelper.hxx index de3237bd466e..bb455c3cc916 100644 --- a/canvas/source/directx/dx_devicehelper.hxx +++ b/canvas/source/directx/dx_devicehelper.hxx @@ -31,7 +31,7 @@ #include <boost/utility.hpp> - +class OutputDevice; /* Definition of DeviceHelper class */ namespace dxcanvas @@ -50,7 +50,7 @@ namespace dxcanvas @param rDevice Ref back to owning UNO device */ - void init( HDC hdc, + void init( HDC hdc, OutputDevice* pOutputDev, com::sun::star::rendering::XGraphicDevice& rDevice ); /// Dispose all internal references @@ -105,6 +105,7 @@ namespace dxcanvas */ com::sun::star::rendering::XGraphicDevice* mpDevice; HDC mnHDC; + OutputDevice* mpOutDev; }; typedef ::rtl::Reference< com::sun::star::rendering::XGraphicDevice > DeviceRef; diff --git a/canvas/source/directx/dx_spritedevicehelper.cxx b/canvas/source/directx/dx_spritedevicehelper.cxx index a8f1db36671a..a101cf796cb8 100644 --- a/canvas/source/directx/dx_spritedevicehelper.cxx +++ b/canvas/source/directx/dx_spritedevicehelper.cxx @@ -99,8 +99,7 @@ namespace dxcanvas false)); // Assumes: SystemChildWindow() has CS_OWNDC - DeviceHelper::init(GetDC(mpRenderModule->getHWND()), - rSpriteCanvas); + DeviceHelper::init(GetDC(mpRenderModule->getHWND()),rWindow.GetOutDev(), rSpriteCanvas); } void SpriteDeviceHelper::disposing() |