diff options
author | Richard Antalik <richardantalik@gmail.com> | 2022-09-15 01:54:17 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2022-09-15 02:12:16 +0300 |
commit | f404dd0b3c7732379a83b55362c49e2ad15bca25 (patch) | |
tree | 7280d37e19d583ef90e3ba724915c60bd8c90fc1 /source/blender/editors/interface/view2d.cc | |
parent | b5115ed80f197af3f0298f3c2a1e5d177804f9c4 (diff) |
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 8d53ead69bb5, 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 8d53ead69bb5, 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.
Diffstat (limited to 'source/blender/editors/interface/view2d.cc')
-rw-r--r-- | source/blender/editors/interface/view2d.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/editors/interface/view2d.cc b/source/blender/editors/interface/view2d.cc index bb459f227f9..b5a86ebe18b 100644 --- a/source/blender/editors/interface/view2d.cc +++ b/source/blender/editors/interface/view2d.cc @@ -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; |