vcl/source/gdi/bitmap.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
New commits: commit 30d58306a93d4325f6388b8d05b9db91026c7c55 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Mar 30 16:13:49 2017 +0100 ofz#968 short-cut slow create mask when we are our own mask already Change-Id: I5969226bf2da34d34e30e44ae763792cdc072bc8 Reviewed-on: https://gerrit.libreoffice.org/35921 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> 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;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits