Commit 0bace8db authored by Daniel van Vugt's avatar Daniel van Vugt Committed by Marge Bot
Browse files

clutter/offscreen-effect: Use the paint volume origin as the FBO offset

Before now it was assumed that the only negative local coordinates would
be those introduced by `_clutter_actor_box_enlarge_for_effects`, and we
used the difference for `fbo_offset_x/y`. But that was misguided (of me)
because gnome-shell can give us paint volumes at negative coordinates too,
like when rendering `box-shadow` on the top or left edge of an actor.

The maximum extents of negative coordinates we might need to render are
in fact the (enlarged) left and top edges of the paint volume. So use
those as the FBO offset. This places the actor's local origin correctly
within the FBO and thus also ensures it's not over-clipped at the edges
of the FBO, which now line up with the enlarged extents of the paint
volume.

This fixes one third of
GNOME/gnome-shell#1090
The other fixes required are !1053 and gnome-shell!1417.

Part-of: <GNOME/mutter!1538>
parent 9693462f
...@@ -260,7 +260,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect, ...@@ -260,7 +260,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect); ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
ClutterOffscreenEffectPrivate *priv = self->priv; ClutterOffscreenEffectPrivate *priv = self->priv;
CoglFramebuffer *offscreen; CoglFramebuffer *offscreen;
ClutterActorBox raw_box, box; ClutterActorBox box;
ClutterActor *stage; ClutterActor *stage;
graphene_matrix_t projection, modelview; graphene_matrix_t projection, modelview;
const ClutterPaintVolume *volume; const ClutterPaintVolume *volume;
...@@ -297,19 +297,18 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect, ...@@ -297,19 +297,18 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
ClutterPaintVolume mutable_volume; ClutterPaintVolume mutable_volume;
_clutter_paint_volume_copy_static (volume, &mutable_volume); _clutter_paint_volume_copy_static (volume, &mutable_volume);
_clutter_paint_volume_get_bounding_box (&mutable_volume, &raw_box); _clutter_paint_volume_get_bounding_box (&mutable_volume, &box);
clutter_paint_volume_free (&mutable_volume); clutter_paint_volume_free (&mutable_volume);
} }
else else
{ {
clutter_actor_get_allocation_box (priv->actor, &raw_box); clutter_actor_get_allocation_box (priv->actor, &box);
} }
box = raw_box;
_clutter_actor_box_enlarge_for_effects (&box); _clutter_actor_box_enlarge_for_effects (&box);
priv->fbo_offset_x = box.x1 - raw_box.x1; priv->fbo_offset_x = box.x1;
priv->fbo_offset_y = box.y1 - raw_box.y1; priv->fbo_offset_y = box.y1;
clutter_actor_box_scale (&box, ceiled_resource_scale); clutter_actor_box_scale (&box, ceiled_resource_scale);
clutter_actor_box_get_size (&box, &target_width, &target_height); clutter_actor_box_get_size (&box, &target_width, &target_height);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment