From 402ca532b7c7b4a4d099c5db86f9e4c47ac5240d Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Tue, 15 Jul 2025 17:02:04 +0800 Subject: [PATCH] opt: optimize none animation fram draw --- src/animation/client.h | 5 ++++- src/animation/layer.h | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/animation/client.h b/src/animation/client.h index 63d7871..9038313 100644 --- a/src/animation/client.h +++ b/src/animation/client.h @@ -721,8 +721,11 @@ void client_commit(Client *c) { // 如果动画没有开始,且被判定为不应该动画, // 则设置总帧数为1,不然其他地方一旦获取动画 // 进度,总帧数作为分母会造成除零 - if (!c->animation.running) + // 比如动画类型为none的时候 + if (!c->animation.running) { + c->animation.passed_frames = 1; c->animation.total_frames = 1; + } } // 请求刷新屏幕 wlr_output_schedule_frame(c->mon->wlr_output); diff --git a/src/animation/layer.h b/src/animation/layer.h index 53795d2..c353ce7 100644 --- a/src/animation/layer.h +++ b/src/animation/layer.h @@ -491,8 +491,11 @@ void layer_commit(LayerSurface *l) { // 如果动画没有开始,且被判定为不应该动画, // 则设置总帧数为1,不然其他地方一旦获取动画 // 进度,总帧数作为分母会造成除零 - if (!l->animation.running) + // 比如动画类型为none的时候 + if (!l->animation.running) { + l->animation.passed_frames = 1; l->animation.total_frames = 1; + } } // 请求刷新屏幕 wlr_output_schedule_frame(l->mon->wlr_output);