Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-01-11 09:45:39 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-11 09:45:39 +0400
commitcda5d1769d71832a6b04ed6c91bac101c482e5f7 (patch)
tree5e21c9f022cb89f2eb3228132b7ceb643cce1417 /source/blender/editors/interface/interface_widgets.c
parentf1c229e8b3f21f3819f001ce470831147c1b6289 (diff)
minor changes to BLF api use
- replace calls to BLF_width & BLF_height --> BLF_width_and_height - no need to call strlen() on length value passed to BLF_draw(). this already checks for \0 char.
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r--source/blender/editors/interface/interface_widgets.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index d8a34262e81..5618d37712a 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -3264,7 +3264,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state)
{
rcti trect = *rect;
-
+ float font_dims[2] = {0.0f, 0.0f};
uiWidgetType *wt= widget_type(UI_WTYPE_MENU_ITEM);
wt->state(wt, state);
@@ -3276,10 +3276,12 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int
glColor3ubv((unsigned char*)wt->wcol.text);
else
glColor3ubv((unsigned char*)wt->wcol.text_sel);
-
+
+ BLF_width_and_height(fstyle->uifont_id, name, &font_dims[0], &font_dims[1]);
+
trect.xmin += 0;
- trect.xmax = trect.xmin + BLF_width(fstyle->uifont_id, name) + 10;
+ trect.xmax = trect.xmin + font_dims[0] + 10;
trect.ymin += 10;
- trect.ymax = trect.ymin + BLF_height(fstyle->uifont_id, name);
+ trect.ymax = trect.ymin + font_dims[1];
uiStyleFontDraw(fstyle, &trect, name);
}