[gnome-shell] shell-util: Apply resource_scale on clipping when getting the meta texture image



commit 6f027ee7dc8032895d29b6d4fd569597b19f38b8
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date:   Thu Jun 8 14:22:27 2017 +0200

    shell-util: Apply resource_scale on clipping when getting the meta texture image
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765011
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5

 src/shell-util.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/shell-util.c b/src/shell-util.c
index 88a9ce11e..31bb18e70 100644
--- a/src/shell-util.c
+++ b/src/shell-util.c
@@ -3,6 +3,7 @@
 #include "config.h"
 
 #include <errno.h>
+#include <math.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -434,14 +435,23 @@ shell_util_get_content_for_window_actor (MetaWindowActor *window_actor,
   cairo_surface_t *surface;
   cairo_rectangle_int_t clip;
   gfloat actor_x, actor_y;
+  gfloat resource_scale;
 
   texture = meta_window_actor_get_texture (window_actor);
   clutter_actor_get_position (CLUTTER_ACTOR (window_actor), &actor_x, &actor_y);
 
+  if (!clutter_actor_get_resource_scale (CLUTTER_ACTOR (window_actor),
+                                         &resource_scale))
+    {
+      resource_scale = 1.0;
+      g_warning ("Actor resource scale is not know at this point, "
+                 "falling back to default 1.0");
+    }
+
   clip.x = window_rect->x - (gint) actor_x;
   clip.y = window_rect->y - (gint) actor_y;
-  clip.width = window_rect->width;
-  clip.height = window_rect->height;
+  clip.width = ceilf (window_rect->width * resource_scale);
+  clip.height = ceilf (window_rect->height * resource_scale);
 
   surface = meta_shaped_texture_get_image (META_SHAPED_TEXTURE (texture),
                                            &clip);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]