diff options
-rw-r--r-- | avmedia/source/win/window.cxx | 11 | ||||
-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 | ||||
-rw-r--r-- | slideshow/source/engine/shapes/viewmediashape.cxx | 76 | ||||
-rw-r--r-- | slideshow/source/engine/shapes/viewmediashape.hxx | 5 |
7 files changed, 28 insertions, 106 deletions
diff --git a/avmedia/source/win/window.cxx b/avmedia/source/win/window.cxx index 3d5a7cc3e9a8..029ad40cfec0 100644 --- a/avmedia/source/win/window.cxx +++ b/avmedia/source/win/window.cxx @@ -303,17 +303,6 @@ bool Window::create( const uno::Sequence< uno::Any >& rArguments ) aRect.X, aRect.Y, aRect.Width, aRect.Height, (HWND) mnParentWnd, NULL, mpWndClass->hInstance, 0 ); - // if the last CreateWindow failed... - if( mnFrameWnd == 0 ) - { - // try again and this time assume that mnParent is indeed a dc - mnParentWnd = reinterpret_cast<int>(::WindowFromDC( (HDC)mnParentWnd )); - mnFrameWnd = (int) ::CreateWindow( mpWndClass->lpszClassName, NULL, - WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, - aRect.X, aRect.Y, aRect.Width, aRect.Height, - (HWND)mnParentWnd , NULL, mpWndClass->hInstance, 0 ); - } - if( mnFrameWnd ) { ::SetWindowLong( (HWND) mnFrameWnd, 0, (DWORD) this ); 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() diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx index 25226c1c802b..77b6443fb686 100644 --- a/slideshow/source/engine/shapes/viewmediashape.cxx +++ b/slideshow/source/engine/shapes/viewmediashape.cxx @@ -334,21 +334,7 @@ namespace slideshow if( ::canvas::tools::getDeviceInfo( xCanvas, aDeviceParams ).getLength() > 1 ) { - OUString aImplName; - - aDeviceParams[ 0 ] >>= aImplName; - - if( aImplName.endsWithIgnoreAsciiCase( "VCL" ) || - aImplName.endsWithIgnoreAsciiCase( "Cairo" ) || - avmedia::IsModel(sMimeType)) - { - implInitializeVCLBasedPlayerWindow( rBounds, aDeviceParams, sMimeType ); - } - else if( aImplName.endsWithIgnoreAsciiCase("DX") || - aImplName.endsWithIgnoreAsciiCase("DX9") ) - { - implInitializeDXBasedPlayerWindow( rBounds, aDeviceParams ); - } + implInitializePlayerWindow( rBounds, aDeviceParams, sMimeType ); } // set player properties @@ -444,7 +430,7 @@ namespace slideshow - bool ViewMediaShape::implInitializeVCLBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds, + bool ViewMediaShape::implInitializePlayerWindow( const ::basegfx::B2DRectangle& rBounds, const uno::Sequence< uno::Any >& rVCLDeviceParams, const OUString& rMimeType ) { @@ -536,64 +522,6 @@ namespace slideshow return mxPlayerWindow.is(); } - - - - bool ViewMediaShape::implInitializeDXBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds, - const uno::Sequence< uno::Any >& rDXDeviceParams ) - { - if( !mxPlayerWindow.is() ) - { - try - { - if( rDXDeviceParams.getLength() == 2 ) - { - sal_Int64 aWNDVal=0; - - rDXDeviceParams[ 1 ] >>= aWNDVal; - - if( aWNDVal ) - { - ::basegfx::B2DRange aTmpRange; - ::canvas::tools::calcTransformedRectBounds( aTmpRange, - rBounds, - mpViewLayer->getTransformation() ); - const ::basegfx::B2IRange& rRangePix( - ::basegfx::unotools::b2ISurroundingRangeFromB2DRange( aTmpRange )); - - if( !rRangePix.isEmpty() ) - { - uno::Sequence< uno::Any > aArgs( 2 ); - awt::Rectangle aAWTRect( rRangePix.getMinX() + maWindowOffset.X, - rRangePix.getMinY() + maWindowOffset.Y, - rRangePix.getMaxX() - rRangePix.getMinX(), - rRangePix.getMaxY() - rRangePix.getMinY() ); - - if( mxPlayer.is() ) - { - aArgs[ 0 ] = uno::makeAny( sal::static_int_cast< sal_Int32 >( aWNDVal) ); - aArgs[ 1 ] = uno::makeAny( aAWTRect ); - - mxPlayerWindow.set( mxPlayer->createPlayerWindow( aArgs ) ); - } - } - } - } - } - catch( uno::RuntimeException& ) - { - throw; - } - catch( uno::Exception& ) - { - OSL_FAIL( OUStringToOString( - comphelper::anyToString( cppu::getCaughtException() ), - RTL_TEXTENCODING_UTF8 ).getStr() ); - } - } - - return mxPlayerWindow.is(); - } } } diff --git a/slideshow/source/engine/shapes/viewmediashape.hxx b/slideshow/source/engine/shapes/viewmediashape.hxx index 4a373445aac9..609c36ef9366 100644 --- a/slideshow/source/engine/shapes/viewmediashape.hxx +++ b/slideshow/source/engine/shapes/viewmediashape.hxx @@ -141,12 +141,9 @@ namespace slideshow bool implInitialize( const ::basegfx::B2DRectangle& rBounds ); void implSetMediaProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rxProps ); void implInitializeMediaPlayer( const OUString& rMediaURL, const OUString& rMimeType ); - bool implInitializeVCLBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds, + bool implInitializePlayerWindow( const ::basegfx::B2DRectangle& rBounds, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rVCLDeviceParams, const OUString& rMimeType ); - bool implInitializeDXBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rDXDeviceParams ); - ViewLayerSharedPtr mpViewLayer; ::std::auto_ptr< SystemChildWindow > mpMediaWindow; mutable ::com::sun::star::awt::Point maWindowOffset; |