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-08-20 19:29:02 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-20 19:29:02 +0400
commit26f073b327ac31d683e1719ce8371b6e28bf01d6 (patch)
treefecb4fdc3f279436ab3814e60266633ba02de50a /source/blender/blenfont
parent831eaf2d7feb63ee6df55a2b00e1d76f793c0a5c (diff)
macros for rectangle center and size
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/intern/blf_font.c6
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index dcefcc68d23..751c2f5043b 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -425,8 +425,8 @@ void blf_font_width_and_height(FontBLF *font, const char *str, float *width, flo
}
blf_font_boundbox(font, str, &box);
- *width = ((box.xmax - box.xmin) * xa);
- *height = ((box.ymax - box.ymin) * ya);
+ *width = (BLI_RCT_SIZE_X(&box) * xa);
+ *height = (BLI_RCT_SIZE_Y(&box) * ya);
}
float blf_font_width(FontBLF *font, const char *str)
@@ -440,7 +440,7 @@ float blf_font_width(FontBLF *font, const char *str)
xa = 1.0f;
blf_font_boundbox(font, str, &box);
- return (box.xmax - box.xmin) * xa;
+ return BLI_RCT_SIZE_X(&box) * xa;
}
float blf_font_height(FontBLF *font, const char *str)
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 39945bf19b0..3e871fefff8 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -412,7 +412,7 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
g->uv[1][1] = ((float)(g->yoff + g->height)) / ((float)gc->p2_height);
/* update the x offset for the next glyph. */
- gc->x_offs += (int)(g->box.xmax - g->box.xmin + gc->pad);
+ gc->x_offs += (int)(BLI_RCT_SIZE_X(&g->box) + gc->pad);
gc->rem_glyphs--;
g->build_tex = 1;