diff options
-rw-r--r-- | vcl/headless/svpbmp.cxx | 4 | ||||
-rw-r--r-- | vcl/headless/svpgdi.cxx | 49 | ||||
-rw-r--r-- | vcl/headless/svpinst.cxx | 21 | ||||
-rw-r--r-- | vcl/quartz/salgdicommon.cxx | 116 | ||||
-rw-r--r-- | vcl/quartz/salgdiutils.cxx | 88 | ||||
-rw-r--r-- | vcl/quartz/salvd.cxx | 6 |
6 files changed, 149 insertions, 135 deletions
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 <basegfx/vector/b2ivector.hxx> @@ -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 <vcl/sysdata.hxx> #include <basegfx/range/b2drange.hxx> @@ -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<int>(aSize.width); - mnHeight = static_cast<int>(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 ); diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index 7c81f73719ee..335b12ad31bc 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -787,6 +787,12 @@ bool AquaSalGraphics::drawPolyLine( { return false; } +#ifdef IOS + if( !CheckContext() ) + { + return false; + } +#endif // #i101491# Aqua does not support B2DLINEJOIN_NONE; return false to use // the fallback (own geometry preparation) // #i104886# linejoin-mode and thus the above only applies to "fat" lines @@ -1393,6 +1399,20 @@ void AquaSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalIn } } +CGPoint* AquaSalGraphics::makeCGptArray(sal_uInt32 nPoints, const SalPoint* pPtAry) +{ + CGPoint *CGpoints = new CGPoint[nPoints]; + if ( CGpoints ) + { + for(sal_uLong i=0;i<nPoints;i++) + { + CGpoints[i].x = pPtAry[i].mnX; + CGpoints[i].y = pPtAry[i].mnY; + } + } + return CGpoints; +} + void AquaSalGraphics::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nSalFlags ) { CGPoint* CGpoints ; @@ -1458,6 +1478,27 @@ void AquaSalGraphics::ResetClipRegion() } } +void AquaSalGraphics::SetState() +{ + CGContextRestoreGState( mrContext ); + CGContextSaveGState( mrContext ); + + // setup clipping + if( mxClipPath ) + { + CGContextBeginPath( mrContext ); // discard any existing path + CGContextAddPath( mrContext, mxClipPath ); // set the current path to the clipping path + CGContextClip( mrContext ); // use it for clipping + } + + // set RGB colorspace and line and fill colors + CGContextSetFillColor( mrContext, maFillColor.AsArray() ); + CGContextSetStrokeColor( mrContext, maLineColor.AsArray() ); + CGContextSetShouldAntialias( mrContext, false ); + if( mnXorMode == 2 ) + CGContextSetBlendMode( mrContext, kCGBlendModeDifference ); +} + void AquaSalGraphics::SetLineColor() { maLineColor.SetAlpha( 0.0 ); // transparent @@ -1515,6 +1556,11 @@ bool AquaSalGraphics::supportsOperation( OutDevSupportType eType ) const bool AquaSalGraphics::setClipRegion( const Region& i_rClip ) { +#ifdef IOS + if (mbForeignContext) + return true; +#endif + // release old clip path if( mxClipPath ) { @@ -1802,4 +1848,74 @@ bool XorEmulation::UpdateTarget() return true; } +void AquaSalGraphics::SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContext, + int nBitmapDepth ) +{ + SAL_INFO( "vcl.ios", "SetVirDevGraphics() this=" << this << " layer=" << xLayer << " context=" << xContext ); + +#ifndef IOS + mbWindow = false; + mbPrinter = false; + mbVirDev = true; +#endif + +#ifdef IOS + (void) nBitmapDepth; + + if( !xContext ) + { + // We will return early a few lines lower. + // Undo the "stack initialization" done at the initial call of + // this method, see end. + CGContextRestoreGState( mrContext ); + } +#endif + + // set graphics properties + mxLayer = xLayer; + mrContext = xContext; + +#ifndef IOS + mnBitmapDepth = nBitmapDepth; +#endif + +#ifdef IOS + mbForeignContext = xContext != NULL; +#endif + + // return early if the virdev is being destroyed + if( !xContext ) + return; + + // get new graphics properties + if( !mxLayer ) + { + mnWidth = CGBitmapContextGetWidth( mrContext ); + mnHeight = CGBitmapContextGetHeight( mrContext ); + } + else + { + const CGSize aSize = CGLayerGetSize( mxLayer ); + mnWidth = static_cast<int>(aSize.width); + mnHeight = static_cast<int>(aSize.height); + } + + // prepare graphics for drawing + const CGColorSpaceRef aCGColorSpace = GetSalData()->mxRGBSpace; + CGContextSetFillColorSpace( mrContext, aCGColorSpace ); + CGContextSetStrokeColorSpace( mrContext, aCGColorSpace ); + + // re-enable XorEmulation for the new context + if( mpXorEmulation ) + { + mpXorEmulation->SetTarget( mnWidth, mnHeight, mnBitmapDepth, mrContext, mxLayer ); + if( mpXorEmulation->IsEnabled() ) + mrContext = mpXorEmulation->GetMaskContext(); + } + + // initialize stack of CGContext states + CGContextSaveGState( mrContext ); + SetState(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/quartz/salgdiutils.cxx b/vcl/quartz/salgdiutils.cxx index 50792ed81cbc..229c3437d80c 100644 --- a/vcl/quartz/salgdiutils.cxx +++ b/vcl/quartz/salgdiutils.cxx @@ -70,55 +70,6 @@ void AquaSalGraphics::SetPrinterGraphics( CGContextRef xContext, long nDPIX, lon } } -void AquaSalGraphics::SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContext, - int nBitmapDepth ) -{ - mbWindow = false; - mbPrinter = false; - mbVirDev = true; - - // set graphics properties - mxLayer = xLayer; - mrContext = xContext; - mnBitmapDepth = nBitmapDepth; - - // return early if the virdev is being destroyed - if( !xContext ) - return; - - // get new graphics properties - if( !mxLayer ) - { - mnWidth = CGBitmapContextGetWidth( mrContext ); - mnHeight = CGBitmapContextGetHeight( mrContext ); - } - else - { - const CGSize aSize = CGLayerGetSize( mxLayer ); - mnWidth = static_cast<int>(aSize.width); - mnHeight = static_cast<int>(aSize.height); - } - - // prepare graphics for drawing - const CGColorSpaceRef aCGColorSpace = GetSalData()->mxRGBSpace; - CGContextSetFillColorSpace( mrContext, aCGColorSpace ); - CGContextSetStrokeColorSpace( mrContext, aCGColorSpace ); - - // re-enable XorEmulation for the new context - if( mpXorEmulation ) - { - mpXorEmulation->SetTarget( mnWidth, mnHeight, mnBitmapDepth, mrContext, mxLayer ); - if( mpXorEmulation->IsEnabled() ) - mrContext = mpXorEmulation->GetMaskContext(); - } - - // initialize stack of CGContext states - CGContextSaveGState( mrContext ); - SetState(); -} - - - void AquaSalGraphics::InvalidateContext() { UnsetState(); @@ -141,29 +92,6 @@ void AquaSalGraphics::UnsetState() } } -void AquaSalGraphics::SetState() -{ - CGContextRestoreGState( mrContext ); - CGContextSaveGState( mrContext ); - - // setup clipping - if( mxClipPath ) - { - CGContextBeginPath( mrContext ); // discard any existing path - CGContextAddPath( mrContext, mxClipPath ); // set the current path to the clipping path - CGContextClip( mrContext ); // use it for clipping - } - - // set RGB colorspace and line and fill colors - CGContextSetFillColor( mrContext, maFillColor.AsArray() ); - CGContextSetStrokeColor( mrContext, maLineColor.AsArray() ); - CGContextSetShouldAntialias( mrContext, false ); - if( mnXorMode == 2 ) - CGContextSetBlendMode( mrContext, kCGBlendModeDifference ); -} - - - bool AquaSalGraphics::CheckContext() { if( mbWindow && mpFrame && mpFrame->getNSWindow() ) @@ -250,22 +178,6 @@ void AquaSalGraphics::RefreshRect(float lX, float lY, float lWidth, float lHeigh } } -CGPoint* AquaSalGraphics::makeCGptArray(sal_uLong nPoints, const SalPoint* pPtAry) -{ - CGPoint *CGpoints = new CGPoint[nPoints]; - if ( CGpoints ) - { - for(sal_uLong i=0;i<nPoints;i++) - { - CGpoints[i].x = (float)(pPtAry[i].mnX); - CGpoints[i].y = (float)(pPtAry[i].mnY); - } - } - return CGpoints; -} - - - void AquaSalGraphics::UpdateWindow( NSRect& ) { if( !mpFrame ) diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx index 2204bea79970..b54f7ced1755 100644 --- a/vcl/quartz/salvd.cxx +++ b/vcl/quartz/salvd.cxx @@ -45,7 +45,11 @@ SalVirtualDevice* AquaSalInstance::CreateVirtualDevice( SalGraphics* pGraphics, if( pData ) return new AquaSalVirtualDevice( static_cast< AquaSalGraphics* >( pGraphics ), nDX, nDY, nBitCount, pData ); else - return new AquaSalVirtualDevice( NULL, nDX, nDY, nBitCount, NULL ); + { + AquaSalVirtualDevice* pNew = new AquaSalVirtualDevice( NULL, nDX, nDY, nBitCount, NULL ); + pNew->SetSize( nDX, nDY ); + return pNew; + } #else return new AquaSalVirtualDevice( static_cast< AquaSalGraphics* >( pGraphics ), nDX, nDY, nBitCount, pData ); #endif |