From 38c4dc0eaa584bf8294b354d41f9851ea0e4a04f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 8 Sep 2010 21:14:31 +0000 Subject: [PATCH] Small improvement in efficiency, don't invalidate the layout when the string width did not change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38589 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/StringView.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/kits/interface/StringView.cpp b/src/kits/interface/StringView.cpp index 1bf2c503c9..d168908958 100644 --- a/src/kits/interface/StringView.cpp +++ b/src/kits/interface/StringView.cpp @@ -294,10 +294,14 @@ BStringView::SetText(const char* text) if ((text && fText && !strcmp(text, fText)) || (!text && !fText)) return; + float oldWidth = StringWidth(fText); + free(fText); fText = text ? strdup(text) : NULL; - InvalidateLayout(); + if (oldWidth != StringWidth(fText)) + InvalidateLayout(); + Invalidate(); }