2008-07-17 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/subclassing-ClutterActor.xml: Update the ClutterActor
	subclassing section by removing the cogl_push/pop_matrix() calls
	where not needed.
This commit is contained in:
Emmanuele Bassi 2008-07-17 10:40:19 +00:00
parent e33cce309a
commit 1742dd6750
2 changed files with 10 additions and 17 deletions

View File

@ -1,3 +1,9 @@
2008-07-17 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/subclassing-ClutterActor.xml: Update the ClutterActor
subclassing section by removing the cogl_push/pop_matrix() calls
where not needed.
2008-07-10 Emmanuele Bassi <ebassi@openedhand.com> 2008-07-10 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-sections.txt: Add the missing X11 backend * clutter/clutter-sections.txt: Add the missing X11 backend

View File

@ -334,7 +334,9 @@ foo_actor_allocate (ClutterActor *actor,
using the GL or GLES API.</para> using the GL or GLES API.</para>
<note><para>Actors performing transformations should push the GL matrix <note><para>Actors performing transformations should push the GL matrix
first and then pop the GL matrix before returning.</para></note> first and then pop the GL matrix before returning. COGL provides wrapper
functions for this operation, cogl_push_matrix() and cogl_pop_matrix().
</para></note>
<example id="simple-actor-paint-example"> <example id="simple-actor-paint-example">
<title>Paint implementation of a simple actor</title> <title>Paint implementation of a simple actor</title>
@ -350,8 +352,6 @@ foo_actor_paint (ClutterActor *actor)
ClutterColor color = { 0, }; ClutterColor color = { 0, };
ClutterUnit w, h, r; ClutterUnit w, h, r;
cogl_push_matrix ();
/* FooActor has a specific background color */ /* FooActor has a specific background color */
color.red = foo_actor-&gt;bg_color.red; color.red = foo_actor-&gt;bg_color.red;
color.green = foo_actor-&gt;bg_color.green; color.green = foo_actor-&gt;bg_color.green;
@ -383,8 +383,6 @@ foo_actor_paint (ClutterActor *actor)
/* and fill it with the current color */ /* and fill it with the current color */
cogl_fill (); cogl_fill ();
cogl_pop_matrix ();
} }
</programlisting> </programlisting>
</example> </example>
@ -401,10 +399,7 @@ foo_actor_paint (ClutterActor *actor)
<example id="container-actor-paint-example"> <example id="container-actor-paint-example">
<title>Paint implementation of a container</title> <title>Paint implementation of a container</title>
<para>In this example, <classname>FooActor</classname> is a simple <para>In this example, <classname>FooActor</classname> is a simple
container invoking clutter_actor_paint() on every visible child. To container invoking clutter_actor_paint() on every visible child.</para>
allow transformations on itself to affect the children, the GL modelview
matrix is pushed at the beginning of the paint sequence, and the popped
at the end.</para>
<programlisting> <programlisting>
static void static void
foo_actor_paint (ClutterActor *actor) foo_actor_paint (ClutterActor *actor)
@ -412,8 +407,6 @@ foo_actor_paint (ClutterActor *actor)
FooActor *foo_actor = FOO_ACTOR (actor); FooActor *foo_actor = FOO_ACTOR (actor);
GList *child; GList *child;
cogl_push_matrix ();
for (child = foo_actor-&gt;children; for (child = foo_actor-&gt;children;
child != NULL; child != NULL;
child = child-&gt;next) child = child-&gt;next)
@ -424,8 +417,6 @@ foo_actor_paint (ClutterActor *actor)
if (CLUTTER_ACTOR_IS_VISIBLE (child_actor)) if (CLUTTER_ACTOR_IS_VISIBLE (child_actor))
clutter_actor_paint (child_actor); clutter_actor_paint (child_actor);
} }
cogl_pop_matrix ();
} }
</programlisting> </programlisting>
</example> </example>
@ -462,8 +453,6 @@ foo_actor_pick (ClutterActor *actor,
/* this is the arc radius for the rounded rectangle corners */ /* this is the arc radius for the rounded rectangle corners */
r = CLUTTER_UNITS_TO_FIXED (foo_actor->radius); r = CLUTTER_UNITS_TO_FIXED (foo_actor->radius);
cogl_push_matrix ();
/* use the passed color to paint ourselves */ /* use the passed color to paint ourselves */
cogl_color (pick_color); cogl_color (pick_color);
@ -472,8 +461,6 @@ foo_actor_pick (ClutterActor *actor,
/* and fill it with the current color */ /* and fill it with the current color */
cogl_fill (); cogl_fill ();
cogl_pop_matrix ();
} }
</programlisting> </programlisting>
</example> </example>