From ddaaf6d1ae63320e15ce797ca2c0f11a2b539bee Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 18 Feb 2019 14:30:58 +0200 Subject: use boost::optional in SvTreeListEntry it is inefficient to allocate a tiny object like Color separately on the heap Change-Id: Iac2cfc7c00c16240e7cf72e7d8814e97e9f65ac6 Reviewed-on: https://gerrit.libreoffice.org/67967 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/source/app/salvtables.cxx | 2 +- vcl/source/treelist/treelistbox.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'vcl') diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index c7ca128fd818..df7de9561743 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -2233,7 +2233,7 @@ public: virtual void set_font_color(int pos, const Color& rColor) const override { SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos); - pEntry->SetTextColor(&rColor); + pEntry->SetTextColor(rColor); } virtual void remove(int pos) override diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index b069d1d0ea12..aa91551177d8 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -2701,8 +2701,8 @@ void SvTreeListBox::PaintEntry1(SvTreeListEntry& rEntry, long nLine, vcl::Render if (bCurFontIsSel || rEntry.GetTextColor()) { bCurFontIsSel = false; - if (const auto* pCustomTextColor = rEntry.GetTextColor()) - rRenderContext.SetTextColor(*pCustomTextColor); + if (const auto & xCustomTextColor = rEntry.GetTextColor()) + rRenderContext.SetTextColor(*xCustomTextColor); else rRenderContext.SetTextColor(aBackupTextColor); rRenderContext.SetFont(aBackupFont); -- cgit