diff options
author | Noel Grandin <noel@peralex.com> | 2021-02-27 15:50:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-26 12:51:58 +0200 |
commit | ddd2639a482befb4a3bf1f75a88e66c21a691b67 (patch) | |
tree | 2d2a2a0695dce2b8b065f107368ef0412807fa73 /drawinglayer | |
parent | 9c4e0c35d70659097b235028047efcb80dcfb10d (diff) |
drop mask from BitmapEx
So that we have fewer cases to deal with when we transition to
32-bit bitmaps.
(*) rename maMask to maAlphaMask, since now it is only being used
for alpha duties.
(*) drop mbAlpha and mbTransparent to simplify state management,
the only thing we need to check for alpha is if maAlphaMask is
non-empty.
Change-Id: I06252e38e950e846a94b4c2ba8ea763be17801fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111679
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/inc/texture/texture3d.hxx | 1 | ||||
-rw-r--r-- | drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx | 10 | ||||
-rw-r--r-- | drawinglayer/source/texture/texture3d.cxx | 50 | ||||
-rw-r--r-- | drawinglayer/source/tools/wmfemfhelper.cxx | 2 |
4 files changed, 16 insertions, 47 deletions
diff --git a/drawinglayer/inc/texture/texture3d.hxx b/drawinglayer/inc/texture/texture3d.hxx index 935fa09883f2..88d13ed03b7c 100644 --- a/drawinglayer/inc/texture/texture3d.hxx +++ b/drawinglayer/inc/texture/texture3d.hxx @@ -62,7 +62,6 @@ namespace drawinglayer::texture double mfMulY; bool mbIsAlpha : 1; - bool mbIsTransparent : 1; // helpers bool impIsValid(const basegfx::B2DPoint& rUV, sal_Int32& rX, sal_Int32& rY) const; diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx index 9c441dc0d876..ff0b830677a5 100644 --- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx @@ -256,9 +256,9 @@ namespace drawinglayer::primitive2d case Disposal::Not: { maVirtualDevice->DrawBitmapEx(rAnimationBitmap.maPositionPixel, rAnimationBitmap.maBitmapEx); - Bitmap aMask = rAnimationBitmap.maBitmapEx.GetMask(); + Bitmap aAlphaMask = rAnimationBitmap.maBitmapEx.GetAlpha(); - if (aMask.IsEmpty()) + if (aAlphaMask.IsEmpty()) { const Point aEmpty; const ::tools::Rectangle aRect(aEmpty, maVirtualDeviceMask->GetOutputSizePixel()); @@ -267,7 +267,7 @@ namespace drawinglayer::primitive2d } else { - BitmapEx aExpandVisibilityMask(aMask, aMask); + BitmapEx aExpandVisibilityMask(aAlphaMask, aAlphaMask); maVirtualDeviceMask->DrawBitmapEx(rAnimationBitmap.maPositionPixel, aExpandVisibilityMask); } @@ -276,7 +276,7 @@ namespace drawinglayer::primitive2d case Disposal::Back: { // #i70772# react on no mask, for primitives, too. - const Bitmap & rMask(rAnimationBitmap.maBitmapEx.GetMask()); + const Bitmap & rMask(rAnimationBitmap.maBitmapEx.GetAlpha()); const Bitmap & rContent(rAnimationBitmap.maBitmapEx.GetBitmap()); maVirtualDeviceMask->Erase(); @@ -300,7 +300,7 @@ namespace drawinglayer::primitive2d case Disposal::Previous: { maVirtualDevice->DrawBitmapEx(rAnimationBitmap.maPositionPixel, rAnimationBitmap.maBitmapEx); - BitmapEx aExpandVisibilityMask(rAnimationBitmap.maBitmapEx.GetMask(), rAnimationBitmap.maBitmapEx.GetMask()); + BitmapEx aExpandVisibilityMask(rAnimationBitmap.maBitmapEx.GetAlpha(), rAnimationBitmap.maBitmapEx.GetAlpha()); maVirtualDeviceMask->DrawBitmapEx(rAnimationBitmap.maPositionPixel, aExpandVisibilityMask); break; } diff --git a/drawinglayer/source/texture/texture3d.cxx b/drawinglayer/source/texture/texture3d.cxx index 99aa597589f7..589c23f5df16 100644 --- a/drawinglayer/source/texture/texture3d.cxx +++ b/drawinglayer/source/texture/texture3d.cxx @@ -66,26 +66,16 @@ namespace drawinglayer::texture maSize(rRange.getRange()), mfMulX(0.0), mfMulY(0.0), - mbIsAlpha(false), - mbIsTransparent(maBitmapEx.IsTransparent()) + mbIsAlpha(maBitmapEx.IsAlpha()) { if(vcl::bitmap::convertBitmap32To24Plus8(maBitmapEx,maBitmapEx)) - mbIsTransparent = maBitmapEx.IsTransparent(); + mbIsAlpha = maBitmapEx.IsAlpha(); // #121194# Todo: use alpha channel, too (for 3d) maBitmap = maBitmapEx.GetBitmap(); - if(mbIsTransparent) + if(mbIsAlpha) { - if(maBitmapEx.IsAlpha()) - { - mbIsAlpha = true; - maTransparence = rBitmapEx.GetAlpha().GetBitmap(); - } - else - { - maTransparence = rBitmapEx.GetMask(); - } - + maTransparence = rBitmapEx.GetAlpha().GetBitmap(); mpReadTransparence = Bitmap::ScopedReadAccess(maTransparence); } @@ -115,32 +105,12 @@ namespace drawinglayer::texture sal_uInt8 GeoTexSvxBitmapEx::impGetTransparence(sal_Int32 rX, sal_Int32 rY) const { - switch(maBitmapEx.GetTransparentType()) + if(mbIsAlpha) { - case TransparentType::NONE: - { - break; - } - case TransparentType::Bitmap: - { - OSL_ENSURE(mpReadTransparence, "OOps, transparence type Bitmap, but no read access created in the constructor (?)"); - const BitmapColor aBitmapColor(mpReadTransparence->GetPixel(rY, rX)); - - if(mbIsAlpha) - { - return aBitmapColor.GetIndex(); - } - else - { - if(0x00 != aBitmapColor.GetIndex()) - { - return 255; - } - } - break; - } + OSL_ENSURE(mpReadTransparence, "OOps, transparence type Bitmap, but no read access created in the constructor (?)"); + const BitmapColor aBitmapColor(mpReadTransparence->GetPixel(rY, rX)); + return aBitmapColor.GetIndex(); } - return 0; } @@ -176,7 +146,7 @@ namespace drawinglayer::texture rBColor = aBSource; - if(mbIsTransparent) + if(mbIsAlpha) { // when we have a transparence, make use of it const sal_uInt8 aLuminance(impGetTransparence(nX, nY)); @@ -200,7 +170,7 @@ namespace drawinglayer::texture if(impIsValid(rUV, nX, nY)) { - if(mbIsTransparent) + if(mbIsAlpha) { // this texture has an alpha part, use it const sal_uInt8 aLuminance(impGetTransparence(nX, nY)); diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx index 588dd9ea1cc5..8b3f3562e35b 100644 --- a/drawinglayer/source/tools/wmfemfhelper.cxx +++ b/drawinglayer/source/tools/wmfemfhelper.cxx @@ -996,7 +996,7 @@ namespace wmfemfhelper // if bitmap visualisation is transparent, maybe background // needs to be filled. Create background - if(aBitmapEx.IsTransparent() + if(aBitmapEx.IsAlpha() || (WallpaperStyle::Tile != eWallpaperStyle && WallpaperStyle::Scale != eWallpaperStyle)) { if(rWallpaper.IsGradient()) |