mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
effects: Fix stacking of offscreen-based effects
Stacking multiple effects sub-classing ClutterOffscreenEffect requires a small fix in the code that computes the screen coordinates of the actor to position the FBO correctly with regards to the stage.
This commit is contained in:
parent
8ef4d9fe21
commit
aef2f805a6
@ -204,6 +204,7 @@ get_screen_offsets (ClutterActor *actor,
|
|||||||
{
|
{
|
||||||
ClutterVertex verts[4];
|
ClutterVertex verts[4];
|
||||||
gfloat x_min = G_MAXFLOAT, y_min = G_MAXFLOAT;
|
gfloat x_min = G_MAXFLOAT, y_min = G_MAXFLOAT;
|
||||||
|
gfloat v[4] = { 0, };
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
/* Get the actors allocation transformed into screen coordinates.
|
/* Get the actors allocation transformed into screen coordinates.
|
||||||
@ -231,6 +232,17 @@ get_screen_offsets (ClutterActor *actor,
|
|||||||
*y_offset = ROUND (y_min);
|
*y_offset = ROUND (y_min);
|
||||||
|
|
||||||
#undef ROUND
|
#undef ROUND
|
||||||
|
|
||||||
|
/* since we're setting up a viewport with a negative offset to paint
|
||||||
|
* in an FBO with the same modelview and projection matrices as the
|
||||||
|
* stage, we need to offset the computed absolute allocation vertices
|
||||||
|
* with the current viewport's X and Y offsets. this works even with
|
||||||
|
* the default case where the viewport is set up by Clutter to be
|
||||||
|
* (0, 0, stage_width, stage_height)
|
||||||
|
*/
|
||||||
|
cogl_get_viewport (v);
|
||||||
|
*x_offset -= v[0];
|
||||||
|
*y_offset -= v[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -40,6 +40,7 @@ test_rotate_main (int argc, char *argv[])
|
|||||||
clutter_actor_set_position (hand, 240, 140);
|
clutter_actor_set_position (hand, 240, 140);
|
||||||
clutter_actor_show (hand);
|
clutter_actor_show (hand);
|
||||||
clutter_actor_add_effect_with_name (hand, "desaturate", clutter_desaturate_effect_new (0.75));
|
clutter_actor_add_effect_with_name (hand, "desaturate", clutter_desaturate_effect_new (0.75));
|
||||||
|
clutter_actor_add_effect_with_name (hand, "blur", clutter_blur_effect_new ());
|
||||||
clutter_actor_animate_with_timeline (hand, CLUTTER_LINEAR, timeline,
|
clutter_actor_animate_with_timeline (hand, CLUTTER_LINEAR, timeline,
|
||||||
"@effects.desaturate.factor", 1.0,
|
"@effects.desaturate.factor", 1.0,
|
||||||
NULL);
|
NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user