|
|
@ -50,7 +50,7 @@ struct render_data {
|
|
|
|
* scaled to 2px.
|
|
|
|
* scaled to 2px.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static int scale_length(int length, int offset, float scale) {
|
|
|
|
static int scale_length(int length, int offset, float scale) {
|
|
|
|
return round((offset + length) * scale) - round(offset * scale);
|
|
|
|
return roundf((offset + length) * scale) - roundf(offset * scale);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void scissor_output(struct wlr_output *wlr_output,
|
|
|
|
static void scissor_output(struct wlr_output *wlr_output,
|
|
|
@ -482,7 +482,7 @@ static void render_titlebar(struct sway_output *output,
|
|
|
|
size_t inner_width = width - titlebar_h_padding * 2;
|
|
|
|
size_t inner_width = width - titlebar_h_padding * 2;
|
|
|
|
|
|
|
|
|
|
|
|
// output-buffer local
|
|
|
|
// output-buffer local
|
|
|
|
int ob_inner_x = round(inner_x * output_scale);
|
|
|
|
int ob_inner_x = roundf(inner_x * output_scale);
|
|
|
|
int ob_inner_width = scale_length(inner_width, inner_x, output_scale);
|
|
|
|
int ob_inner_width = scale_length(inner_width, inner_x, output_scale);
|
|
|
|
int ob_bg_height = scale_length(
|
|
|
|
int ob_bg_height = scale_length(
|
|
|
|
(titlebar_v_padding - titlebar_border_thickness) * 2 +
|
|
|
|
(titlebar_v_padding - titlebar_border_thickness) * 2 +
|
|
|
@ -531,7 +531,7 @@ static void render_titlebar(struct sway_output *output,
|
|
|
|
memcpy(&color, colors->background, sizeof(float) * 4);
|
|
|
|
memcpy(&color, colors->background, sizeof(float) * 4);
|
|
|
|
premultiply_alpha(color, con->alpha);
|
|
|
|
premultiply_alpha(color, con->alpha);
|
|
|
|
box.x = texture_box.x + round(output_x * output_scale);
|
|
|
|
box.x = texture_box.x + round(output_x * output_scale);
|
|
|
|
box.y = round((y + titlebar_border_thickness) * output_scale);
|
|
|
|
box.y = roundf((y + titlebar_border_thickness) * output_scale);
|
|
|
|
box.width = texture_box.width;
|
|
|
|
box.width = texture_box.width;
|
|
|
|
box.height = ob_padding_above;
|
|
|
|
box.height = ob_padding_above;
|
|
|
|
render_rect(output, output_damage, &box, color);
|
|
|
|
render_rect(output, output_damage, &box, color);
|
|
|
@ -562,7 +562,7 @@ static void render_titlebar(struct sway_output *output,
|
|
|
|
|
|
|
|
|
|
|
|
// The title texture might be shorter than the config->font_height,
|
|
|
|
// The title texture might be shorter than the config->font_height,
|
|
|
|
// in which case we need to pad it above and below.
|
|
|
|
// in which case we need to pad it above and below.
|
|
|
|
int ob_padding_above = round((titlebar_v_padding -
|
|
|
|
int ob_padding_above = roundf((titlebar_v_padding -
|
|
|
|
titlebar_border_thickness) * output_scale);
|
|
|
|
titlebar_border_thickness) * output_scale);
|
|
|
|
int ob_padding_below = ob_bg_height - ob_padding_above -
|
|
|
|
int ob_padding_below = ob_bg_height - ob_padding_above -
|
|
|
|
texture_box.height;
|
|
|
|
texture_box.height;
|
|
|
@ -607,7 +607,7 @@ static void render_titlebar(struct sway_output *output,
|
|
|
|
memcpy(&color, colors->background, sizeof(float) * 4);
|
|
|
|
memcpy(&color, colors->background, sizeof(float) * 4);
|
|
|
|
premultiply_alpha(color, con->alpha);
|
|
|
|
premultiply_alpha(color, con->alpha);
|
|
|
|
box.x = texture_box.x + round(output_x * output_scale);
|
|
|
|
box.x = texture_box.x + round(output_x * output_scale);
|
|
|
|
box.y = round((y + titlebar_border_thickness) * output_scale);
|
|
|
|
box.y = roundf((y + titlebar_border_thickness) * output_scale);
|
|
|
|
box.width = texture_box.width;
|
|
|
|
box.width = texture_box.width;
|
|
|
|
box.height = ob_padding_above;
|
|
|
|
box.height = ob_padding_above;
|
|
|
|
render_rect(output, output_damage, &box, color);
|
|
|
|
render_rect(output, output_damage, &box, color);
|
|
|
@ -647,7 +647,7 @@ static void render_titlebar(struct sway_output *output,
|
|
|
|
box.width = ob_right_x - ob_left_x - ob_left_width;
|
|
|
|
box.width = ob_right_x - ob_left_x - ob_left_width;
|
|
|
|
if (box.width > 0) {
|
|
|
|
if (box.width > 0) {
|
|
|
|
box.x = ob_left_x + ob_left_width + round(output_x * output_scale);
|
|
|
|
box.x = ob_left_x + ob_left_width + round(output_x * output_scale);
|
|
|
|
box.y = round(bg_y * output_scale);
|
|
|
|
box.y = roundf(bg_y * output_scale);
|
|
|
|
box.height = ob_bg_height;
|
|
|
|
box.height = ob_bg_height;
|
|
|
|
render_rect(output, output_damage, &box, color);
|
|
|
|
render_rect(output, output_damage, &box, color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|