summaryrefslogtreecommitdiff
path: root/basebmp
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-10-14 11:59:04 -0300
committerMichael Meeks <michael.meeks@collabora.com>2014-10-14 12:04:13 -0300
commit578fd01ee9d1a3b550e115d5db64523c7f57efde (patch)
treec3a5bd18e3bee11aba9baf33c384c5be5a05d820 /basebmp
parent9f8605b04dfecefabe73035aae50443ad93da878 (diff)
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
Diffstat (limited to 'basebmp')
-rw-r--r--basebmp/source/bitmapdevice.cxx27
1 files changed, 23 insertions, 4 deletions
diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx
index 4104c186cdf5..d79afd5166b2 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 )
{