vcl/source/bitmap/BitmapEx.cxx | 64 ++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 32 deletions(-)
New commits: commit e51824788d59b060b93d6632c1498fa71fbd9e69 Author: Noel <noel.gran...@collabora.co.uk> AuthorDate: Fri Mar 26 08:52:22 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Mar 26 08:40:06 2021 +0100 flatten BitmapEx::GetAlpha Change-Id: Ica7ed7fd94f2ddeaa6c5400d3606c5eeeffbf4f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113141 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx index a2667cbb6534..60272c728485 100644 --- a/vcl/source/bitmap/BitmapEx.cxx +++ b/vcl/source/bitmap/BitmapEx.cxx @@ -659,49 +659,49 @@ BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx const & aBitmap, const tools::Long sal_uInt8 BitmapEx::GetAlpha(sal_Int32 nX, sal_Int32 nY) const { - sal_uInt8 nAlpha(0); + if(maBitmap.IsEmpty()) + return 0; + + if (nX < 0 || nX >= GetSizePixel().Width() || nY < 0 || nY >= GetSizePixel().Height()) + return 0; + + if (maBitmap.GetBitCount() == 32) + return GetPixelColor(nX, nY).GetAlpha(); - if(!maBitmap.IsEmpty()) + sal_uInt8 nAlpha(0); + switch(meTransparent) { - if (nX >= 0 && nX < GetSizePixel().Width() && nY >= 0 && nY < GetSizePixel().Height()) + case TransparentType::NONE: + { + // Not transparent, ergo all covered + nAlpha = 255; + break; + } + case TransparentType::Bitmap: { - if (maBitmap.GetBitCount() == 32) - return GetPixelColor(nX, nY).GetAlpha(); - switch(meTransparent) + if(!maMask.IsEmpty()) { - case TransparentType::NONE: - { - // Not transparent, ergo all covered - nAlpha = 255; - break; - } - case TransparentType::Bitmap: + Bitmap aTestBitmap(maMask); + Bitmap::ScopedReadAccess pRead(aTestBitmap); + + if(pRead) { - if(!maMask.IsEmpty()) - { - Bitmap aTestBitmap(maMask); - Bitmap::ScopedReadAccess pRead(aTestBitmap); + const BitmapColor aBitmapColor(pRead->GetPixel(nY, nX)); - if(pRead) + if(mbAlpha) + { + nAlpha = 255 - aBitmapColor.GetIndex(); + } + else + { + if(0x00 == aBitmapColor.GetIndex()) { - const BitmapColor aBitmapColor(pRead->GetPixel(nY, nX)); - - if(mbAlpha) - { - nAlpha = 255 - aBitmapColor.GetIndex(); - } - else - { - if(0x00 == aBitmapColor.GetIndex()) - { - nAlpha = 255; - } - } + nAlpha = 255; } } - break; } } + break; } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits