ScreenshotManager: Use get_image from actor directly (#1957)

Co-authored-by: Leonhard <106322251+leolost2605@users.noreply.github.com>
This commit is contained in:
Corentin Noël 2024-07-06 13:23:54 +02:00 committed by GitHub
parent 3a81898095
commit d0609ab6b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -146,7 +146,6 @@ namespace Gala {
}
var window_actor = (Meta.WindowActor) window.get_compositor_private ();
unowned Meta.ShapedTexture window_texture = (Meta.ShapedTexture) window_actor.get_texture ();
float actor_x, actor_y;
window_actor.get_position (out actor_x, out actor_y);
@ -162,8 +161,14 @@ namespace Gala {
#else
Cairo.RectangleInt clip = { rect.x - (int) actor_x, rect.y - (int) actor_y, rect.width, rect.height };
#endif
var image = (Cairo.ImageSurface) window_texture.get_image (clip);
var image = (Cairo.ImageSurface) window_actor.get_image (clip);
if (include_cursor) {
if (window.get_client_type () == Meta.WindowClientType.WAYLAND) {
float resource_scale = window_actor.get_resource_scale ();
image.set_device_scale (resource_scale, resource_scale);
}
image = composite_stage_cursor (image, { rect.x, rect.y, rect.width, rect.height });
}