BMenuField/BTextControl: Store and reuse Label()

This commit is contained in:
John Scipione
2014-04-24 15:31:16 -04:00
parent b11edca47d
commit 60370b9a6c
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -1259,8 +1259,9 @@ BTextControl::_ValidateLayoutData()
font_height& fh = fLayoutData->font_info;
GetFontHeight(&fh);
if (Label() != NULL) {
fLayoutData->label_width = ceilf(StringWidth(Label()));
const char* label = Label();
if (label != NULL) {
fLayoutData->label_width = ceilf(StringWidth(label));
fLayoutData->label_height = ceilf(fh.ascent) + ceilf(fh.descent);
} else {
fLayoutData->label_width = 0;