mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-18 06:59:53 -05:00
opt:Reduce unnecessary buffer scale
This commit is contained in:
parent
e0fdbc99e1
commit
5ae688eefb
1 changed files with 10 additions and 2 deletions
12
maomao.c
12
maomao.c
|
|
@ -4455,6 +4455,14 @@ void scene_buffer_apply_size(struct wlr_scene_buffer *buffer, int sx, int sy,
|
|||
return;
|
||||
}
|
||||
|
||||
if(scale_data->height_scale == 1 && scale_data->width_scale < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(scale_data->height_scale < 1 && scale_data->width_scale == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_scene_surface *scene_surface = wlr_scene_surface_try_from_buffer(buffer);
|
||||
|
||||
if(scene_surface == NULL) return;
|
||||
|
|
@ -4464,8 +4472,8 @@ void scene_buffer_apply_size(struct wlr_scene_buffer *buffer, int sx, int sy,
|
|||
uint32_t surface_width = surface->current.width;
|
||||
uint32_t surface_height = surface->current.height;
|
||||
|
||||
surface_width *= scale_data->width_scale;
|
||||
surface_height *= scale_data->height_scale;
|
||||
surface_width = scale_data->width_scale < 1 ? surface_width : scale_data->width_scale * surface_width;
|
||||
surface_height = scale_data->height_scale < 1 ? surface_height : scale_data->height_scale * surface_height;
|
||||
|
||||
if (surface_width > scale_data->width && wlr_subsurface_try_from_wlr_surface(surface) == NULL) {
|
||||
surface_width = scale_data->width;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue