From 1d9561f56c0e39aa54e3f23d509be98514ff2abc Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 24 Mar 2014 13:27:48 +0200 Subject: Fix a few problems in the iOS vcl code We don't need the headless SvpSalBitmap code after all on iOS, so bypass all of svpbmp.cxx for iOS. I accidentally had left duplicates for some AquaSalGraphics methods in headless/svpgdi.cxx in addition to the ones in quartz/salgdicommon.cxx. This is obviously bogus, the linker just picks the ones that come first in the archive. (Remember the ugly "#define SvpSalGraphics AquaSalGraphics" trick, so for instance SvpSalGraphics::setClipRegion actuall is AquaSalGraphics::setClipRegion.) It's the Quartz ones we want, as since the switch to tiled rendering the iOS vcl code is supposed to work much more like the OS X one. (There is still some significant refactoring to do there. Possibly no "headless" code needs to be used at all for iOS.) A couple of functions moved from salgdiutils.cxx (which isn't compiled for iOS) to salgdicommon.cxx. The SetState() function now gets used also on iOS, and to properly undo its CG context stacking I pop it in SetVirDevGraphics() when the virtual device is being destroyed. This fixed the rendering of some simple shapes that use overlapping and transparency, but not that of the "monster" SmartArts. Change-Id: I2bfaa4129e3641dbdd1dd240c1d07f9bdcfea1b8 --- vcl/headless/svpbmp.cxx | 4 ++++ vcl/headless/svpgdi.cxx | 49 ++++++++++++++++++------------------------------ vcl/headless/svpinst.cxx | 21 ++++++--------------- 3 files changed, 28 insertions(+), 46 deletions(-) (limited to 'vcl/headless') diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx index a310addb1ae0..03a8a90dc487 100644 --- a/vcl/headless/svpbmp.cxx +++ b/vcl/headless/svpbmp.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#ifndef IOS + #include "headless/svpbmp.hxx" #include @@ -390,4 +392,6 @@ sal_uInt32 SvpSalBitmap::getBitCountFromScanlineFormat( basebmp::Format nFormat return nBitCount; } +#endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 302a160cb85c..4ba8ca01b878 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -19,6 +19,7 @@ #include "headless/svpgdi.hxx" #include "headless/svpbmp.hxx" +#include "saldatabasic.hxx" #include #include @@ -143,11 +144,15 @@ void SvpSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) rDPIX = rDPIY = 96; } +#ifndef IOS + sal_uInt16 SvpSalGraphics::GetBitCount() const { return SvpSalBitmap::getBitCountFromScanlineFormat( m_aDevice->getScanlineFormat() ); } +#endif + long SvpSalGraphics::GetGraphicsWidth() const { if( m_aDevice.get() ) @@ -158,6 +163,8 @@ long SvpSalGraphics::GetGraphicsWidth() const return 0; } +#ifndef IOS + void SvpSalGraphics::ResetClipRegion() { m_aDevice = m_aOrigDevice; @@ -167,6 +174,8 @@ void SvpSalGraphics::ResetClipRegion() } +#endif + // verify clip for the whole area is setup void SvpSalGraphics::ensureClip() { @@ -275,6 +284,7 @@ bool SvpSalGraphics::isClippedSetup( const basegfx::B2IBox &aRange, SvpSalGraphi return false; } +#ifndef IOS // Clipping by creating unconditional mask bitmaps is horribly // slow so defer it, as much as possible. It is common to get @@ -289,10 +299,6 @@ bool SvpSalGraphics::isClippedSetup( const basegfx::B2IBox &aRange, SvpSalGraphi // bitmapdevice instead. bool SvpSalGraphics::setClipRegion( const Region& i_rClip ) { -#ifdef IOS - if (mbForeignContext) - return true; -#endif m_aClipRegion = i_rClip; m_aClipMap.reset(); if( i_rClip.IsEmpty() ) @@ -321,8 +327,6 @@ bool SvpSalGraphics::setClipRegion( const Region& i_rClip ) return true; } -#ifndef IOS - void SvpSalGraphics::SetLineColor() { m_bUseLineColor = false; @@ -701,6 +705,8 @@ SalColor SvpSalGraphics::getPixel( long nX, long nY ) return aColor.toInt32(); } +#ifndef IOS + void SvpSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInvert /*nFlags*/ ) { // FIXME: handle SAL_INVERT_50 and SAL_INVERT_TRACKFRAME @@ -727,6 +733,8 @@ void SvpSalGraphics::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInve dbgOut( m_aDevice ); } +#endif + bool SvpSalGraphics::drawEPS( long, long, long, long, void*, sal_uLong ) { return false; @@ -737,36 +745,16 @@ SystemGraphicsData SvpSalGraphics::GetGraphicsData() const return SystemGraphicsData(); } +#ifndef IOS + bool SvpSalGraphics::supportsOperation( OutDevSupportType ) const { return false; } -#ifdef IOS - -void SvpSalGraphics::SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContext, int /* nBitmapDepth */ ) -{ - SAL_INFO( "vcl.ios", "SetVirDevGraphics() this=" << this << " layer=" << xLayer << " context=" << xContext ); - - mxLayer = xLayer; - mrContext = xContext; - mbForeignContext = xContext != NULL; - - if( !mxLayer && !mrContext ) - return; +#endif - if( !mxLayer ) - { - mnWidth = CGBitmapContextGetWidth( mrContext ); - mnHeight = CGBitmapContextGetHeight( mrContext ); - } - else - { - const CGSize aSize = CGLayerGetSize( mxLayer ); - mnWidth = static_cast(aSize.width); - mnHeight = static_cast(aSize.height); - } -}; +#ifdef IOS void SvpSalGraphics::RefreshRect(float lX, float lY, float lWidth, float lHeight) { @@ -774,7 +762,6 @@ void SvpSalGraphics::RefreshRect(float lX, float lY, float lWidth, float lHeigh m_aDevice->getDamageTracker()->damaged(basegfx::B2IBox( basegfx::fround(lX), basegfx::fround(lY), basegfx::fround(lX + lWidth), basegfx::fround(lY + lHeight))); } - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index a88243992e45..aaf1592a3136 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -216,27 +216,16 @@ void SvpSalInstance::DestroyObject( SalObject* pObject ) delete pObject; } -SalVirtualDevice* SvpSalInstance::CreateVirtualDevice( SalGraphics* pGraphics, +#ifndef IOS + +SalVirtualDevice* SvpSalInstance::CreateVirtualDevice( SalGraphics* /* pGraphics */, long nDX, long nDY, sal_uInt16 nBitCount, - const SystemGraphicsData* pData ) + const SystemGraphicsData* /* pData */ ) { -#ifdef IOS - if( pData ) - return new AquaSalVirtualDevice( static_cast< AquaSalGraphics* >( pGraphics ), nDX, nDY, nBitCount, pData ); - else - { - AquaSalVirtualDevice* pNew = new AquaSalVirtualDevice( NULL, nDX, nDY, nBitCount, NULL ); - pNew->SetSize( nDX, nDY ); - return pNew; - } -#else - (void) pGraphics; - (void) pData; SvpSalVirtualDevice* pNew = new SvpSalVirtualDevice( nBitCount ); pNew->SetSize( nDX, nDY ); return pNew; -#endif } void SvpSalInstance::DestroyVirtualDevice( SalVirtualDevice* pDevice ) @@ -244,6 +233,8 @@ void SvpSalInstance::DestroyVirtualDevice( SalVirtualDevice* pDevice ) delete pDevice; } +#endif + SalTimer* SvpSalInstance::CreateSalTimer() { return new SvpSalTimer( this ); -- cgit