drawinglayer/inc/texture/texture3d.hxx | 9 +--- drawinglayer/source/processor3d/defaultprocessor3d.cxx | 4 +- drawinglayer/source/texture/texture3d.cxx | 31 ++++------------- 3 files changed, 14 insertions(+), 30 deletions(-)
New commits: commit 805ef97f521f1f65d833f9db23c56b225b4d78e1 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Aug 12 22:19:45 2025 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Wed Aug 13 14:30:28 2025 +0200 BitmapEx->Bitmap in GeoTexSvx now that Bitmap supports transparency Change-Id: Icb6dad0921079144e3c6b76014f129e205a0f27c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189455 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/drawinglayer/inc/texture/texture3d.hxx b/drawinglayer/inc/texture/texture3d.hxx index 324c204ed526..732e125e553b 100644 --- a/drawinglayer/inc/texture/texture3d.hxx +++ b/drawinglayer/inc/texture/texture3d.hxx @@ -52,11 +52,8 @@ namespace drawinglayer::texture class GeoTexSvxBitmapEx : public GeoTexSvx { protected: - BitmapEx maBitmapEx; - Bitmap maBitmap; // Bitmap held within maBitmapEx, to exist during mpReadBitmap scope + Bitmap maBitmap; BitmapScopedReadAccess mpReadBitmap; - Bitmap maTransparence; - BitmapScopedReadAccess mpReadTransparence; basegfx::B2DPoint maTopLeft; basegfx::B2DVector maSize; double mfMulX; @@ -68,7 +65,7 @@ namespace drawinglayer::texture public: GeoTexSvxBitmapEx( - const BitmapEx& rBitmapEx, + const Bitmap& rBitmap, const basegfx::B2DRange& rRange); virtual ~GeoTexSvxBitmapEx() override; @@ -93,7 +90,7 @@ namespace drawinglayer::texture public: GeoTexSvxBitmapExTiled( - const BitmapEx& rBitmapEx, + const Bitmap& rBitmap, const basegfx::B2DRange& rRange, double fOffsetX, double fOffsetY); diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index 91f394eb6127..79c40e5614d4 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -246,7 +246,7 @@ namespace drawinglayer::processor3d { mpGeoTexSvx = std::make_shared<texture::GeoTexSvxBitmapExTiled>( - aBitmapEx, + Bitmap(aBitmapEx), aGraphicRange, rFillGraphicAttribute.getOffsetX(), rFillGraphicAttribute.getOffsetY()); @@ -255,7 +255,7 @@ namespace drawinglayer::processor3d { mpGeoTexSvx = std::make_shared<texture::GeoTexSvxBitmapEx>( - aBitmapEx, + Bitmap(aBitmapEx), aGraphicRange); } diff --git a/drawinglayer/source/texture/texture3d.cxx b/drawinglayer/source/texture/texture3d.cxx index 9566e73abd03..1f4b93e989a6 100644 --- a/drawinglayer/source/texture/texture3d.cxx +++ b/drawinglayer/source/texture/texture3d.cxx @@ -59,27 +59,14 @@ namespace drawinglayer::texture GeoTexSvxBitmapEx::GeoTexSvxBitmapEx( - const BitmapEx& rBitmapEx, + const Bitmap& rBitmap, const basegfx::B2DRange& rRange) - : maBitmapEx(rBitmapEx), + : maBitmap(rBitmap), maTopLeft(rRange.getMinimum()), maSize(rRange.getRange()), mfMulX(0.0), mfMulY(0.0) { - bool bIsAlpha(maBitmapEx.IsAlpha()); - if(vcl::bitmap::convertBitmap32To24Plus8(maBitmapEx,maBitmapEx)) - bIsAlpha = maBitmapEx.IsAlpha(); - // #121194# Todo: use alpha channel, too (for 3d) - maBitmap = maBitmapEx.GetBitmap(); - - if (bIsAlpha) - { - maTransparence = rBitmapEx.GetAlphaMask().GetBitmap(); - mpReadTransparence = maTransparence; - OSL_ENSURE(mpReadTransparence, "OOps, transparence type Bitmap, but no read access created in the constructor (?)"); - } - if (!maBitmap.IsEmpty()) mpReadBitmap = maBitmap; SAL_WARN_IF(!mpReadBitmap, "drawinglayer", "GeoTexSvxBitmapEx: Got no read access to Bitmap"); @@ -143,10 +130,10 @@ namespace drawinglayer::texture rBColor = aBSource; - if (mpReadTransparence) + if (maBitmap.HasAlpha()) { // when we have alpha, make use of it - const sal_uInt8 aAlpha(impGetAlpha(*mpReadTransparence, nX, nY)); + const sal_uInt8 aAlpha(aBMCol.GetAlpha()); rfOpacity = (static_cast<double>(aAlpha) * (1.0 / 255.0)); } @@ -167,10 +154,11 @@ namespace drawinglayer::texture if(impIsValid(rUV, nX, nY)) { - if (mpReadTransparence) + const BitmapColor aBMCol(mpReadBitmap->GetColor(nY, nX)); + if (maBitmap.HasAlpha()) { // this texture has an alpha part, use it - const sal_uInt8 aAlpha(impGetAlpha(*mpReadTransparence, nX, nY)); + const sal_uInt8 aAlpha(aBMCol.GetAlpha()); const double fNewOpacity(static_cast<double>(aAlpha) * (1.0 / 255.0)); rfOpacity = 1.0 - ((1.0 - fNewOpacity) * (1.0 - rfOpacity)); @@ -178,7 +166,6 @@ namespace drawinglayer::texture else { // this texture is a color bitmap used as transparence map - const BitmapColor aBMCol(mpReadBitmap->GetColor(nY, nX)); const Color aColor(aBMCol.GetRed(), aBMCol.GetGreen(), aBMCol.GetBlue()); rfOpacity = (static_cast<double>(0xff - aColor.GetLuminance()) * (1.0 / 255.0)); @@ -232,11 +219,11 @@ namespace drawinglayer::texture } GeoTexSvxBitmapExTiled::GeoTexSvxBitmapExTiled( - const BitmapEx& rBitmapEx, + const Bitmap& rBitmap, const basegfx::B2DRange& rRange, double fOffsetX, double fOffsetY) - : GeoTexSvxBitmapEx(rBitmapEx, rRange), + : GeoTexSvxBitmapEx(rBitmap, rRange), mfOffsetX(std::clamp(fOffsetX, 0.0, 1.0)), mfOffsetY(std::clamp(fOffsetY, 0.0, 1.0)), mbUseOffsetX(!basegfx::fTools::equalZero(mfOffsetX)),