[Libreoffice-commits] core.git: vcl/source
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Fri Mar 26 07:40:47 UTC 2021
vcl/source/bitmap/BitmapEx.cxx | 64 ++++++++++++++++++++---------------------
1 file changed, 32 insertions(+), 32 deletions(-)
New commits:
commit e51824788d59b060b93d6632c1498fa71fbd9e69
Author: Noel <noel.grandin at collabora.co.uk>
AuthorDate: Fri Mar 26 08:52:22 2021 +0200
Commit: Noel Grandin <noel.grandin at 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.grandin at 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;
}
}
More information about the Libreoffice-commits
mailing list