diff options
-rw-r--r-- | vcl/headless/svpframe.cxx | 12 | ||||
-rw-r--r-- | vcl/inc/headless/svpframe.hxx | 10 | ||||
-rw-r--r-- | vcl/inc/ios/iosinst.hxx | 15 | ||||
-rw-r--r-- | vcl/ios/iosinst.cxx | 149 |
4 files changed, 19 insertions, 167 deletions
diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx index 8c214453cb38..932abba105b3 100644 --- a/vcl/headless/svpframe.cxx +++ b/vcl/headless/svpframe.cxx @@ -32,6 +32,8 @@ using namespace basegfx; SvpSalFrame* SvpSalFrame::s_pFocusFrame = NULL; +#ifndef IOS + namespace { /// Decouple SalFrame lifetime from damagetracker lifetime struct DamageTracker : public basebmp::IBitmapDeviceDamageTracker @@ -61,6 +63,8 @@ void SvpSalFrame::enableDamageTracker( bool bOn ) m_bDamageTracking = bOn; } +#endif + SvpSalFrame::SvpSalFrame( SvpSalInstance* pInstance, SalFrame* pParent, sal_uLong nSalFrameStyle, @@ -71,8 +75,10 @@ SvpSalFrame::SvpSalFrame( SvpSalInstance* pInstance, m_pParent( static_cast<SvpSalFrame*>(pParent) ), m_nStyle( nSalFrameStyle ), m_bVisible( false ), - m_bDamageTracking( false ), m_bTopDown( bTopDown ), +#ifndef IOS + m_bDamageTracking( false ), +#endif m_nScanlineFormat( nScanlineFormat ), m_nMinWidth( 0 ), m_nMinHeight( 0 ), @@ -281,6 +287,7 @@ void SvpSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_u if( m_nMinHeight > 0 && maGeometry.nHeight < (unsigned int)m_nMinHeight ) maGeometry.nHeight = m_nMinHeight; } +#ifndef IOS B2IVector aFrameSize( maGeometry.nWidth, maGeometry.nHeight ); if( ! m_aFrame.get() || m_aFrame->getSize() != aFrameSize ) { @@ -296,13 +303,12 @@ void SvpSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_u for( std::list< SvpSalGraphics* >::iterator it = m_aGraphics.begin(); it != m_aGraphics.end(); ++it ) { -#ifndef IOS (*it)->setDevice( m_aFrame ); -#endif } } if( m_bVisible ) m_pInstance->PostEvent( this, NULL, SALEVENT_RESIZE ); +#endif } void SvpSalFrame::GetClientSize( long& rWidth, long& rHeight ) diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx index 6a14adf6e1d2..1aec3aafae1f 100644 --- a/vcl/inc/headless/svpframe.hxx +++ b/vcl/inc/headless/svpframe.hxx @@ -43,8 +43,11 @@ class SvpSalFrame : public SalFrame std::list< SvpSalFrame* > m_aChildren; // List of child frames sal_uLong m_nStyle; bool m_bVisible; - bool m_bDamageTracking; bool m_bTopDown; +#ifndef IOS + basebmp::BitmapDeviceSharedPtr m_aFrame; + bool m_bDamageTracking; +#endif basebmp::Format m_nScanlineFormat; long m_nMinWidth; long m_nMinHeight; @@ -53,7 +56,6 @@ class SvpSalFrame : public SalFrame SystemEnvData m_aSystemChildData; - basebmp::BitmapDeviceSharedPtr m_aFrame; std::list< SvpSalGraphics* > m_aGraphics; static SvpSalFrame* s_pFocusFrame; @@ -71,7 +73,7 @@ public: void PostPaint(bool bImmediate) const; void AllocateFrame(); -#if defined IOS || defined ANDROID +#if defined ANDROID const basebmp::BitmapDeviceSharedPtr& getDevice() const { return m_aFrame; } #endif @@ -125,9 +127,11 @@ public: virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) SAL_OVERRIDE; virtual void EndSetClipRegion() SAL_OVERRIDE; +#ifndef IOS // If enabled we can get damage notifications for regions immediately rendered to ... virtual void enableDamageTracker( bool bOn = true ); virtual void damaged( const basegfx::B2IBox& /* rDamageRect */) {} +#endif /*TODO: functional implementation */ virtual void SetScreenNumber( unsigned int nScreen ) SAL_OVERRIDE { (void)nScreen; } diff --git a/vcl/inc/ios/iosinst.hxx b/vcl/inc/ios/iosinst.hxx index a91b6fc98b4f..e165f139f72c 100644 --- a/vcl/inc/ios/iosinst.hxx +++ b/vcl/inc/ios/iosinst.hxx @@ -20,8 +20,6 @@ #ifndef INCLUDED_VCL_INC_IOS_IOSINST_HXX #define INCLUDED_VCL_INC_IOS_IOSINST_HXX -#include <pthread.h> - #include <premac.h> #include <CoreGraphics/CoreGraphics.h> #include <postmac.h> @@ -47,17 +45,7 @@ public: SalFrame *getFocusFrame() const; - void damaged( IosSalFrame *frame, - const basegfx::B2IBox& rDamageRect); - // Functions scheduled to be run as "user events" in the LO thread - typedef struct { - bool done; - CGContextRef context; - CGRect rect; - } RenderWindowsArg; - DECL_LINK( RenderWindows, RenderWindowsArg* ); - DECL_LINK( DisplayConfigurationChanged, void* ); typedef struct { @@ -71,9 +59,6 @@ public: int x, y; } SelectionEndMoveArg; DECL_LINK( SelectionEndMove, SelectionEndMoveArg* ); - - pthread_mutex_t m_aRenderMutex; - pthread_cond_t m_aRenderCond; }; #endif // INCLUDED_VCL_INC_IOS_IOSINST_HXX diff --git a/vcl/ios/iosinst.cxx b/vcl/ios/iosinst.cxx index b4fa76a7a5f9..db7fb0fa889d 100644 --- a/vcl/ios/iosinst.cxx +++ b/vcl/ios/iosinst.cxx @@ -43,12 +43,6 @@ public: virtual bool ErrorTrapPop( bool ) { return false; } }; -void IosSalInstance::damaged( IosSalFrame */* frame */, - const basegfx::B2IBox& rDamageRect ) -{ - touch_ui_damaged( rDamageRect.getMinX(), rDamageRect.getMinY(), rDamageRect.getWidth(), rDamageRect.getHeight() ); -} - void IosSalInstance::GetWorkArea( Rectangle& rRect ) { rRect = Rectangle( Point( 0, 0 ), @@ -90,32 +84,10 @@ IosSalInstance *IosSalInstance::getInstance() IosSalInstance::IosSalInstance( SalYieldMutex *pMutex ) : SvpSalInstance( pMutex ) { - int rc; - - rc = pthread_cond_init( &m_aRenderCond, NULL ); - SAL_WARN_IF( rc != 0, "vcl.ios", "pthread_cond_init failed: " << strerror( rc ) ); - -#if OSL_DEBUG_LEVEL > 0 - pthread_mutexattr_t mutexattr; - - rc = pthread_mutexattr_init( &mutexattr ); - SAL_WARN_IF( rc != 0, "vcl.ios", "pthread_mutexattr_init failed: " << strerror( rc ) ); - - rc = pthread_mutexattr_settype( &mutexattr, PTHREAD_MUTEX_ERRORCHECK ); - SAL_WARN_IF( rc != 0, "vcl.ios", "pthread_mutexattr_settype failed: " << strerror( rc ) ); - - rc = pthread_mutex_init( &m_aRenderMutex, &mutexattr ); - SAL_WARN_IF( rc != 0, "vcl.ios", "pthread_mutex_init failed: " << strerror( rc ) ); -#else - rc = pthread_mutex_init( &m_aRenderMutex, NULL ); - SAL_WARN_IF( rc != 0, "vcl.ios", "pthread_mutex_init failed: " << strerror( rc ) ); -#endif } IosSalInstance::~IosSalInstance() { - pthread_cond_destroy( &m_aRenderCond ); - pthread_mutex_destroy( &m_aRenderMutex ); } #if 0 @@ -149,9 +121,6 @@ SalSystem *IosSalInstance::CreateSalSystem() class IosSalFrame : public SvpSalFrame { -private: - basegfx::B2IBox m_DamagedRect; - public: IosSalFrame( IosSalInstance *pInstance, SalFrame *pParent, @@ -161,31 +130,22 @@ public: true, basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA, pSysParent ) { - enableDamageTracker(); if (pParent == NULL && viewWidth > 1 && viewHeight > 1) SetPosSize(0, 0, viewWidth, viewHeight, SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT); } - virtual void GetWorkArea( Rectangle& rRect ) + virtual void GetWorkArea( Rectangle& rRect ) SAL_OVERRIDE { IosSalInstance::getInstance()->GetWorkArea( rRect ); } - void ShowFullScreen( bool, sal_Int32 ) + virtual void ShowFullScreen( bool, sal_Int32 ) SAL_OVERRIDE { SetPosSize( 0, 0, viewWidth, viewHeight, SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT ); } - virtual void damaged( const basegfx::B2IBox& rDamageRect ) - { - if (rDamageRect.isEmpty()) - return; - - m_DamagedRect.expand(rDamageRect); - } - - virtual void UpdateSettings( AllSettings &rSettings ) + virtual void UpdateSettings( AllSettings &rSettings ) SAL_OVERRIDE { // Clobber the UI fonts Font aFont( OUString( "Helvetica" ), Size( 0, 14 ) ); @@ -205,16 +165,6 @@ public: rSettings.SetStyleSettings( aStyleSet ); } - - virtual void Flush() - { - IosSalInstance::getInstance()->damaged( this, m_DamagedRect ); - } - - void resetDamaged() - { - m_DamagedRect.reset(); - } }; SalFrame *IosSalInstance::CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ) @@ -308,7 +258,6 @@ IMPL_LINK( IosSalInstance, DisplayConfigurationChanged, void*, ) (*it)->Show( true, false ); } - touch_ui_damaged( 0, 0, viewWidth, viewHeight ); return 0; } @@ -332,69 +281,6 @@ void touch_lo_set_view_size(int width, int height) } } -IMPL_LINK( IosSalInstance, RenderWindows, RenderWindowsArg*, arg ) -{ - int rc; - - rc = pthread_mutex_lock( &m_aRenderMutex ); - SAL_WARN_IF( rc != 0, "vcl.ios", "pthread_mutex_lock failed: " << strerror( rc ) ); - - CGRect invalidRect = arg->rect; - - for( std::list< SalFrame* >::const_reverse_iterator it = getFrames().rbegin(); - it != getFrames().rend(); - ++it ) { - IosSalFrame *pFrame = static_cast<IosSalFrame *>(*it); - SalFrameGeometry aGeom = pFrame->GetGeometry(); - CGRect bbox = CGRectMake( 0, 0, aGeom.nWidth, aGeom.nHeight ); - if ( pFrame->IsVisible() && - CGRectIntersectsRect( invalidRect, bbox ) ) { - - const basebmp::BitmapDeviceSharedPtr aDevice = pFrame->getDevice(); - touch_lo_copy_buffer(aDevice->getBuffer().get(), - aDevice->getSize().getX(), - aDevice->getSize().getY(), - aDevice->getScanlineStride(), - arg->context, - aGeom.nWidth, - aGeom.nHeight); - /*CGDataProviderRef provider = - CGDataProviderCreateWithData( NULL, - aDevice->getBuffer().get(), - aDevice->getSize().getY() * aDevice->getScanlineStride(), - NULL ); - CGImage *image = - CGImageCreate( aDevice->getSize().getX(), aDevice->getSize().getY(), - 8, 32, aDevice->getScanlineStride(), - CGColorSpaceCreateDeviceRGB(), - kCGImageAlphaNoneSkipLast, - provider, - NULL, - false, - kCGRenderingIntentDefault ); - CGContextDrawImage( arg->context, bbox, image ); - */ - // if current frame covers the whole invalidRect then break - if (CGRectEqualToRect(CGRectIntersection(invalidRect, bbox), invalidRect)) - { - break; - } - - pFrame->resetDamaged(); - } - } - - arg->done = true; - - rc = pthread_cond_signal( &m_aRenderCond ); - SAL_WARN_IF( rc != 0, "vcl.ios", "pthread_cond_signal failed:" << strerror( rc ) ); - - rc = pthread_mutex_unlock( &m_aRenderMutex ); - SAL_WARN_IF( rc != 0, "vcl.ios", "pthread_mutex_unlock failed: " << strerror( rc ) ); - - return 0; -} - extern "C" void touch_lo_copy_buffer(const void * source, size_t sourceWidth, size_t sourceHeight, size_t sourceBytesPerRow, void * target, size_t targetWidth, size_t targetHeight){ @@ -422,35 +308,6 @@ touch_lo_copy_buffer(const void * source, size_t sourceWidth, size_t sourceHeigh } extern "C" -void touch_lo_render_windows(void *context, int minX, int minY, int width, int height) -{ - CGContextRef cgContext = (CGContextRef) context; - int rc; - IosSalInstance *pInstance = IosSalInstance::getInstance(); - - if ( pInstance == NULL ) - return; - - rc = pthread_mutex_lock( &pInstance->m_aRenderMutex ); - if (rc != 0) { - SAL_WARN( "vcl.ios", "pthread_mutex_lock failed: " << strerror( rc ) ); - return; - } - - CGRect rect = CGRectMake(minX, minY, width, height); - IosSalInstance::RenderWindowsArg arg = { false, cgContext, rect }; - Application::PostUserEvent( LINK( pInstance, IosSalInstance, RenderWindows), &arg ); - - while (!arg.done) { - rc = pthread_cond_wait( &pInstance->m_aRenderCond, &pInstance->m_aRenderMutex ); - SAL_WARN_IF( rc != 0, "vcl.ios", "pthread_cond_wait failed: " << strerror( rc ) ); - } - - rc = pthread_mutex_unlock( &pInstance->m_aRenderMutex ); - SAL_WARN_IF( rc != 0, "vcl.ios", "pthread_mutex_unlock failed: " << strerror( rc ) ); -} - -extern "C" void touch_lo_tap(int x, int y) { touch_lo_mouse(x, y, DOWN, NONE); |