diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-05-25 16:40:47 +0100 |
---|---|---|
committer | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-06-25 13:04:29 +0100 |
commit | 56fea375b915bb96012b36012634523b9806040a (patch) | |
tree | 291c2de2f0599b2302a95068bda1b98585fc1b51 /vcl | |
parent | 01bd2bd371051e9dcab0cd15db43a607d5f12b63 (diff) |
Allow passing in external buffers to svp's VirtualDevice.
We also want to be able to set whether or not the buffers
should be painted to top down, so add that parameter
as necessary (default seems to be false, however e.g. gtk
requires this to be true, i.e. needed for tiled rendering).
Change-Id: Id98882e4c7f62508ae5a976c0d8df743460a4ab2
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/headless/svpvd.cxx | 12 | ||||
-rw-r--r-- | vcl/inc/headless/svpvd.hxx | 5 | ||||
-rw-r--r-- | vcl/inc/salvd.hxx | 8 | ||||
-rw-r--r-- | vcl/source/gdi/virdev.cxx | 24 |
4 files changed, 33 insertions, 16 deletions
diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx index d85cd8c7da29..dc280db879cd 100644 --- a/vcl/headless/svpvd.cxx +++ b/vcl/headless/svpvd.cxx @@ -52,10 +52,12 @@ void SvpSalVirtualDevice::ReleaseGraphics( SalGraphics* pGraphics ) bool SvpSalVirtualDevice::SetSize( long nNewDX, long nNewDY ) { - return SetSizeUsingBuffer( nNewDX, nNewDY, basebmp::RawMemorySharedArray() ); + return SetSizeUsingBuffer( nNewDX, nNewDY, basebmp::RawMemorySharedArray(), false ); } -bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, const basebmp::RawMemorySharedArray &pBuffer ) +bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, + const basebmp::RawMemorySharedArray &pBuffer, + const bool bTopDown ) { B2IVector aDevSize( nNewDX, nNewDY ); if( aDevSize.getX() == 0 ) @@ -73,13 +75,13 @@ bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, const ba std::vector< basebmp::Color > aDevPal(2); aDevPal.push_back( basebmp::Color( 0, 0, 0 ) ); aDevPal.push_back( basebmp::Color( 0xff, 0xff, 0xff ) ); - m_aDevice = createBitmapDevice( aDevSize, false, nFormat, PaletteMemorySharedVector( new std::vector< basebmp::Color >(aDevPal) ) ); + m_aDevice = createBitmapDevice( aDevSize, bTopDown, nFormat, PaletteMemorySharedVector( new std::vector< basebmp::Color >(aDevPal) ) ); } else { m_aDevice = pBuffer ? - createBitmapDevice( aDevSize, false, nFormat, pBuffer, PaletteMemorySharedVector() ) - : createBitmapDevice( aDevSize, false, nFormat ); + createBitmapDevice( aDevSize, bTopDown, nFormat, pBuffer, PaletteMemorySharedVector() ) + : createBitmapDevice( aDevSize, bTopDown, nFormat ); } // update device in existing graphics diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx index e4d37fcabeb1..f6a9cc5307fe 100644 --- a/vcl/inc/headless/svpvd.hxx +++ b/vcl/inc/headless/svpvd.hxx @@ -45,7 +45,10 @@ public: virtual void ReleaseGraphics( SalGraphics* pGraphics ) SAL_OVERRIDE; virtual bool SetSize( long nNewDX, long nNewDY ) SAL_OVERRIDE; - virtual bool SetSizeUsingBuffer( long nNewDX, long nNewDY, const basebmp::RawMemorySharedArray &pBuffer ) SAL_OVERRIDE; + virtual bool SetSizeUsingBuffer( long nNewDX, long nNewDY, + const basebmp::RawMemorySharedArray &pBuffer, + const bool bTopDown + ) SAL_OVERRIDE; virtual void GetSize( long& rWidth, long& rHeight ) SAL_OVERRIDE; basebmp::BitmapDeviceSharedPtr getBitmapDevice() { return m_aDevice; } diff --git a/vcl/inc/salvd.hxx b/vcl/inc/salvd.hxx index 842429f4d8c3..0cac6397fa19 100644 --- a/vcl/inc/salvd.hxx +++ b/vcl/inc/salvd.hxx @@ -40,9 +40,13 @@ public: virtual bool SetSize( long nNewDX, long nNewDY ) = 0; // Set new size using a buffer at the given address - virtual bool SetSizeUsingBuffer( long nNewDX, long nNewDY, const basebmp::RawMemorySharedArray & /* pBuffer */ ) + virtual bool SetSizeUsingBuffer( long nNewDX, long nNewDY, + const basebmp::RawMemorySharedArray & /* pBuffer */, + const bool /* bTopDown */ + ) { - // Only the headless virtual device has an implementation that uses pBuffer. + // Only the headless virtual device has an implementation that uses + // pBuffer (and bTopDown). return SetSize( nNewDX, nNewDY ); } diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index 6378785526ef..54cd376c0ce0 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -267,7 +267,9 @@ VirtualDevice::~VirtualDevice() pSVData->maGDIData.mpLastVirDev = mpPrev; } -bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase, const basebmp::RawMemorySharedArray &pBuffer ) +bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase, + const basebmp::RawMemorySharedArray &pBuffer, + const bool bTopDown ) { SAL_INFO( "vcl.gdi", "VirtualDevice::InnerImplSetOutputSizePixel( " << rNewSize.Width() << ", " @@ -296,7 +298,7 @@ bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bEra if ( bErase ) { if ( pBuffer ) - bRet = mpVirDev->SetSizeUsingBuffer( nNewWidth, nNewHeight, pBuffer ); + bRet = mpVirDev->SetSizeUsingBuffer( nNewWidth, nNewHeight, pBuffer, bTopDown ); else bRet = mpVirDev->SetSize( nNewWidth, nNewHeight ); @@ -381,9 +383,11 @@ void VirtualDevice::ImplFillOpaqueRectangle( const Rectangle& rRect ) Pop(); } -bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, const basebmp::RawMemorySharedArray &pBuffer ) +bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, + const basebmp::RawMemorySharedArray &pBuffer, + const bool bTopDown ) { - if( InnerImplSetOutputSizePixel(rNewSize, bErase, pBuffer) ) + if( InnerImplSetOutputSizePixel(rNewSize, bErase, pBuffer, bTopDown) ) { if( mnAlphaDepth != -1 ) { @@ -397,7 +401,9 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, c if( !mpAlphaVDev ) { mpAlphaVDev = new VirtualDevice( *this, mnAlphaDepth ); - mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase, basebmp::RawMemorySharedArray() ); + mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase, + basebmp::RawMemorySharedArray(), + bTopDown ); } // TODO: copy full outdev state to new one, here. Also needed in outdev2.cxx:DrawOutDev @@ -430,10 +436,12 @@ void VirtualDevice::EnableRTL( bool bEnable ) bool VirtualDevice::SetOutputSizePixel( const Size& rNewSize, bool bErase ) { - return ImplSetOutputSizePixel( rNewSize, bErase, basebmp::RawMemorySharedArray() ); + return ImplSetOutputSizePixel( rNewSize, bErase, basebmp::RawMemorySharedArray(), false ); } -bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize, const Fraction& rScale, const Point& rNewOffset, const basebmp::RawMemorySharedArray &pBuffer ) +bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer( + const Size& rNewSize, const Fraction& rScale, const Point& rNewOffset, + const basebmp::RawMemorySharedArray &pBuffer, const bool bTopDown ) { if (pBuffer) { MapMode mm = GetMapMode(); @@ -442,7 +450,7 @@ bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize mm.SetScaleY( rScale ); SetMapMode( mm ); } - return ImplSetOutputSizePixel( rNewSize, true, pBuffer); + return ImplSetOutputSizePixel( rNewSize, true, pBuffer, bTopDown ); } void VirtualDevice::SetReferenceDevice( RefDevMode i_eRefDevMode ) |