aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/render.c
diff options
context:
space:
mode:
authorLibravatar Carl Smedstad <carl.smedstad@protonmail.com>2022-12-30 08:50:14 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2023-01-03 21:50:56 +0100
commit9425ce2fba6dd643c240386901de370ac90cc337 (patch)
treeeece0cfb4e472de8809ea7a074336905c2767932 /sway/desktop/render.c
parentRemove redundant return statements (diff)
downloadsway-9425ce2fba6dd643c240386901de370ac90cc337.tar.gz
sway-9425ce2fba6dd643c240386901de370ac90cc337.tar.zst
sway-9425ce2fba6dd643c240386901de370ac90cc337.zip
Replace math functions that promote float to double
Diffstat (limited to 'sway/desktop/render.c')
-rw-r--r--sway/desktop/render.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index ea9c37d9..4d242bd7 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -50,7 +50,7 @@ struct render_data {
50 * scaled to 2px. 50 * scaled to 2px.
51 */ 51 */
52static int scale_length(int length, int offset, float scale) { 52static int scale_length(int length, int offset, float scale) {
53 return round((offset + length) * scale) - round(offset * scale); 53 return roundf((offset + length) * scale) - roundf(offset * scale);
54} 54}
55 55
56static void scissor_output(struct wlr_output *wlr_output, 56static void scissor_output(struct wlr_output *wlr_output,
@@ -482,7 +482,7 @@ static void render_titlebar(struct sway_output *output,
482 size_t inner_width = width - titlebar_h_padding * 2; 482 size_t inner_width = width - titlebar_h_padding * 2;
483 483
484 // output-buffer local 484 // output-buffer local
485 int ob_inner_x = round(inner_x * output_scale); 485 int ob_inner_x = roundf(inner_x * output_scale);
486 int ob_inner_width = scale_length(inner_width, inner_x, output_scale); 486 int ob_inner_width = scale_length(inner_width, inner_x, output_scale);
487 int ob_bg_height = scale_length( 487 int ob_bg_height = scale_length(
488 (titlebar_v_padding - titlebar_border_thickness) * 2 + 488 (titlebar_v_padding - titlebar_border_thickness) * 2 +
@@ -531,7 +531,7 @@ static void render_titlebar(struct sway_output *output,
531 memcpy(&color, colors->background, sizeof(float) * 4); 531 memcpy(&color, colors->background, sizeof(float) * 4);
532 premultiply_alpha(color, con->alpha); 532 premultiply_alpha(color, con->alpha);
533 box.x = texture_box.x + round(output_x * output_scale); 533 box.x = texture_box.x + round(output_x * output_scale);
534 box.y = round((y + titlebar_border_thickness) * output_scale); 534 box.y = roundf((y + titlebar_border_thickness) * output_scale);
535 box.width = texture_box.width; 535 box.width = texture_box.width;
536 box.height = ob_padding_above; 536 box.height = ob_padding_above;
537 render_rect(output, output_damage, &box, color); 537 render_rect(output, output_damage, &box, color);
@@ -562,7 +562,7 @@ static void render_titlebar(struct sway_output *output,
562 562
563 // The title texture might be shorter than the config->font_height, 563 // The title texture might be shorter than the config->font_height,
564 // in which case we need to pad it above and below. 564 // in which case we need to pad it above and below.
565 int ob_padding_above = round((titlebar_v_padding - 565 int ob_padding_above = roundf((titlebar_v_padding -
566 titlebar_border_thickness) * output_scale); 566 titlebar_border_thickness) * output_scale);
567 int ob_padding_below = ob_bg_height - ob_padding_above - 567 int ob_padding_below = ob_bg_height - ob_padding_above -
568 texture_box.height; 568 texture_box.height;
@@ -607,7 +607,7 @@ static void render_titlebar(struct sway_output *output,
607 memcpy(&color, colors->background, sizeof(float) * 4); 607 memcpy(&color, colors->background, sizeof(float) * 4);
608 premultiply_alpha(color, con->alpha); 608 premultiply_alpha(color, con->alpha);
609 box.x = texture_box.x + round(output_x * output_scale); 609 box.x = texture_box.x + round(output_x * output_scale);
610 box.y = round((y + titlebar_border_thickness) * output_scale); 610 box.y = roundf((y + titlebar_border_thickness) * output_scale);
611 box.width = texture_box.width; 611 box.width = texture_box.width;
612 box.height = ob_padding_above; 612 box.height = ob_padding_above;
613 render_rect(output, output_damage, &box, color); 613 render_rect(output, output_damage, &box, color);
@@ -647,7 +647,7 @@ static void render_titlebar(struct sway_output *output,
647 box.width = ob_right_x - ob_left_x - ob_left_width; 647 box.width = ob_right_x - ob_left_x - ob_left_width;
648 if (box.width > 0) { 648 if (box.width > 0) {
649 box.x = ob_left_x + ob_left_width + round(output_x * output_scale); 649 box.x = ob_left_x + ob_left_width + round(output_x * output_scale);
650 box.y = round(bg_y * output_scale); 650 box.y = roundf(bg_y * output_scale);
651 box.height = ob_bg_height; 651 box.height = ob_bg_height;
652 render_rect(output, output_damage, &box, color); 652 render_rect(output, output_damage, &box, color);
653 } 653 }