From 77f47799ddff99da672aa58e5d989237403e7707 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 20 Aug 2012 23:06:17 +0000 Subject: code cleanup: use BLI_RCT_SIZE macro --- source/blender/editors/interface/interface_style.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source/blender/editors/interface/interface_style.c') diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 779341160c5..ee0613ea0d0 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -152,17 +152,17 @@ void uiStyleFontDrawExt(uiFontStyle *fs, rcti *rect, const char *str, uiStyleFontSet(fs); height = BLF_ascender(fs->uifont_id); - yofs = ceil(0.5f * (rect->ymax - rect->ymin - height)); + yofs = ceil(0.5f * (BLI_RCT_SIZE_Y(rect) - height)); if (fs->align == UI_STYLE_TEXT_CENTER) { - xofs = floor(0.5f * (rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str))); + xofs = floor(0.5f * (BLI_RCT_SIZE_X(rect) - BLF_width(fs->uifont_id, str))); /* don't center text if it chops off the start of the text, 2 gives some margin */ if (xofs < 2) { xofs = 2; } } else if (fs->align == UI_STYLE_TEXT_RIGHT) { - xofs = rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str) - 1; + xofs = BLI_RCT_SIZE_X(rect) - BLF_width(fs->uifont_id, str) - 1; } /* clip is very strict, so we give it some space */ @@ -209,7 +209,7 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str) height = BLF_ascender(fs->uifont_id); /* becomes x-offset when rotated */ - xofs = ceil(0.5f * (rect->ymax - rect->ymin - height)); + xofs = ceil(0.5f * (BLI_RCT_SIZE_Y(rect) - height)); /* ignore UI_STYLE, always aligned to top */ @@ -219,8 +219,8 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str) angle = 90.0f; /* translate rect to vertical */ - txtrect.xmin = rect->xmin - (rect->ymax - rect->ymin); - txtrect.ymin = rect->ymin - (rect->xmax - rect->xmin); + txtrect.xmin = rect->xmin - BLI_RCT_SIZE_Y(rect); + txtrect.ymin = rect->ymin - BLI_RCT_SIZE_X(rect); txtrect.xmax = rect->xmin; txtrect.ymax = rect->ymin; -- cgit v1.2.3