From 0bcf76970a2b579088ea46cb9774dd6a48daa975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sat, 2 Sep 2017 04:08:55 +0200 Subject: [PATCH] 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);