From 11322ede593f2e28e4eee1fd7ff6c7a88ea78be0 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Tue, 29 Mar 2016 11:34:10 +0000 Subject: [PATCH] Avoid size recalculation if Fl_Browser::textsize() didn't change. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@11464 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Browser_.H | 2 +- src/Fl_Browser.cxx | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/FL/Fl_Browser_.H b/FL/Fl_Browser_.H index 8fb22cae4..613574a01 100644 --- a/FL/Fl_Browser_.H +++ b/FL/Fl_Browser_.H @@ -3,7 +3,7 @@ // // Common browser header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2016 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this diff --git a/src/Fl_Browser.cxx b/src/Fl_Browser.cxx index e8c00174a..d0a9b9989 100644 --- a/src/Fl_Browser.cxx +++ b/src/Fl_Browser.cxx @@ -657,6 +657,9 @@ int Fl_Browser::topline() const { internally for optimization of later item changes. This can be slow if there are many items in the browser. + It returns immediately (w/o recalculation) if \p newSize equals + the current textsize(). + You \e may need to call redraw() to see the effect and to have the scrollbar positions recalculated. @@ -664,6 +667,8 @@ int Fl_Browser::topline() const { unless you really need to \e change the size later. */ void Fl_Browser::textsize(Fl_Fontsize newSize) { + if (newSize == textsize()) + return; // avoid recalculation Fl_Browser_::textsize(newSize); new_list(); full_height_ = 0;