[gnome-shell] st-private: Scale shadows accordingly to actor resource scaling



commit 0bcf76970a2b579088ea46cb9774dd6a48daa975
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date:   Sat Sep 2 04:08:55 2017 +0200

    st-private: Scale shadows accordingly to actor resource scaling
    
    Use scaled offscreen framebuffer to paint shadows so that it will match the
    scaling applied to the actual actor.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/5
    https://bugzilla.gnome.org/show_bug.cgi?id=765011

 src/st/st-private.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/st/st-private.c b/src/st/st-private.c
index aa1e42462..c9bcf4c3a 100644
--- a/src/st/st-private.c
+++ b/src/st/st-private.c
@@ -431,6 +431,7 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
 {
   ClutterContent *image = NULL;
   CoglPipeline *shadow_pipeline = NULL;
+  float resource_scale;
   float width, height;
 
   g_return_val_if_fail (clutter_actor_has_allocation (actor), NULL);
@@ -440,6 +441,12 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
   if (width == 0 || height == 0)
     return NULL;
 
+  if (!clutter_actor_get_resource_scale (actor, &resource_scale))
+    return NULL;
+
+  width *= resource_scale;
+  height *= resource_scale;
+
   image = clutter_actor_get_content (actor);
   if (image && CLUTTER_IS_IMAGE (image))
     {
@@ -491,6 +498,7 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
       cogl_framebuffer_clear (fb, COGL_BUFFER_BIT_COLOR, &clear_color);
       cogl_framebuffer_translate (fb, -x, -y, 0);
       cogl_framebuffer_orthographic (fb, 0, 0, width, height, 0, 1.0);
+      cogl_framebuffer_scale (fb, resource_scale, resource_scale, 1);
 
       clutter_actor_set_opacity_override (actor, 255);
       clutter_actor_paint (actor);


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