Ensure sizes for window number decorations are correct

This commit is contained in:
Kovid Goyal 2021-12-30 19:05:06 +05:30
parent 7731a558f0
commit 9a80fcee37
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -577,9 +577,9 @@ render_window_title(OSWindow *os_window, Screen *screen UNUSED, GLfloat xstart,
window->title_bar_data.last_drawn_title_object_id = window->title; window->title_bar_data.last_drawn_title_object_id = window->title;
} }
static ImageRenderData data = {.group_count=1}; static ImageRenderData data = {.group_count=1};
gpu_data_for_image(&data, xstart = clamp_position_to_nearest_pixel(xstart, os_window->viewport_width);
clamp_position_to_nearest_pixel(xstart, os_window->viewport_width), ystart = clamp_position_to_nearest_pixel(ystart, os_window->viewport_height);
clamp_position_to_nearest_pixel(ystart, os_window->viewport_height), gpu_data_for_image(&data, xstart, ystart,
xstart + width, ystart - 2.f * (bar_height / (float)os_window->viewport_height)); xstart + width, ystart - 2.f * (bar_height / (float)os_window->viewport_height));
if (!data.texture_id) { glGenTextures(1, &data.texture_id); } if (!data.texture_id) { glGenTextures(1, &data.texture_id); }
glBindTexture(GL_TEXTURE_2D, data.texture_id); glBindTexture(GL_TEXTURE_2D, data.texture_id);
@ -650,17 +650,15 @@ draw_window_number(OSWindow *os_window, Screen *screen, const CellRenderData *cr
GLfloat width_gl = 2.f * ((float)lr.width_px) / os_window->viewport_width; GLfloat width_gl = 2.f * ((float)lr.width_px) / os_window->viewport_width;
height_gl = 2.f * ((float)lr.height_px) / os_window->viewport_height; height_gl = 2.f * ((float)lr.height_px) / os_window->viewport_height;
left = xstart + (width - width_gl) / 2.f; left = xstart + (width - width_gl) / 2.f;
left = clamp_position_to_nearest_pixel(left, os_window->viewport_width);
right = left + width_gl; right = left + width_gl;
GLfloat top = ystart - (height - height_gl) / 2.f; GLfloat top = ystart - (height - height_gl) / 2.f;
top = clamp_position_to_nearest_pixel(top, os_window->viewport_height);
GLfloat bottom = top - height_gl; GLfloat bottom = top - height_gl;
bind_program(GRAPHICS_ALPHA_MASK_PROGRAM); bind_program(GRAPHICS_ALPHA_MASK_PROGRAM);
ImageRenderData *ird = load_alpha_mask_texture(lr.width_px, lr.height_px, lr.canvas); ImageRenderData *ird = load_alpha_mask_texture(lr.width_px, lr.height_px, lr.canvas);
#undef lr #undef lr
gpu_data_for_image(ird, gpu_data_for_image(ird, left, top, right, bottom);
clamp_position_to_nearest_pixel(left, os_window->viewport_width),
clamp_position_to_nearest_pixel(top, os_window->viewport_height),
right, bottom
);
glEnable(GL_BLEND); glEnable(GL_BLEND);
BLEND_PREMULT; BLEND_PREMULT;
glUniform1i(cell_uniform_data.amask_image_loc, GRAPHICS_UNIT); glUniform1i(cell_uniform_data.amask_image_loc, GRAPHICS_UNIT);