drawinglayer/source/primitive2d/sceneprimitive2d.cxx   |    2 +-
 drawinglayer/source/processor2d/hittestprocessor2d.cxx |    2 +-
 include/vcl/bitmapex.hxx                               |    8 ++++----
 vcl/source/bitmap/BitmapEx.cxx                         |   16 ++++++++--------
 4 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit ef7f98ff3c73182528995057a3f691a6d1aefdd5
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Fri Jan 15 20:49:05 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Jan 16 09:00:25 2021 +0100

    transparency->alpha in BitmapEx
    
    Change-Id: I631f4ca5a2bdcb8c7691a9a8c71d3de15377213b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109390
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx 
b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
index fa35085e0f1f..b96cca222e7f 100644
--- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
@@ -557,7 +557,7 @@ namespace drawinglayer::primitive2d
                     const sal_Int32 nY(basegfx::fround(fRelativeY * 
aBitmapSizePixel.Height()));
 
                     // try to get a statement about transparency in that pixel
-                    o_rResult = (0xff != 
maOldRenderedBitmap.GetTransparency(nX, nY));
+                    o_rResult = (0 != maOldRenderedBitmap.GetAlpha(nX, nY));
                     return true;
                 }
             }
diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx 
b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
index 65a03548cb1c..04505489c6f2 100644
--- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
@@ -452,7 +452,7 @@ namespace drawinglayer::processor2d
                                     const sal_Int32 
nX(basegfx::fround(aRelativePoint.getX() * rSizePixel.Width()));
                                     const sal_Int32 
nY(basegfx::fround(aRelativePoint.getY() * rSizePixel.Height()));
 
-                                    mbHit = (0xff != 
aBitmapEx.GetTransparency(nX, nY));
+                                    mbHit = (0 != aBitmapEx.GetAlpha(nX, nY));
                                 }
                             }
                             else
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index 14bbee535485..75e605cb96a9 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -359,7 +359,7 @@ public:
                             bool bInvert = false,
                             bool msoBrightness = false );
 
-    /** Get transparency at given position
+    /** Get alpha at given position
 
         @param nX
         integer X-Position in Bitmap
@@ -367,10 +367,10 @@ public:
         @param nY
         integer Y-Position in Bitmap
 
-        @return transparency value in the range of [0 .. 255] where
-                0 is not transparent, 255 is fully transparent
+        @return alpha value in the range of [0 .. 255] where
+                0 is fully transparent, 255 is not transparent
      */
-    sal_uInt8           GetTransparency(
+    sal_uInt8           GetAlpha(
                             sal_Int32 nX,
                             sal_Int32 nY) const;
 
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index 1f5da07218c4..65698b6bbad9 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -675,22 +675,22 @@ BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx const & 
aBitmap, const tools::Long
     return aRet;
 }
 
-sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const
+sal_uInt8 BitmapEx::GetAlpha(sal_Int32 nX, sal_Int32 nY) const
 {
-    sal_uInt8 nTransparency(0xff);
+    sal_uInt8 nAlpha(0);
 
     if(!maBitmap.IsEmpty())
     {
         if (nX >= 0 && nX < GetSizePixel().Width() && nY >= 0 && nY < 
GetSizePixel().Height())
         {
             if (maBitmap.GetBitCount() == 32)
-                return 255 - GetPixelColor(nX, nY).GetAlpha();
+                return GetPixelColor(nX, nY).GetAlpha();
             switch(meTransparent)
             {
                 case TransparentType::NONE:
                 {
                     // Not transparent, ergo all covered
-                    nTransparency = 0x00;
+                    nAlpha = 255;
                     break;
                 }
                 case TransparentType::Color:
@@ -704,7 +704,7 @@ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 
nY) const
 
                         // If color is not equal to TransparentColor, we are 
not transparent
                         if (aBmpColor != maTransparentColor)
-                            nTransparency = 0x00;
+                            nAlpha = 255;
 
                     }
                     break;
@@ -722,13 +722,13 @@ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, 
sal_Int32 nY) const
 
                             if(mbAlpha)
                             {
-                                nTransparency = aBitmapColor.GetIndex();
+                                nAlpha = 255 - aBitmapColor.GetIndex();
                             }
                             else
                             {
                                 if(0x00 == aBitmapColor.GetIndex())
                                 {
-                                    nTransparency = 0x00;
+                                    nAlpha = 255;
                                 }
                             }
                         }
@@ -739,7 +739,7 @@ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 
nY) const
         }
     }
 
-    return nTransparency;
+    return nAlpha;
 }
 
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to