Fix #147804: Alignment of Playhead parts

With changes to the playhead to correctly draw when separated from the
vertical line (for time stretching) some parts are slightly misaligned.
This PR corrects the vertical alignment of the top of the triangular
part to the number box. It also corrects horizontal alignment of the
vertical line to be pixel-aligned based on the interior, not the shadow
exterior.

Pull Request: https://projects.blender.org/blender/blender/pulls/147825
This commit is contained in:
Harley Acheson
2025-10-10 18:18:58 +02:00
committed by Harley Acheson
parent 88308e108e
commit 0262b939a0

View File

@@ -94,7 +94,7 @@ static void draw_current_frame(const Scene *scene,
const float box_width = std::max(text_width + (2.0f * text_padding), box_min_width);
const float box_margin = 2.0f * UI_SCALE_FAC;
const float shadow_width = UI_SCALE_FAC;
const float tri_top = floor(scrub_region_rect->ymin + box_margin);
const float tri_top = ceil(scrub_region_rect->ymin + box_margin);
const float tri_half_width = 6.0f * UI_SCALE_FAC;
const float tri_height = 6.0f * UI_SCALE_FAC;
rctf rect{};
@@ -123,8 +123,8 @@ static void draw_current_frame(const Scene *scene,
immUnbindProgram();
/* Vertical line. */
rect.xmin = floor(subframe_x - U.pixelsize - shadow_width);
rect.xmax = floor(subframe_x + U.pixelsize + 1.0f + shadow_width);
rect.xmin = floor(subframe_x - U.pixelsize) - shadow_width;
rect.xmax = floor(subframe_x + U.pixelsize + 1.0f) + shadow_width;
rect.ymin = 0.0f;
rect.ymax = ceil(scrub_region_rect->ymax - box_margin + shadow_width);
UI_draw_roundbox_4fv_ex(&rect, fg_color, nullptr, 1.0f, bg_color, shadow_width, 0.0f);