From dce9ef4e739acb7439d853da4519deb408348490 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 6 Aug 2025 09:09:03 +0200 Subject: [PATCH] BitmapEx->Bitmap in SdrHdl now that Bitmap supports transparency Change-Id: I928e05c94da01ddae8760cd71299902d68096acc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188991 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/svx/svdhdl.hxx | 2 +- .../sdr/contact/viewcontactofsdrobj.cxx | 2 +- svx/source/svdraw/svddrgmt.cxx | 2 +- svx/source/svdraw/svdhdl.cxx | 50 +++++++++---------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/svx/svdhdl.hxx b/include/svx/svdhdl.hxx index 3b527c8d3bba..77af5d18f911 100644 --- a/include/svx/svdhdl.hxx +++ b/include/svx/svdhdl.hxx @@ -243,7 +243,7 @@ public: visualisation during mouse over it must override this method and call Touch(). */ virtual void onMouseLeave(); - SAL_DLLPRIVATE static BitmapEx createGluePointBitmap(); + SAL_DLLPRIVATE static Bitmap createGluePointBitmap(); }; diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx index 5f13af5cbe65..13986c236b73 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx @@ -145,7 +145,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContactOfSdrObj::createGlueP { const drawinglayer::primitive2d::Primitive2DReference xReference( new drawinglayer::primitive2d::MarkerArrayPrimitive2D( - std::move(aGluepointVector), SdrHdl::createGluePointBitmap())); + std::move(aGluepointVector), BitmapEx(SdrHdl::createGluePointBitmap()))); xRetval = drawinglayer::primitive2d::Primitive2DContainer{ xReference }; } } diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 938bcefa005d..d0b956520bb4 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -264,7 +264,7 @@ drawinglayer::primitive2d::Primitive2DContainer SdrDragEntryPointGlueDrag::creat { aRetval = drawinglayer::primitive2d::Primitive2DContainer { new drawinglayer::primitive2d::MarkerArrayPrimitive2D(std::move(aTransformedPositions), - SdrHdl::createGluePointBitmap()) + BitmapEx(SdrHdl::createGluePointBitmap())) }; } } diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 2d15d9aa0a8c..509a26d252b0 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -81,18 +81,18 @@ namespace { class SdrHdlBitmapSet { // the bitmap holding all information - BitmapEx maMarkersBitmap; + Bitmap maMarkersBitmap; // the cropped Bitmaps for reusage - ::std::vector< BitmapEx > maRealMarkers; + ::std::vector< Bitmap > maRealMarkers; // helpers - BitmapEx& impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const tools::Rectangle& rRectangle); + Bitmap& impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const tools::Rectangle& rRectangle); public: explicit SdrHdlBitmapSet(); - const BitmapEx& GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd); + const Bitmap& GetBitmap(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd); }; } @@ -102,15 +102,15 @@ public: #define INDIVIDUAL_COUNT (5) SdrHdlBitmapSet::SdrHdlBitmapSet() - : maMarkersBitmap(SIP_SA_MARKERS), + : maMarkersBitmap(BitmapEx(SIP_SA_MARKERS)), // 15 kinds (BitmapMarkerKind) use index [0..5] + 5 extra maRealMarkers((KIND_COUNT * INDEX_COUNT) + INDIVIDUAL_COUNT) { } -BitmapEx& SdrHdlBitmapSet::impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const tools::Rectangle& rRectangle) +Bitmap& SdrHdlBitmapSet::impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const tools::Rectangle& rRectangle) { - BitmapEx& rTargetBitmap = maRealMarkers[nIndex]; + Bitmap& rTargetBitmap = maRealMarkers[nIndex]; if(rTargetBitmap.IsEmpty()) { @@ -122,7 +122,7 @@ BitmapEx& SdrHdlBitmapSet::impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const t } // change getting of bitmap to use the big resource bitmap -const BitmapEx& SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd) +const Bitmap& SdrHdlBitmapSet::GetBitmap(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd) { // fill in size and source position in maMarkersBitmap const sal_uInt16 nYPos(nInd * 11); @@ -743,7 +743,7 @@ OUString appendMarkerColor(BitmapColorIndex eIndex) return OUString(); } -BitmapEx ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, BitmapColorIndex eIndex) +Bitmap ImpGetBitmap(BitmapMarkerKind eKindOfMarker, BitmapColorIndex eIndex) { // use this code path only when we use HiDPI (for now) if (Application::GetDefaultDevice()->GetDPIScalePercentage() > 100) @@ -770,14 +770,14 @@ BitmapEx ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, BitmapColorIndex eIndex) } if (!aBitmapEx.IsEmpty()) - return aBitmapEx; + return Bitmap(aBitmapEx); } } // if we can't load the marker... static tools::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet {}; - return aModernSet.get()->GetBitmapEx(eKindOfMarker, sal_uInt16(eIndex)); + return aModernSet.get()->GetBitmap(eKindOfMarker, sal_uInt16(eIndex)); } } // end anonymous namespace @@ -851,8 +851,8 @@ std::unique_ptr SdrHdl::CreateOverlayObject( } // create animated handle - BitmapEx aBmpEx1 = ImpGetBitmapEx(eKindOfMarker, eColIndex); - BitmapEx aBmpEx2 = ImpGetBitmapEx(eNextBigger, eColIndex); + Bitmap aBmp1 = ImpGetBitmap(eKindOfMarker, eColIndex); + Bitmap aBmp2 = ImpGetBitmap(eNextBigger, eColIndex); // #i53216# Use system cursor blink time. Use the unsigned value. const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); @@ -861,29 +861,29 @@ std::unique_ptr SdrHdl::CreateOverlayObject( if(eKindOfMarker == BitmapMarkerKind::Anchor || eKindOfMarker == BitmapMarkerKind::AnchorPressed) { // when anchor is used take upper left as reference point inside the handle - pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, Bitmap(aBmpEx1), Bitmap(aBmpEx2), nBlinkTime)); + pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmp1, aBmp2, nBlinkTime)); } else if(eKindOfMarker == BitmapMarkerKind::AnchorTR || eKindOfMarker == BitmapMarkerKind::AnchorPressedTR) { // AnchorTR for SW, take top right as (0,0) - pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, Bitmap(aBmpEx1), Bitmap(aBmpEx2), nBlinkTime, - static_cast(aBmpEx1.GetSizePixel().Width() - 1), 0, - static_cast(aBmpEx2.GetSizePixel().Width() - 1), 0)); + pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmp1, aBmp2, nBlinkTime, + static_cast(aBmp1.GetSizePixel().Width() - 1), 0, + static_cast(aBmp2.GetSizePixel().Width() - 1), 0)); } else { // create centered handle as default - pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, Bitmap(aBmpEx1), Bitmap(aBmpEx2), nBlinkTime, - static_cast(aBmpEx1.GetSizePixel().Width() - 1) >> 1, - static_cast(aBmpEx1.GetSizePixel().Height() - 1) >> 1, - static_cast(aBmpEx2.GetSizePixel().Width() - 1) >> 1, - static_cast(aBmpEx2.GetSizePixel().Height() - 1) >> 1)); + pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmp1, aBmp2, nBlinkTime, + static_cast(aBmp1.GetSizePixel().Width() - 1) >> 1, + static_cast(aBmp1.GetSizePixel().Height() - 1) >> 1, + static_cast(aBmp2.GetSizePixel().Width() - 1) >> 1, + static_cast(aBmp2.GetSizePixel().Height() - 1) >> 1)); } } else { // create normal handle: use ImpGetBitmapEx(...) now - Bitmap aBmp(ImpGetBitmapEx(eKindOfMarker, eColIndex)); + Bitmap aBmp(ImpGetBitmap(eKindOfMarker, eColIndex)); // When the image with handles is not found, the bitmap returned is // empty. This is a problem when we use LibreOffice as a library @@ -1068,9 +1068,9 @@ void SdrHdl::onMouseLeave() { } -BitmapEx SdrHdl::createGluePointBitmap() +Bitmap SdrHdl::createGluePointBitmap() { - return ImpGetBitmapEx(BitmapMarkerKind::Glue_Deselected, BitmapColorIndex::LightGreen); + return ImpGetBitmap(BitmapMarkerKind::Glue_Deselected, BitmapColorIndex::LightGreen); } void SdrHdl::insertNewlyCreatedOverlayObjectForSdrHdl(