diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-05-06 22:36:15 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-05-07 08:19:51 +0100 |
commit | 0672b7a929576f902c48058e712c7d1a5711ac64 (patch) | |
tree | 57f642f6ecedf1ec03304b4a6c4137e3b0d1ebfe /vcl/source | |
parent | e35b1d8b0913514becb9e5d2845c74a927b4a272 (diff) |
silence more valgrind spew on scanline-extended deadspace
Change-Id: I8607d9d405a3996699ef85564938628624987385
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/bitmap2.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/vcl/source/gdi/bitmap2.cxx b/vcl/source/gdi/bitmap2.cxx index 90d407ee94e0..c559383ca756 100644 --- a/vcl/source/gdi/bitmap2.cxx +++ b/vcl/source/gdi/bitmap2.cxx @@ -36,6 +36,10 @@ #include <utility> +#if defined(HAVE_MEMCHECK_H) +#include <memcheck.h> +#endif + // ----------- // - Defines - @@ -903,6 +907,18 @@ sal_Bool Bitmap::ImplWriteDIBPalette( SvStream& rOStm, BitmapReadAccess& rAcc ) // ------------------------------------------------------------------ +#if defined(HAVE_MEMCHECK_H) +namespace +{ + void blankExtraSpace(sal_uInt8 *pBits, long nWidth, long nScanlineSize, int nBitCount) + { + size_t nExtraSpaceInScanLine = nScanlineSize - nWidth * nBitCount / 8; + if (nExtraSpaceInScanLine) + memset(pBits + (nScanlineSize - nExtraSpaceInScanLine), 0, nExtraSpaceInScanLine); + } +} +#endif + sal_Bool Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc, sal_uLong nCompression, sal_uInt32& rImageSize ) { @@ -975,6 +991,10 @@ sal_Bool Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc, const long nWidth = rAcc.Width(); const long nHeight = rAcc.Height(); sal_uInt8* pBuf = new sal_uInt8[ nAlignedWidth ]; +#if defined(HAVE_MEMCHECK_H) + if (RUNNING_ON_VALGRIND) + blankExtraSpace(pBuf, nWidth, nAlignedWidth, discretizeBitcount(nBitCount)); +#endif sal_uInt8* pTmp; sal_uInt8 cTmp; |