[gnome-shell/wip/resource-scale: 4/7] shell-util: apply resource_scale on clipping when getting the meta texture image



commit 695f7b3f9329012d48e310b0e0a4f599faac8171
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Thu Jun 8 20:22:27 2017 +0800

    shell-util: apply resource_scale on clipping when getting the meta texture image

 src/shell-util.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/shell-util.c b/src/shell-util.c
index 70b8c06..72d6a46 100644
--- a/src/shell-util.c
+++ b/src/shell-util.c
@@ -439,14 +439,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);
 
-  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;
+  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 - actor_x) * resource_scale;
+  clip.y = (window_rect->y - actor_y) * resource_scale;
+  clip.width = window_rect->width * resource_scale;
+  clip.height = 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]