From f9772bee2bc95a5b1880286dfb255e026cbd8a1e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 7 Feb 2024 09:16:14 +0200 Subject: simplify some Primitive2DContainer construction Change-Id: Iced31da6891a5d218d63e9b59d48fb2645f39203 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163071 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/ui/view/hintwin.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/view/hintwin.cxx b/sc/source/ui/view/hintwin.cxx index d57d8e0b787f..7a287ed25c77 100644 --- a/sc/source/ui/view/hintwin.cxx +++ b/sc/source/ui/view/hintwin.cxx @@ -92,7 +92,8 @@ drawinglayer::primitive2d::Primitive2DContainer ScOverlayHint::createOverlaySequ drawinglayer::geometry::ViewInformation2D aDummy; rRange.expand(pTitle->getB2DRange(aDummy)); - drawinglayer::primitive2d::Primitive2DContainer aSeq { pTitle }; + // insert two empty elements as placeholders for bg and border + drawinglayer::primitive2d::Primitive2DContainer aSeq { nullptr, nullptr, pTitle }; aFontMetric = pDefaultDev->GetFontMetric(aTextFont); pDefaultDev->SetMapMode(aOld); @@ -145,16 +146,16 @@ drawinglayer::primitive2d::Primitive2DContainer ScOverlayHint::createOverlaySequ basegfx::B2DPolygon aPoly(basegfx::utils::createPolygonFromRect(rRange)); - const drawinglayer::primitive2d::Primitive2DReference aBg( + drawinglayer::primitive2d::Primitive2DReference aBg( new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPoly), getBaseColor().getBColor())); basegfx::BColor aBorderColor(0.5, 0.5, 0.5); - const drawinglayer::primitive2d::Primitive2DReference aBorder( + drawinglayer::primitive2d::Primitive2DReference aBorder( new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( std::move(aPoly), aBorderColor)); - aSeq.insert(aSeq.begin(), aBorder); - aSeq.insert(aSeq.begin(), aBg); + aSeq[0] = aBg; + aSeq[1] = aBorder; return aSeq; } -- cgit