diff options
-rw-r--r-- | vcl/source/gdi/bitmap.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index d7c9d909a753..6ec5a842f30a 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -1107,9 +1107,16 @@ bool Bitmap::Expand( sal_uLong nDX, sal_uLong nDY, const Color* pInitColor ) Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uLong nTol ) const { - Bitmap aNewBmp( GetSizePixel(), 1 ); - ScopedReadAccess pReadAcc(const_cast<Bitmap&>(*this)); + ScopedReadAccess pReadAcc(const_cast<Bitmap&>(*this)); + + if (!nTol && (pReadAcc->GetScanlineFormat() == ScanlineFormat::N1BitLsbPal || pReadAcc->GetScanlineFormat() == ScanlineFormat::N1BitMsbPal) + && pReadAcc->GetBestMatchingColor(Color(COL_WHITE)) == pReadAcc->GetBestMatchingColor(rTransColor)) + { + //if we're a 1 bit pixel already, and the transcolor matches the color that would replace it already already, then just return a copy + return *this; + } + Bitmap aNewBmp(GetSizePixel(), 1); ScopedWriteAccess pWriteAcc(aNewBmp); bool bRet = false; |