Fix Unreported: VSE and NLA handle position text is not drawn

When moving strip, or it's handle, text with frame number near handle
should be drawn. This feature was broken by 8d53ead69b, because
function `UI_view2d_text_cache_add` sets all fields of `v2s->rect` to 0.
This case was checked in function `UI_view2d_text_cache_draw`, but it
was not quite obvious.

This commit reverts 8d53ead69b, makes condition for 0 size rectangle
more obvious and adds comment for clarity.

function `UI_view2d_text_cache_add` is only used in NLA and VSE, and
this new condition fits existing use-cases. Status of T97500 is not
affected by this change.
This commit is contained in:
Richard Antalik 2022-09-15 00:54:17 +02:00
parent b5115ed80f
commit f404dd0b3c
1 changed files with 16 additions and 6 deletions

View File

@ -2100,12 +2100,22 @@ void UI_view2d_text_cache_draw(ARegion *region)
col_pack_prev = v2s->col.pack;
}
BLF_enable(font_id, BLF_CLIPPING);
BLF_clipping(
font_id, v2s->rect.xmin - 4, v2s->rect.ymin - 4, v2s->rect.xmax + 4, v2s->rect.ymax + 4);
BLF_draw_default(
v2s->rect.xmin + xofs, v2s->rect.ymin + yofs, 0.0f, v2s->str, BLF_DRAW_STR_DUMMY_MAX);
BLF_disable(font_id, BLF_CLIPPING);
/* Don't use clipping if `v2s->rect` is not set. */
if (BLI_rcti_size_x(&v2s->rect) == 0 && BLI_rcti_size_y(&v2s->rect) == 0) {
BLF_draw_default((float)(v2s->mval[0] + xofs),
(float)(v2s->mval[1] + yofs),
0.0,
v2s->str,
BLF_DRAW_STR_DUMMY_MAX);
}
else {
BLF_enable(font_id, BLF_CLIPPING);
BLF_clipping(
font_id, v2s->rect.xmin - 4, v2s->rect.ymin - 4, v2s->rect.xmax + 4, v2s->rect.ymax + 4);
BLF_draw_default(
v2s->rect.xmin + xofs, v2s->rect.ymin + yofs, 0.0f, v2s->str, BLF_DRAW_STR_DUMMY_MAX);
BLF_disable(font_id, BLF_CLIPPING);
}
}
g_v2d_strings = nullptr;