diff options
author | Tor Lillqvist <tml@collabora.com> | 2014-03-24 19:02:37 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2014-03-26 10:15:42 +0200 |
commit | 628b07cfc0417e87a6f2558543608aba04089d6a (patch) | |
tree | fe3d33a445113db8482936e927a8ca8aefaa0f79 /vcl | |
parent | 99a79ef856fb6b02196f71e67907a6a45940de01 (diff) |
Seems we don't need any basebmp stuff in AquaSalGraphics on iOS
No repeatable visible differences in TiledLibreOffice for my test
docs.
Probably we should unify the iOS vcl code even harder with the OS X
code, get rid of the last remains of the pre-tiled-rendering basebmp
bitmap-based stuff.
Change-Id: I2484585d3d0ef5ce758d0a654717d23464464c1a
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/headless/svpframe.cxx | 6 | ||||
-rw-r--r-- | vcl/headless/svpgdi.cxx | 35 | ||||
-rw-r--r-- | vcl/inc/headless/svpgdi.hxx | 36 | ||||
-rw-r--r-- | vcl/quartz/salgdi.cxx | 86 | ||||
-rw-r--r-- | vcl/quartz/salgdicommon.cxx | 12 |
5 files changed, 41 insertions, 134 deletions
diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx index 68aa4d0f603e..6e12d6aeacd1 100644 --- a/vcl/headless/svpframe.cxx +++ b/vcl/headless/svpframe.cxx @@ -170,7 +170,9 @@ void SvpSalFrame::LoseFocus() SalGraphics* SvpSalFrame::AcquireGraphics() { SvpSalGraphics* pGraphics = new SvpSalGraphics(); +#ifndef IOS pGraphics->setDevice( m_aFrame ); +#endif m_aGraphics.push_back( pGraphics ); return pGraphics; } @@ -293,7 +295,11 @@ void SvpSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_u // update device in existing graphics 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 ); diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 4ba8ca01b878..e7c458c3f96c 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -88,9 +88,6 @@ bool SvpSalGraphics::drawAlphaRect( long /*nX*/, long /*nY*/, long /*nWidth*/, l // TODO(P3) implement alpha blending return false; } -#endif - -#ifndef IOS SvpSalGraphics::SvpSalGraphics() : m_bUseLineColor( true ), @@ -110,14 +107,11 @@ SvpSalGraphics::~SvpSalGraphics() { } -#endif - void SvpSalGraphics::setDevice( basebmp::BitmapDeviceSharedPtr& rDevice ) { m_aOrigDevice = rDevice; ResetClipRegion(); -#ifndef IOS // determine matching bitmap format for masks basebmp::Format nDeviceFmt = m_aDevice->getScanlineFormat(); switch( nDeviceFmt ) @@ -136,9 +130,10 @@ void SvpSalGraphics::setDevice( basebmp::BitmapDeviceSharedPtr& rDevice ) m_eTextFmt = basebmp::FORMAT_ONE_BIT_LSB_GREY; break; } -#endif } +#endif + void SvpSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) { rDPIX = rDPIY = 96; @@ -151,8 +146,6 @@ sal_uInt16 SvpSalGraphics::GetBitCount() const return SvpSalBitmap::getBitCountFromScanlineFormat( m_aDevice->getScanlineFormat() ); } -#endif - long SvpSalGraphics::GetGraphicsWidth() const { if( m_aDevice.get() ) @@ -163,8 +156,6 @@ long SvpSalGraphics::GetGraphicsWidth() const return 0; } -#ifndef IOS - void SvpSalGraphics::ResetClipRegion() { m_aDevice = m_aOrigDevice; @@ -174,8 +165,6 @@ void SvpSalGraphics::ResetClipRegion() } -#endif - // verify clip for the whole area is setup void SvpSalGraphics::ensureClip() { @@ -284,8 +273,6 @@ 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 // 3 rectangles pushed, and have to create a vast off-screen @@ -389,7 +376,6 @@ void SvpSalGraphics::SetROPFillColor( SalROPColor nROPColor ) } -#ifndef IOS void SvpSalGraphics::drawPixel( long nX, long nY ) { if( m_bUseLineColor ) @@ -562,8 +548,6 @@ bool SvpSalGraphics::drawPolyPolygon( const basegfx::B2DPolyPolygon&, double /*f return false; } -#endif - void SvpSalGraphics::copyArea( long nDestX, long nDestY, long nSrcX, @@ -603,7 +587,6 @@ void SvpSalGraphics::copyBits( const SalTwoRect& rPosAry, dbgOut( m_aDevice ); } -#ifndef IOS void SvpSalGraphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) { @@ -678,8 +661,6 @@ void SvpSalGraphics::drawMask( const SalTwoRect& rPosAry, dbgOut( m_aDevice ); } -#endif - SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeight ) { basebmp::BitmapDeviceSharedPtr aCopy = @@ -697,16 +678,12 @@ SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeigh return pBitmap; } -#endif - SalColor SvpSalGraphics::getPixel( long nX, long nY ) { basebmp::Color aColor( m_aOrigDevice->getPixel( basegfx::B2IPoint( nX, 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 @@ -740,13 +717,13 @@ bool SvpSalGraphics::drawEPS( long, long, long, long, void*, sal_uLong ) return false; } +#ifndef IOS + SystemGraphicsData SvpSalGraphics::GetGraphicsData() const { return SystemGraphicsData(); } -#ifndef IOS - bool SvpSalGraphics::supportsOperation( OutDevSupportType ) const { return false; @@ -756,10 +733,8 @@ bool SvpSalGraphics::supportsOperation( OutDevSupportType ) const #ifdef IOS -void SvpSalGraphics::RefreshRect(float lX, float lY, float lWidth, float lHeight) +void SvpSalGraphics::RefreshRect(float /* lX */, float /* lY */, float /* lWidth */, float /* lHeight */) { - if (m_aDevice && m_aDevice->getDamageTracker() != NULL) - m_aDevice->getDamageTracker()->damaged(basegfx::B2IBox( basegfx::fround(lX), basegfx::fround(lY), basegfx::fround(lX + lWidth), basegfx::fround(lY + lHeight))); } #endif diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index 18cb71aaa698..fdcd5ea3caa0 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -47,10 +47,12 @@ class ServerFont; class SvpSalGraphics : public SalGraphics { +#ifndef IOS basebmp::BitmapDeviceSharedPtr m_aDevice; basebmp::BitmapDeviceSharedPtr m_aOrigDevice; -#ifndef IOS + basebmp::BitmapDeviceSharedPtr m_aClipMap; + bool m_bUseLineColor; basebmp::Color m_aLineColor; bool m_bUseFillColor; @@ -63,6 +65,22 @@ class SvpSalGraphics : public SalGraphics basebmp::Color m_aTextColor; ServerFont* m_pServerFont[ MAX_FALLBACK ]; basebmp::Format m_eTextFmt; + +protected: + basegfx::B2IVector GetSize() { return m_aOrigDevice->getSize(); } + +private: + bool m_bClipSetup; + struct ClipUndoHandle { + SvpSalGraphics &m_rGfx; + basebmp::BitmapDeviceSharedPtr m_aDevice; + ClipUndoHandle( SvpSalGraphics *pGfx ) : m_rGfx( *pGfx ) {} + ~ClipUndoHandle(); + }; + +public: + void setDevice( basebmp::BitmapDeviceSharedPtr& rDevice ); + #else friend class CTLayout; @@ -98,22 +116,8 @@ class SvpSalGraphics : public SalGraphics bool mbVirDev; #endif - basebmp::BitmapDeviceSharedPtr m_aClipMap; - protected: Region m_aClipRegion; - basegfx::B2IVector GetSize() { return m_aOrigDevice->getSize(); } - -private: - bool m_bClipSetup; - struct ClipUndoHandle { - SvpSalGraphics &m_rGfx; - basebmp::BitmapDeviceSharedPtr m_aDevice; - ClipUndoHandle( SvpSalGraphics *pGfx ) : m_rGfx( *pGfx ) {} - ~ClipUndoHandle(); - }; - bool isClippedSetup( const basegfx::B2IBox &aRange, ClipUndoHandle &rUndo ); - void ensureClip(); protected: virtual bool drawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap ); @@ -129,8 +133,6 @@ public: SvpSalGraphics(); virtual ~SvpSalGraphics(); - void setDevice( basebmp::BitmapDeviceSharedPtr& rDevice ); - virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ); virtual sal_uInt16 GetBitCount() const; virtual long GetGraphicsWidth() const; diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 4579729e9f13..916926d4eb84 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -830,91 +830,9 @@ bool SvpSalGraphics::CheckContext() return true; } - if(m_aDevice == NULL) // fix tiledrendering crash when changing content size - { - SAL_INFO( "vcl.ios", "CheckContext() this=" << this << ", m_aDevice==NULL, return false"); - return false; - } - - const basegfx::B2IVector size = m_aDevice->getSize(); - const basegfx::B2IVector bufferSize = m_aDevice->getBufferSize(); - const sal_Int32 scanlineStride = m_aDevice->getScanlineStride(); - basebmp::RawMemorySharedArray pixelBuffer = m_aDevice->getBuffer(); - bool warned = false; - - SAL_INFO( "vcl.ios", - "CheckContext: device=" << m_aDevice.get() << - " size=" << size.getX() << "x" << size.getY() << - (m_aDevice->isTopDown() ? " top-down" : " bottom-up") << - " stride=" << scanlineStride << - " bufferSize=(" << bufferSize.getX() << "," << bufferSize.getY() << ")" ); - - switch( m_aDevice->getScanlineFormat() ) { - case basebmp::FORMAT_EIGHT_BIT_PAL: - mrContext = CGBitmapContextCreate(pixelBuffer.get(), - bufferSize.getX(), bufferSize.getY(), - 8, scanlineStride, - CGColorSpaceCreateDeviceGray(), - kCGImageAlphaNone); - break; - case basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA: - case basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_ARGB: - case basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_ABGR: - case basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA: - mrContext = CGBitmapContextCreate(pixelBuffer.get(), - bufferSize.getX(), bufferSize.getY(), - 8, scanlineStride, - CGColorSpaceCreateDeviceRGB(), - kCGImageAlphaNoneSkipFirst);//kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Little); - break; - default: - SAL_WARN( "vcl.ios", "CheckContext: unsupported color format " << basebmp::formatName( m_aDevice->getScanlineFormat() ) ); - warned = true; - } - - SAL_WARN_IF( mrContext == NULL && !warned, "vcl.ios", "CheckContext: CGBitmapContextCreate() failed" ); - - // Should we also clip the context? (Then we need to add a - // getBounds() function to BitmapDevice.) - - if( mrContext != NULL && m_aDevice->isTopDown() ) - { - CGContextTranslateCTM( mrContext, 0, bufferSize.getY() ); - CGContextScaleCTM( mrContext, 1, -1 ); - } - - - if (mrContext) - { - RectangleVector aRectangles; - m_aClipRegion.GetRegionRectangles(aRectangles); - - CGContextBeginPath( mrContext ); - - for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter) - { - const long nW(aRectIter->Right() - aRectIter->Left() + 1); // uses +1 logic in original - - if(nW) - { - const long nH(aRectIter->Bottom() - aRectIter->Top() + 1); // uses +1 logic in original - - if(nH) - { - CGRect aRect = {{ (CGFloat) aRectIter->Left(), (CGFloat) aRectIter->Top() }, { (CGFloat) nW, (CGFloat) nH }}; - CGContextAddRect( mrContext, aRect ); - } - } - } - - if (!CGContextIsPathEmpty(mrContext)) - CGContextClip(mrContext); - } - - - SAL_INFO( "vcl.ios", "CheckContext: context=" << mrContext ); + SAL_INFO( "vcl.ios", "CheckContext() this=" << this << ", not foreign, return false"); + return false; - return ( mrContext != NULL ); } CGContextRef SvpSalGraphics::GetContext() diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx index d923cc649069..8d4b0355eefb 100644 --- a/vcl/quartz/salgdicommon.cxx +++ b/vcl/quartz/salgdicommon.cxx @@ -1175,8 +1175,6 @@ SalBitmap* AquaSalGraphics::getBitmap( long nX, long nY, long nDX, long nDY return pBitmap; } -#ifndef IOS - SystemGraphicsData AquaSalGraphics::GetGraphicsData() const { SystemGraphicsData aRes; @@ -1188,11 +1186,16 @@ SystemGraphicsData AquaSalGraphics::GetGraphicsData() const long AquaSalGraphics::GetGraphicsWidth() const { long w = 0; - if( mrContext && (mbWindow || mbVirDev) ) + if( mrContext && ( +#ifndef IOS + mbWindow || +#endif + mbVirDev) ) { w = mnWidth; } +#ifndef IOS if( w == 0 ) { if( mbWindow && mpFrame ) @@ -1200,6 +1203,7 @@ long AquaSalGraphics::GetGraphicsWidth() const w = mpFrame->maGeometry.nWidth; } } +#endif return w; } @@ -1242,6 +1246,8 @@ SalColor AquaSalGraphics::getPixel( long nX, long nY ) return nSalColor; } +#ifndef IOS + void AquaSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) { if( !mnRealDPIY ) |