From 9408f31f4bc9d67be425d4743c133e7e1c86fcb1 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Wed, 19 Feb 2025 12:27:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbuffer=20scale=E4=B8=8D?= =?UTF-8?q?=E5=8C=BA=E5=88=86=E5=AE=BD=E9=AB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maomao.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/maomao.c b/maomao.c index da0043a2..43b65f09 100644 --- a/maomao.c +++ b/maomao.c @@ -131,7 +131,8 @@ typedef struct { } Arg; typedef struct { - float scale; + float width_scale; + float height_scale; int width; int height; } animationScale; @@ -880,10 +881,12 @@ void client_apply_clip(Client *c) { scale_data.height = clip_box.height -2*c->bw; if(c->animation.running) { - scale_data.scale = (float)clip_box.width/c->geom.width; + scale_data.width_scale = (float)clip_box.width/c->geom.width; + scale_data.height_scale = (float)clip_box.height/c->geom.height; buffer_set_size(c, scale_data); } else { - scale_data.scale = 1.0; + scale_data.width_scale = 1.0; + scale_data.height_scale = 1.0; buffer_set_size(c, scale_data); } wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box); @@ -3636,7 +3639,7 @@ void scene_buffer_apply_size(struct wlr_scene_buffer *buffer, int sx, int sy, vo animationScale *scale_data = (animationScale *)data; struct wlr_scene_surface *surface = wlr_scene_surface_try_from_buffer(buffer); if(wlr_subsurface_try_from_wlr_surface(surface->surface) != NULL) { - wlr_scene_buffer_set_dest_size(buffer, buffer->dst_width * scale_data->scale, buffer->dst_height * scale_data->scale); + wlr_scene_buffer_set_dest_size(buffer, buffer->dst_width * scale_data->width_scale, buffer->dst_height * scale_data->height_scale); } else { wlr_scene_buffer_set_dest_size(buffer, scale_data->width, scale_data->height); }