vcl/source/control/imp_listbox.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit b4f8f43678f04396db70079b304bd86072baceb8
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue Mar 18 11:35:45 2025 +0000
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Mar 19 08:45:10 2025 +0100

    If combobox is UserDraw, then don't bother measuring text
    
    the UserItemSize is all that matters in this case. Which then
    side steps the issue of a sizeable glyph cache in the long
    lived font and styles comboboxes as it no longer gets filled.
    
    cat /proc/<kitbrokerpid>/smaps_rollup |grep Private|awk '{s+=$2} END {print 
s}'
    
    before: 102684 kB
    after:  100552 kB
    
    Change-Id: Ib8a0a149ca49c17c7b1ff47b6b56c52ae28e6eff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183074
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/vcl/source/control/imp_listbox.cxx 
b/vcl/source/control/imp_listbox.cxx
index 488c032a89f6..968c7f9db7d5 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -603,6 +603,8 @@ SalLayoutGlyphs* ImplEntryType::GetTextGlyphs(const 
OutputDevice* pOutputDevice)
 
 void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry )
 {
+    const bool bIsUserDrawEnabled = IsUserDrawEnabled();
+
     ImplEntryMetrics aMetrics;
     aMetrics.bText = !rEntry.maStr.isEmpty();
     aMetrics.bImage = !!rEntry.maImage;
@@ -612,7 +614,7 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( 
ImplEntryType& rEntry )
     aMetrics.nImgWidth = 0;
     aMetrics.nImgHeight = 0;
 
-    if ( aMetrics.bText )
+    if (aMetrics.bText && !bIsUserDrawEnabled)
     {
         if( rEntry.mnFlags & ListBoxEntryFlags::MultiLine )
         {
@@ -657,7 +659,6 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( 
ImplEntryType& rEntry )
 
     }
 
-    bool bIsUserDrawEnabled = IsUserDrawEnabled();
     if (bIsUserDrawEnabled || aMetrics.bImage)
     {
         aMetrics.nEntryWidth = std::max( aMetrics.nImgWidth, 
maUserItemSize.Width() );

Reply via email to