Revision: 39094 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39094 Author: campbellbarton Date: 2011-08-06 06:38:18 +0000 (Sat, 06 Aug 2011) Log Message: ----------- for UI text drawing use BLF_ascender(fs->uifont_id) rather then BLF_height(fs->uifont_id, "2"), while profiling draw noticed that the hash lookup on the character and utf8 next were being called on every text draw, use BLF_ascender since it doesn't do any lookups.
Modified Paths: -------------- trunk/blender/source/blender/editors/interface/interface_style.c Modified: trunk/blender/source/blender/editors/interface/interface_style.c =================================================================== --- trunk/blender/source/blender/editors/interface/interface_style.c 2011-08-06 06:11:31 UTC (rev 39093) +++ trunk/blender/source/blender/editors/interface/interface_style.c 2011-08-06 06:38:18 UTC (rev 39094) @@ -149,10 +149,10 @@ int xofs=0, yofs; uiStyleFontSet(fs); - - height= BLF_height(fs->uifont_id, "2"); /* correct offset is on baseline, the j is below that */ - yofs= floor( 0.5f*(rect->ymax - rect->ymin - height)); + height= BLF_ascender(fs->uifont_id); + yofs= ceil( 0.5f*(rect->ymax - rect->ymin - height)); + if(fs->align==UI_STYLE_TEXT_CENTER) { xofs= floor( 0.5f*(rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str))); /* don't center text if it chops off the start of the text, 2 gives some margin */ @@ -206,9 +206,9 @@ uiStyleFontSet(fs); - height= BLF_height(fs->uifont_id, "2"); /* correct offset is on baseline, the j is below that */ + height= BLF_ascender(fs->uifont_id); /* becomes x-offset when rotated */ - xofs= floor( 0.5f*(rect->ymax - rect->ymin - height)) + 1; + xofs= ceil( 0.5f*(rect->ymax - rect->ymin - height)); /* ignore UI_STYLE, always aligned to top */ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs