diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-21 03:06:17 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-21 03:06:17 +0400 |
commit | 77f47799ddff99da672aa58e5d989237403e7707 (patch) | |
tree | 951fa8eb0d6853355b697cc262ed92ddd9dd7a83 /source/blender/editors/interface/interface_style.c | |
parent | 94ce9505a9bf07e3d2532c82a0b8396f7c9727b3 (diff) |
code cleanup: use BLI_RCT_SIZE macro
Diffstat (limited to 'source/blender/editors/interface/interface_style.c')
-rw-r--r-- | source/blender/editors/interface/interface_style.c | 12 |
1 files changed, 6 insertions, 6 deletions
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; |