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:
authorClément Foucault <foucault.clem@gmail.com>2018-04-08 15:40:50 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-04-08 16:57:24 +0300
commitafbc73ab72c3c9d84389e2689021766ad3e73bc6 (patch)
tree8d53be616a106d1467420efe563b1532fd6a6fe2 /source/blender/blenfont
parent47cfdb3c0ce62d3ceba8b52c3cf276e7562e361a (diff)
BLF: Perf: Use BLF_KERNING_STEP_FAST for other functions.
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/intern/blf_font.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 301f06e22b5..c12303dcfc0 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -420,15 +420,15 @@ static void blf_font_draw_ascii_ex(
FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info,
int pen_y)
{
- unsigned char c;
+ unsigned int c, c_prev = BLI_UTF8_ERR;
GlyphBLF *g, *g_prev = NULL;
- FT_Vector delta;
int pen_x = 0;
GlyphBLF **glyph_ascii_table = font->glyph_cache->glyph_ascii_table;
BLF_KERNING_VARS(font, has_kerning, kern_mode);
blf_font_ensure_ascii_table(font);
+ blf_font_ensure_ascii_kerning(font, kern_mode);
blf_batch_draw_begin(font);
@@ -437,13 +437,14 @@ static void blf_font_draw_ascii_ex(
if ((g = glyph_ascii_table[c]) == NULL)
continue;
if (has_kerning)
- BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
+ BLF_KERNING_STEP_FAST(font, kern_mode, g_prev, g, c_prev, c, pen_x);
/* do not return this loop if clipped, we want every character tested */
blf_glyph_render(font, g, (float)pen_x, (float)pen_y);
pen_x += g->advance_i;
g_prev = g;
+ c_prev = c;
}
blf_batch_draw_end();
@@ -501,9 +502,8 @@ static void blf_font_draw_buffer_ex(
FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info,
int pen_y)
{
- unsigned int c;
+ unsigned int c, c_prev = BLI_UTF8_ERR;
GlyphBLF *g, *g_prev = NULL;
- FT_Vector delta;
int pen_x = (int)font->pos[0];
int pen_y_basis = (int)font->pos[1] + pen_y;
size_t i = 0;
@@ -519,6 +519,7 @@ static void blf_font_draw_buffer_ex(
BLF_KERNING_VARS(font, has_kerning, kern_mode);
blf_font_ensure_ascii_table(font);
+ blf_font_ensure_ascii_kerning(font, kern_mode);
/* another buffer specific call for color conversion */
@@ -530,7 +531,7 @@ static void blf_font_draw_buffer_ex(
if (UNLIKELY(g == NULL))
continue;
if (has_kerning)
- BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
+ BLF_KERNING_STEP_FAST(font, kern_mode, g_prev, g, c_prev, c, pen_x);
chx = pen_x + ((int)g->pos_x);
chy = pen_y_basis + g->height;
@@ -632,6 +633,7 @@ static void blf_font_draw_buffer_ex(
pen_x += g->advance_i;
g_prev = g;
+ c_prev = c;
}
if (r_info) {