basebmp/source/bitmapdevice.cxx | 27 +++++++++++++++++++++++---- include/basebmp/bitmapdevice.hxx | 4 ++++ vcl/headless/svpgdi.cxx | 3 +-- 3 files changed, 28 insertions(+), 6 deletions(-)
New commits: commit 6443e8f88e07c35ff839dc72c0f012a2322a81a6 Author: Michael Meeks <michael.me...@collabora.com> Date: Tue Oct 14 11:59:04 2014 -0300 basebmp: accelerated method to create a clipping device. This was some staggering proportion of tiled rendering documents with complex clipping; it seems 'clear' is not what memset is for 1bit clip masks. Change-Id: I9142ffb7d7016603feb7782d6f03b9992b9494e3 diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx index 4104c18..d79afd5 100644 --- a/basebmp/source/bitmapdevice.cxx +++ b/basebmp/source/bitmapdevice.cxx @@ -1944,7 +1944,8 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector& boost::shared_array< sal_uInt8 > pMem, PaletteMemorySharedVector pPal, const basegfx::B2IBox* pSubset, - const IBitmapDeviceDamageTrackerSharedPtr& rDamage ) + const IBitmapDeviceDamageTrackerSharedPtr& rDamage, + bool bBlack = true) { OSL_ASSERT(rSize.getX() > 0 && rSize.getY() > 0); @@ -1990,7 +1991,10 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector& &rtl_freeMemory ); if (pMem.get() == 0 && nMemSize != 0) return BitmapDeviceSharedPtr(); - memset(pMem.get(), 0, nMemSize); + if (bBlack) + memset(pMem.get(), 0, nMemSize); + else + memset(pMem.get(), 0xFF, nMemSize); } sal_uInt8* pFirstScanline = nScanlineStride < 0 ? @@ -2129,9 +2133,10 @@ BitmapDeviceSharedPtr createBitmapDeviceImpl( const basegfx::B2IVector& boost::shared_array< sal_uInt8 > pMem, PaletteMemorySharedVector pPal, const basegfx::B2IBox* pSubset, - const IBitmapDeviceDamageTrackerSharedPtr& rDamage ) + const IBitmapDeviceDamageTrackerSharedPtr& rDamage, + bool bBlack = true) { - BitmapDeviceSharedPtr result( createBitmapDeviceImplInner( rSize, bTopDown, nScanlineFormat, pMem, pPal, pSubset, rDamage ) ); + BitmapDeviceSharedPtr result( createBitmapDeviceImplInner( rSize, bTopDown, nScanlineFormat, pMem, pPal, pSubset, rDamage, bBlack ) ); #ifdef SAL_LOG_INFO std::ostringstream subset; @@ -2194,6 +2199,20 @@ BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize IBitmapDeviceDamageTrackerSharedPtr() ); } +BitmapDeviceSharedPtr createClipDevice( const basegfx::B2IVector& rSize ) +{ + BitmapDeviceSharedPtr xClip( + createBitmapDeviceImpl( rSize, + false, /* bTopDown */ + basebmp::FORMAT_ONE_BIT_MSB_GREY, + boost::shared_array< sal_uInt8 >(), + PaletteMemorySharedVector(), + NULL, + IBitmapDeviceDamageTrackerSharedPtr(), + false /* white */) ); + return xClip; +} + BitmapDeviceSharedPtr subsetBitmapDevice( const BitmapDeviceSharedPtr& rProto, const basegfx::B2IBox& rSubset ) { diff --git a/include/basebmp/bitmapdevice.hxx b/include/basebmp/bitmapdevice.hxx index 1a81514..a4c38e8 100644 --- a/include/basebmp/bitmapdevice.hxx +++ b/include/basebmp/bitmapdevice.hxx @@ -690,6 +690,10 @@ BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const basegfx::B2IVe const PaletteMemorySharedVector& rPalette ); +/** Function to create a 1 bit grey clipping mask initialized to white. + */ +BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createClipDevice( const basegfx::B2IVector& rSize ); + /** Function to retrieve a subsetted BitmapDevice to the same memory. diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 945f335..8547158 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -168,8 +168,7 @@ void SvpSalGraphics::ensureClip() m_aDevice = m_aOrigDevice; basegfx::B2IVector aSize = m_aDevice->getSize(); - m_aClipMap = basebmp::createBitmapDevice( aSize, false, basebmp::FORMAT_ONE_BIT_MSB_GREY ); - m_aClipMap->clear( basebmp::Color(0xFFFFFFFF) ); + m_aClipMap = basebmp::createClipDevice( aSize ); RectangleVector aRectangles; m_aClipRegion.GetRegionRectangles(aRectangles); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits