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:
authorHarley Acheson <harley.acheson@gmail.com>2021-08-25 23:30:00 +0300
committerHarley Acheson <harley.acheson@gmail.com>2021-08-25 23:30:00 +0300
commit5b751c95f4e58c5f56b1af61c835b4537f19f43c (patch)
tree139e884c0d42c20af4394c893a3e8d5904371e9b /source/blender/blenfont
parent518b97e674a9e7cdc91bc4048a89eb8a8b37db0b (diff)
BLF: Remove ASCII-only Code Paths
Remove redundant code for drawing text strings that contain only ASCII. See D12293 for much more detail. Differential Revision: https://developer.blender.org/D12293 Reviewed by Campbell Barton
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/BLF_api.h5
-rw-r--r--source/blender/blenfont/intern/blf.c28
-rw-r--r--source/blender/blenfont/intern/blf_default.c11
-rw-r--r--source/blender/blenfont/intern/blf_font.c50
4 files changed, 0 insertions, 94 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index 4de7e704a7e..78252bdb08b 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -101,9 +101,6 @@ void BLF_batch_draw_end(void);
void BLF_draw_ex(int fontid, const char *str, size_t str_len, struct ResultBLF *r_info)
ATTR_NONNULL(2);
void BLF_draw(int fontid, const char *str, size_t str_len) ATTR_NONNULL(2);
-void BLF_draw_ascii_ex(int fontid, const char *str, size_t str_len, struct ResultBLF *r_info)
- ATTR_NONNULL(2);
-void BLF_draw_ascii(int fontid, const char *str, size_t str_len) ATTR_NONNULL(2);
int BLF_draw_mono(int fontid, const char *str, size_t str_len, int cwidth) ATTR_NONNULL(2);
typedef bool (*BLF_GlyphBoundsFn)(const char *str,
@@ -257,8 +254,6 @@ void BLF_default_set(int fontid);
int BLF_default(void); /* get default font ID so we can pass it to other functions */
/* Draw the string using the default font, size and dpi. */
void BLF_draw_default(float x, float y, float z, const char *str, size_t str_len) ATTR_NONNULL();
-void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t str_len)
- ATTR_NONNULL();
/* Set size and DPI, and return default font ID. */
int BLF_set_default(void);
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 86d67c80fd4..34ddb6f22d2 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -550,34 +550,6 @@ void BLF_draw(int fontid, const char *str, const size_t str_len)
BLF_draw_ex(fontid, str, str_len, NULL);
}
-void BLF_draw_ascii_ex(int fontid, const char *str, const size_t str_len, struct ResultBLF *r_info)
-{
- FontBLF *font = blf_get(fontid);
-
- BLF_RESULT_CHECK_INIT(r_info);
-
- if (font) {
- blf_draw_gl__start(font);
- if (font->flags & BLF_WORD_WRAP) {
- /* Use non-ASCII draw function for word-wrap. */
- blf_font_draw__wrap(font, str, str_len, r_info);
- }
- else {
- blf_font_draw_ascii(font, str, str_len, r_info);
- }
- blf_draw_gl__end(font);
- }
-}
-
-void BLF_draw_ascii(int fontid, const char *str, const size_t str_len)
-{
- if (str_len == 0 || str[0] == '\0') {
- return;
- }
-
- BLF_draw_ascii_ex(fontid, str, str_len, NULL);
-}
-
int BLF_draw_mono(int fontid, const char *str, const size_t str_len, int cwidth)
{
if (str_len == 0 || str[0] == '\0') {
diff --git a/source/blender/blenfont/intern/blf_default.c b/source/blender/blenfont/intern/blf_default.c
index 1b458e8aaef..2bac0bf8904 100644
--- a/source/blender/blenfont/intern/blf_default.c
+++ b/source/blender/blenfont/intern/blf_default.c
@@ -77,14 +77,3 @@ void BLF_draw_default(float x, float y, float z, const char *str, const size_t s
BLF_position(global_font_default, x, y, z);
BLF_draw(global_font_default, str, str_len);
}
-
-/* same as above but call 'BLF_draw_ascii' */
-void BLF_draw_default_ascii(float x, float y, float z, const char *str, const size_t str_len)
-{
- ASSERT_DEFAULT_SET;
-
- const uiStyle *style = UI_style_get();
- BLF_size(global_font_default, style->widgetlabel.points, global_font_dpi);
- BLF_position(global_font_default, x, y, z);
- BLF_draw_ascii(global_font_default, str, str_len); /* XXX, use real length */
-}
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 426008c9395..dbcd1d6016d 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -412,56 +412,6 @@ void blf_font_draw(FontBLF *font, const char *str, const size_t str_len, struct
blf_glyph_cache_release(font);
}
-/* faster version of blf_font_draw, ascii only for view dimensions */
-static void blf_font_draw_ascii_ex(
- FontBLF *font, const char *str, size_t str_len, struct ResultBLF *r_info, int pen_y)
-{
- unsigned int c, c_prev = BLI_UTF8_ERR;
- GlyphBLF *g, *g_prev = NULL;
- int pen_x = 0;
-
- GlyphCacheBLF *gc = blf_glyph_cache_acquire(font);
-
- blf_batch_draw_begin(font);
-
- while ((c = *(str++)) && str_len--) {
- BLI_assert(c < GLYPH_ASCII_TABLE_SIZE);
- g = gc->glyph_ascii_table[c];
- if (UNLIKELY(g == NULL)) {
- g = blf_glyph_add(font, gc, FT_Get_Char_Index((font)->face, c), c);
- gc->glyph_ascii_table[c] = g;
- if (UNLIKELY(g == NULL)) {
- continue;
- }
- }
- blf_kerning_step_fast(font, g_prev, g, c_prev, c, &pen_x);
-
- /* do not return this loop if clipped, we want every character tested */
- blf_glyph_render(font, gc, g, (float)pen_x, (float)pen_y);
-
- pen_x += g->advance_i;
- g_prev = g;
- c_prev = c;
- }
-
- blf_batch_draw_end();
-
- if (r_info) {
- r_info->lines = 1;
- r_info->width = pen_x;
- }
-
- blf_glyph_cache_release(font);
-}
-
-void blf_font_draw_ascii(FontBLF *font,
- const char *str,
- const size_t str_len,
- struct ResultBLF *r_info)
-{
- blf_font_draw_ascii_ex(font, str, str_len, r_info, 0);
-}
-
/* use fixed column width, but an utf8 character may occupy multiple columns */
int blf_font_draw_mono(FontBLF *font, const char *str, const size_t str_len, int cwidth)
{