[mutter/gnome-41] clutter/offscreen-effect: Consider paint volumes at negative coordinates



commit c33ca49dfcafaa5794fd50824afbb32250a60cea
Author: Sebastian Keller <skeller gnome org>
Date:   Fri Oct 1 10:03:02 2021 +0200

    clutter/offscreen-effect: Consider paint volumes at negative coordinates
    
    When basing the offscreen texture position off the paint volume, the
    code was assuming that the paint volume was always starting at 0,0 but
    this is not the case if child widgets are placed at negative coordinates
    or the widget itself is transformed. This could cause such widgets that
    have been flattened and therefore rendered to an offscreen texture to
    appear cut off in the top/left.
    
    Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4561
    Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1923
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2031>
    (cherry picked from commit 3768efef2b98a89cb0b9d9860d5375bf875a47a7)

 clutter/clutter/clutter-offscreen-effect.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/clutter/clutter/clutter-offscreen-effect.c b/clutter/clutter/clutter-offscreen-effect.c
index 3e72d89fdc..7ff3a2ee00 100644
--- a/clutter/clutter/clutter-offscreen-effect.c
+++ b/clutter/clutter/clutter-offscreen-effect.c
@@ -336,17 +336,23 @@ clutter_offscreen_effect_pre_paint (ClutterEffect       *effect,
       _clutter_paint_volume_copy_static (volume, &mutable_volume);
       _clutter_paint_volume_get_bounding_box (&mutable_volume, &raw_box);
       clutter_paint_volume_free (&mutable_volume);
+
+      box = raw_box;
+      _clutter_actor_box_enlarge_for_effects (&box);
+
+      priv->fbo_offset_x = box.x1;
+      priv->fbo_offset_y = box.y1;
     }
   else
     {
       clutter_actor_get_allocation_box (priv->actor, &raw_box);
-    }
 
-  box = raw_box;
-  _clutter_actor_box_enlarge_for_effects (&box);
+      box = raw_box;
+      _clutter_actor_box_enlarge_for_effects (&box);
 
-  priv->fbo_offset_x = box.x1 - raw_box.x1;
-  priv->fbo_offset_y = box.y1 - raw_box.y1;
+      priv->fbo_offset_x = box.x1 - raw_box.x1;
+      priv->fbo_offset_y = box.y1 - raw_box.y1;
+    }
 
   clutter_actor_box_scale (&box, ceiled_resource_scale);
   clutter_actor_box_get_size (&box, &target_width, &target_height);


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