scene: use fractional sizes for rects

Signed-off-by: Loukas Agorgianitis <loukas@agorgianitis.com>
This commit is contained in:
Loukas Agorgianitis 2025-04-14 11:33:10 +02:00
parent 8a54671d2c
commit 62234c5133
No known key found for this signature in database
GPG key ID: DDC6FA7D5BB332E6
2 changed files with 5 additions and 5 deletions

View file

@ -143,7 +143,7 @@ struct wlr_scene_surface {
/** A scene-graph node displaying a solid-colored rectangle */ /** A scene-graph node displaying a solid-colored rectangle */
struct wlr_scene_rect { struct wlr_scene_rect {
struct wlr_scene_node node; struct wlr_scene_node node;
int width, height; double width, height;
float color[4]; float color[4];
}; };
@ -453,12 +453,12 @@ void wlr_scene_surface_send_frame_done(struct wlr_scene_surface *scene_surface,
* The color argument must be a premultiplied color value. * The color argument must be a premultiplied color value.
*/ */
struct wlr_scene_rect *wlr_scene_rect_create(struct wlr_scene_tree *parent, struct wlr_scene_rect *wlr_scene_rect_create(struct wlr_scene_tree *parent,
int width, int height, const float color[static 4]); double width, double height, const float color[static 4]);
/** /**
* Change the width and height of an existing rectangle node. * Change the width and height of an existing rectangle node.
*/ */
void wlr_scene_rect_set_size(struct wlr_scene_rect *rect, int width, int height); void wlr_scene_rect_set_size(struct wlr_scene_rect *rect, double width, double height);
/** /**
* Change the color of an existing rectangle node. * Change the color of an existing rectangle node.

View file

@ -751,7 +751,7 @@ static void scene_node_update(struct wlr_scene_node *node,
} }
struct wlr_scene_rect *wlr_scene_rect_create(struct wlr_scene_tree *parent, struct wlr_scene_rect *wlr_scene_rect_create(struct wlr_scene_tree *parent,
int width, int height, const float color[static 4]) { double width, double height, const float color[static 4]) {
assert(parent); assert(parent);
assert(width >= 0 && height >= 0); assert(width >= 0 && height >= 0);
@ -770,7 +770,7 @@ struct wlr_scene_rect *wlr_scene_rect_create(struct wlr_scene_tree *parent,
return scene_rect; return scene_rect;
} }
void wlr_scene_rect_set_size(struct wlr_scene_rect *rect, int width, int height) { void wlr_scene_rect_set_size(struct wlr_scene_rect *rect, double width, double height) {
if (rect->width == width && rect->height == height) { if (rect->width == width && rect->height == height) {
return; return;
} }