mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-31 22:25:29 -04:00
opt: optimize layer scale offset
This commit is contained in:
parent
e4153ffb4f
commit
7485fa1b7e
1 changed files with 15 additions and 20 deletions
|
|
@ -209,14 +209,6 @@ void layer_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx,
|
||||||
|
|
||||||
struct wlr_surface *surface = scene_surface->surface;
|
struct wlr_surface *surface = scene_surface->surface;
|
||||||
|
|
||||||
if (scale_data->width_scale >= 0.99f) {
|
|
||||||
scale_data->width_scale = 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scale_data->height_scale >= 0.99f) {
|
|
||||||
scale_data->height_scale = 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int surface_width = surface->current.width;
|
unsigned int surface_width = surface->current.width;
|
||||||
unsigned int surface_height = surface->current.height;
|
unsigned int surface_height = surface->current.height;
|
||||||
surface_width = scale_data->width_scale * surface_width;
|
surface_width = scale_data->width_scale * surface_width;
|
||||||
|
|
@ -260,11 +252,10 @@ void fadeout_layer_animation_next_tick(LayerSurface *l) {
|
||||||
scale_data.width = width;
|
scale_data.width = width;
|
||||||
scale_data.height = height;
|
scale_data.height = height;
|
||||||
|
|
||||||
if (((!l->animation_type_close &&
|
if ((!l->animation_type_close &&
|
||||||
strcmp(layer_animation_type_close, "zoom") == 0) ||
|
strcmp(layer_animation_type_close, "zoom") == 0) ||
|
||||||
(l->animation_type_close &&
|
(l->animation_type_close &&
|
||||||
strcmp(l->animation_type_close, "zoom") == 0)) &&
|
strcmp(l->animation_type_close, "zoom") == 0)) {
|
||||||
(width != l->current.width || height != l->current.height)) {
|
|
||||||
wlr_scene_node_for_each_buffer(&l->scene->node,
|
wlr_scene_node_for_each_buffer(&l->scene->node,
|
||||||
layer_fadeout_scene_buffer_apply_effect,
|
layer_fadeout_scene_buffer_apply_effect,
|
||||||
&scale_data);
|
&scale_data);
|
||||||
|
|
@ -325,14 +316,18 @@ void layer_animation_next_tick(LayerSurface *l) {
|
||||||
wlr_scene_node_set_position(&l->scene->node, x, y);
|
wlr_scene_node_set_position(&l->scene->node, x, y);
|
||||||
|
|
||||||
animationScale scale_data;
|
animationScale scale_data;
|
||||||
scale_data.width_scale = (float)width / (float)l->current.width;
|
if (factor == 1.0) {
|
||||||
scale_data.height_scale = (float)height / (float)l->current.height;
|
scale_data.width_scale = 1.0f;
|
||||||
|
scale_data.height_scale = 1.0f;
|
||||||
|
} else {
|
||||||
|
scale_data.width_scale = (float)width / (float)l->current.width;
|
||||||
|
scale_data.height_scale = (float)height / (float)l->current.height;
|
||||||
|
}
|
||||||
|
|
||||||
if (((!l->animation_type_open &&
|
if ((!l->animation_type_open &&
|
||||||
strcmp(layer_animation_type_open, "zoom") == 0) ||
|
strcmp(layer_animation_type_open, "zoom") == 0) ||
|
||||||
(l->animation_type_open &&
|
(l->animation_type_open &&
|
||||||
strcmp(l->animation_type_open, "zoom") == 0)) &&
|
strcmp(l->animation_type_open, "zoom") == 0)) {
|
||||||
(scale_data.width_scale != 1.0 || scale_data.height_scale != 1.0)) {
|
|
||||||
wlr_scene_node_for_each_buffer(
|
wlr_scene_node_for_each_buffer(
|
||||||
&l->scene->node, layer_scene_buffer_apply_effect, &scale_data);
|
&l->scene->node, layer_scene_buffer_apply_effect, &scale_data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue