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
This commit is contained in:
2021-08-25 13:30:00 -07:00
parent 518b97e674
commit 5b751c95f4
15 changed files with 36 additions and 147 deletions

View File

@@ -333,14 +333,8 @@ void OVERLAY_edit_uv_cache_init(OVERLAY_Data *vedata)
BLI_snprintf(text, 5, "%d", tile->tile_number);
float tile_location[3] = {
((tile->tile_number - 1001) % 10), ((tile->tile_number - 1001) / 10), 0.0f};
DRW_text_cache_add(dt,
tile_location,
text,
strlen(text),
10,
10,
DRW_TEXT_CACHE_GLOBALSPACE | DRW_TEXT_CACHE_ASCII,
color);
DRW_text_cache_add(
dt, tile_location, text, strlen(text), 10, 10, DRW_TEXT_CACHE_GLOBALSPACE, color);
}
}

View File

@@ -130,7 +130,7 @@ static void motion_path_cache(OVERLAY_Data *vedata,
OVERLAY_PrivateData *pd = vedata->stl->pd;
const DRWContextState *draw_ctx = DRW_context_state_get();
struct DRWTextStore *dt = DRW_text_cache_ensure();
int txt_flag = DRW_TEXT_CACHE_GLOBALSPACE | DRW_TEXT_CACHE_ASCII;
int txt_flag = DRW_TEXT_CACHE_GLOBALSPACE;
int cfra = (int)DEG_get_ctime(draw_ctx->depsgraph);
bool selected = (pchan) ? (pchan->bone->flag & BONE_SELECTED) : (ob->base_flag & BASE_SELECTED);
bool show_keyframes = (avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) != 0;

View File

@@ -209,16 +209,16 @@ void DRW_stats_reset(void)
static void draw_stat_5row(const rcti *rect, int u, int v, const char *txt, const int size)
{
BLF_draw_default_ascii(rect->xmin + (1 + u * 5) * U.widget_unit,
rect->ymax - (3 + v) * U.widget_unit,
0.0f,
txt,
size);
BLF_draw_default(rect->xmin + (1 + u * 5) * U.widget_unit,
rect->ymax - (3 + v) * U.widget_unit,
0.0f,
txt,
size);
}
static void draw_stat(const rcti *rect, int u, int v, const char *txt, const int size)
{
BLF_draw_default_ascii(
BLF_draw_default(
rect->xmin + (1 + u) * U.widget_unit, rect->ymax - (3 + v) * U.widget_unit, 0.0f, txt, size);
}

View File

@@ -152,11 +152,9 @@ static void drw_text_cache_draw_ex(DRWTextStore *dt, ARegion *region)
BLF_position(
font_id, (float)(vos->sco[0] + vos->xoffs), (float)(vos->sco[1] + vos->yoffs), 2.0f);
((vos->flag & DRW_TEXT_CACHE_ASCII) ? BLF_draw_ascii : BLF_draw)(
font_id,
(vos->flag & DRW_TEXT_CACHE_STRING_PTR) ? *((const char **)vos->str) : vos->str,
vos->str_len);
BLF_draw(font_id,
(vos->flag & DRW_TEXT_CACHE_STRING_PTR) ? *((const char **)vos->str) : vos->str,
vos->str_len);
}
}
@@ -235,7 +233,7 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region,
* etc.). See bug T36090.
*/
struct DRWTextStore *dt = DRW_text_cache_ensure();
const short txt_flag = DRW_TEXT_CACHE_GLOBALSPACE | (unit->system ? 0 : DRW_TEXT_CACHE_ASCII);
const short txt_flag = DRW_TEXT_CACHE_GLOBALSPACE;
Mesh *me = ob->data;
BMEditMesh *em = me->edit_mesh;
float v1[3], v2[3], v3[3], vmid[3], fvec[3];

View File

@@ -48,7 +48,7 @@ void DRW_text_edit_mesh_measure_stats(struct ARegion *region,
const struct UnitSettings *unit);
enum {
DRW_TEXT_CACHE_ASCII = (1 << 0),
// DRW_UNUSED_1 = (1 << 0), /* dirty */
DRW_TEXT_CACHE_GLOBALSPACE = (1 << 1),
DRW_TEXT_CACHE_LOCALCLIP = (1 << 2),
/* reference the string by pointer */