[Bf-blender-cvs] [b9fa39c8e9d] temp-ui-tweaks: UI: Improve contrast on playhead

Pablo Vazquez noreply at git.blender.org
Tue Aug 24 03:07:06 CEST 2021


Commit: b9fa39c8e9d6ca7dceb7dc052f4334d95bab91e6
Author: Pablo Vazquez
Date:   Fri Aug 20 03:13:24 2021 +0200
Branches: temp-ui-tweaks
https://developer.blender.org/rBb9fa39c8e9d6ca7dceb7dc052f4334d95bab91e6

UI: Improve contrast on playhead

Add a dark (background coloured) outline around it.

===================================================================

M	source/blender/editors/animation/time_scrub_ui.c

===================================================================

diff --git a/source/blender/editors/animation/time_scrub_ui.c b/source/blender/editors/animation/time_scrub_ui.c
index 8aeb6a57124..4dec54f0835 100644
--- a/source/blender/editors/animation/time_scrub_ui.c
+++ b/source/blender/editors/animation/time_scrub_ui.c
@@ -102,6 +102,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;
+  float outline = 1 * UI_DPI_FAC;
 
   float bg_color[4];
   UI_GetThemeColorShade4fv(TH_CFRAME, -5, bg_color);
@@ -112,13 +113,25 @@ 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);
+
     immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+    GPU_blend(GPU_BLEND_ALPHA);
+
+    immUniformThemeColorShadeAlpha(TH_BACK, -25, -100);
+    immRectf(pos,
+             subframe_x - U.pixelsize - outline,
+             scrub_region_rect->ymax - box_padding,
+             subframe_x + U.pixelsize + outline,
+             0.0f);
+
     immUniformThemeColor(TH_CFRAME);
     immRectf(pos,
              subframe_x - U.pixelsize,
              scrub_region_rect->ymax - box_padding,
              subframe_x + U.pixelsize,
              0.0f);
+
+    GPU_blend(GPU_BLEND_NONE);
     immUnbindProgram();
   }



More information about the Bf-blender-cvs mailing list