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
This commit is contained in:
Stephan Aßmus 2010-09-08 21:14:31 +00:00
parent 4e57cee58b
commit 38c4dc0eaa

View File

@ -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();
}