From 452c78757f44fe456dd10ee16bc509ab5455526b Mon Sep 17 00:00:00 2001 From: Pablo Vazquez Date: Sun, 17 Oct 2021 19:06:45 +0200 Subject: [PATCH] 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 --- source/blender/editors/animation/time_scrub_ui.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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);