diff options
author | Mike Erwin <significant.bit@gmail.com> | 2016-10-15 02:59:59 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2016-10-15 03:00:31 +0300 |
commit | 4736f1900070449ea1440c3267e943fb1bc4994c (patch) | |
tree | 4ef36d4dad2e966ef1c250b7b653813934dd2a62 /source/blender | |
parent | 3f0c0ed87dc99a62989df86c57150986251abb5e (diff) |
BLF: early exit when drawing empty strings
Avoids all kinds of setup & preparations to draw nothing.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenfont/intern/blf.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index e43d2bba23c..7ddc540044a 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -566,6 +566,10 @@ void BLF_draw_ex( } void BLF_draw(int fontid, const char *str, size_t len) { + if (len == 0 || str[0] == '\0') { + return; + } + BLF_draw_ex(fontid, str, len, NULL); } @@ -591,11 +595,19 @@ void BLF_draw_ascii_ex( } void BLF_draw_ascii(int fontid, const char *str, size_t len) { + if (len == 0 || str[0] == '\0') { + return; + } + BLF_draw_ascii_ex(fontid, str, len, NULL); } int BLF_draw_mono(int fontid, const char *str, size_t len, int cwidth) { + if (len == 0 || str[0] == '\0') { + return 0; + } + FontBLF *font = blf_get(fontid); int columns = 0; |