BLF: early exit when drawing empty strings

Avoids all kinds of setup & preparations to draw nothing.
This commit is contained in:
Mike Erwin 2016-10-14 19:59:59 -04:00
parent 3f0c0ed87d
commit 4736f19000
1 changed files with 12 additions and 0 deletions

View File

@ -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;