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
This commit is contained in:
@@ -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 )
|
||||
{
|
||||
|
@@ -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.
|
||||
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user