diff options
author | Pablo Vazquez <pablovazquez> | 2021-10-17 20:06:45 +0300 |
---|---|---|
committer | Pablo Vazquez <pablo@blender.org> | 2021-10-17 20:10:31 +0300 |
commit | 452c78757f44fe456dd10ee16bc509ab5455526b (patch) | |
tree | 02fec5f455ddcdb03767c4ced88c7c5222922ba7 | |
parent | 962b17b3ca140aca3ccce94e0e39c6631f830f8d (diff) |
UI: Improve contrast on playhead
Add an outine around the playhead, matching the color of the background (slightly darkened)
to improve the readability of the current frame line when placed against curves or strips
with a similar color.
{F10944336, size=full}
Differential Revision: https://developer.blender.org/D12810
-rw-r--r-- | source/blender/editors/animation/time_scrub_ui.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/editors/animation/time_scrub_ui.c b/source/blender/editors/animation/time_scrub_ui.c index b0eb014c5d9..94366a5e852 100644 --- a/source/blender/editors/animation/time_scrub_ui.c +++ b/source/blender/editors/animation/time_scrub_ui.c @@ -101,6 +101,7 @@ static void draw_current_frame(const Scene *scene, float text_width = UI_fontstyle_string_width(fstyle, frame_str); float box_width = MAX2(text_width + 8 * UI_DPI_FAC, 24 * UI_DPI_FAC); float box_padding = 3 * UI_DPI_FAC; + const int line_outline = max_ii(1, round_fl_to_int(1 * UI_DPI_FAC)); float bg_color[4]; UI_GetThemeColorShade4fv(TH_CFRAME, -5, bg_color); @@ -109,7 +110,19 @@ static void draw_current_frame(const Scene *scene, const float subframe_x = UI_view2d_view_to_region_x(v2d, BKE_scene_ctime_get(scene)); GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + + GPU_blend(GPU_BLEND_ALPHA); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + + /* Outline. */ + immUniformThemeColorShadeAlpha(TH_BACK, -25, -100); + immRectf(pos, + subframe_x - (line_outline + U.pixelsize), + scrub_region_rect->ymax - box_padding, + subframe_x + (line_outline + U.pixelsize), + 0.0f); + + /* Line. */ immUniformThemeColor(TH_CFRAME); immRectf(pos, subframe_x - U.pixelsize, @@ -117,6 +130,7 @@ static void draw_current_frame(const Scene *scene, subframe_x + U.pixelsize, 0.0f); immUnbindProgram(); + GPU_blend(GPU_BLEND_NONE); UI_draw_roundbox_corner_set(UI_CNR_ALL); |