diff options
author | Tor Lillqvist <tlillqvist@suse.com> | 2012-06-11 20:02:11 +0300 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@suse.com> | 2012-06-12 13:50:49 +0300 |
commit | 96c4aeedb04bfb1438b69875951fc132142cb0d3 (patch) | |
tree | e78113f60d5c449ea6084c556e653d71b23e7fa6 /toolkit | |
parent | 56595dab6424db6d69f81bfa551118140c5b66ac (diff) |
Implement XToolkit2::createScreenCompatibleDeviceUsingBuffer for Android
Change-Id: I8dd16850a35cd2de7260dcbe9a8aa7afae2294be
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/inc/toolkit/awt/vclxtoolkit.hxx | 11 | ||||
-rw-r--r-- | toolkit/source/awt/vclxtoolkit.cxx | 22 |
2 files changed, 28 insertions, 5 deletions
diff --git a/toolkit/inc/toolkit/awt/vclxtoolkit.hxx b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx index e706d9cc4a81..dc085b810536 100644 --- a/toolkit/inc/toolkit/awt/vclxtoolkit.hxx +++ b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx @@ -31,7 +31,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/awt/XSystemChildFactory.hpp> -#include <com/sun/star/awt/XToolkit.hpp> +#include <com/sun/star/awt/XToolkit2.hpp> #include <com/sun/star/awt/XDataTransferProviderAccess.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/awt/XExtendedToolkit.hpp> @@ -80,7 +80,7 @@ protected: class VCLXToolkit : public VCLXToolkit_Impl, public cppu::WeakComponentImplHelper7< - ::com::sun::star::awt::XToolkit, + ::com::sun::star::awt::XToolkit2, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::awt::XSystemChildFactory, ::com::sun::star::awt::XMessageBoxFactory, @@ -128,12 +128,17 @@ public: VCLXToolkit( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & ); ~VCLXToolkit(); + // ::com::sun::star::awt::XToolkit2 + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createScreenCompatibleDeviceUsingBuffer( sal_Int32 Width, sal_Int32 Height, sal_Int64 addressOfMemoryBufferForSharedArrayWrapper ) throw +(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::XToolkit ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getDesktopWindow( ) throw(::com::sun::star::uno::RuntimeException); ::com::sun::star::awt::Rectangle SAL_CALL getWorkArea( ) throw(::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL createWindow( const ::com::sun::star::awt::WindowDescriptor& Descriptor ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > > SAL_CALL createWindows( const ::com::sun::star::uno::Sequence< ::com::sun::star::awt::WindowDescriptor >& Descriptors ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createScreenCompatibleDevice( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createScreenCompatibleDevice( sal_Int32 Width, sal_Int32 Height ) throw +(::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion > SAL_CALL createRegion( ) throw(::com::sun::star::uno::RuntimeException); // ::com::sun::star::awt::XSystemChildFactory diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 7f775fb3dac2..c799393daac7 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -63,6 +63,11 @@ #include "postmac.h" #endif +#ifdef ANDROID +#include <sal/ByteBufferWrapper.hxx> +using org::libreoffice::touch::ByteBufferWrapper; +#endif + #ifdef IOS #include "premac.h" #include <UIKit/UIKit.h> @@ -468,7 +473,7 @@ static void SAL_CALL ToolkitWorkerFunction( void* pArgs ) // contructor, which might initialize VCL VCLXToolkit::VCLXToolkit( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ): cppu::WeakComponentImplHelper7< - ::com::sun::star::awt::XToolkit, + ::com::sun::star::awt::XToolkit2, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::awt::XSystemChildFactory, ::com::sun::star::awt::XMessageBoxFactory, @@ -562,6 +567,11 @@ void SAL_CALL VCLXToolkit::disposing() ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXToolkit::createScreenCompatibleDevice( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException) { + return createScreenCompatibleDeviceUsingBuffer( Width, Height, 0 ); +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXToolkit::createScreenCompatibleDeviceUsingBuffer( sal_Int32 Width, sal_Int32 Height, sal_Int64 addressOfMemoryBufferForSharedArrayWrapper ) throw(::com::sun::star::uno::RuntimeException) +{ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > xRef; @@ -570,7 +580,15 @@ void SAL_CALL VCLXToolkit::disposing() SolarMutexGuard aSolarGuard; VirtualDevice* pV = new VirtualDevice; - pV->SetOutputSizePixel( Size( Width, Height ) ); + if ( addressOfMemoryBufferForSharedArrayWrapper != 0 ) { +#if defined(ANDROID) + ByteBufferWrapper *bbw = (ByteBufferWrapper *) (intptr_t) addressOfMemoryBufferForSharedArrayWrapper; + pV->SetOutputSizePixelAndBuffer( Size( Width, Height ), basebmp::RawMemorySharedArray( bbw->pointer(), *bbw )); + OSL_FAIL( "rendering to a pre-allocated buffer not done yet for this OS" ); +#endif + } else { + pV->SetOutputSizePixel( Size( Width, Height ) ); + } pVDev->SetVirtualDevice( pV ); xRef = pVDev; |