2008-11-12 Emmanuele Bassi <ebassi@linux.intel.com>

* clutter/cogl/cogl-color.h:
	* clutter/cogl/cogl-path.h:
	* clutter/cogl/cogl-types.h:
	* clutter/cogl/common/cogl-color.c: Deprecated cogl_color()
	in favour of cogl_set_source_color() and friends; store the
	CoglColor components as unsigned bytes instead of fixed point
	normalized values; add functions for allocating, copying and
	freeing CoglColor, for use of language bindings.

	* clutter/cogl/cogl.h.in:
	* clutter/cogl/cogl-deprecated.h: Added cogl-deprecated.h,
	an header file containing the deprecation symbols similar
	to clutter-deprecated.h.

	* clutter/cogl/gl/Makefile.am:
	* clutter/cogl/gl/cogl-texture.c:
	* clutter/cogl/gl/cogl.c:
	* clutter/cogl/gles/Makefile.am:
	* clutter/cogl/gles/cogl-texture.c:
	* clutter/cogl/gles/cogl.c: Update the GL and GLES implementations
	of COGL after the CoglColor changes.

	* clutter/clutter-actor.c:
	* clutter/clutter-clone-texture.c:
	* clutter/clutter-entry.c:
	* clutter/clutter-label.c:
	* clutter/clutter-rectangle.c:
	* clutter/clutter-texture.c: Do not use CoglColor whenever it
	is possible, and use cogl_set_source_color4ub() instead.

	* clutter/pango/cogl-pango-render.c: Ditto as above.

	* doc/reference/clutter/subclassing-ClutterActor.xml:
	* doc/reference/cogl/cogl-sections.txt: Update the documentation.

	* tests/interactive/test-cogl-offscreen.c:
	* tests/interactive/test-cogl-primitives.c:
	* tests/interactive/test-cogl-tex-convert.c:
	* tests/interactive/test-cogl-tex-foreign.c:
	* tests/interactive/test-cogl-tex-getset.c:
	* tests/interactive/test-cogl-tex-polygon.c:
	* tests/interactive/test-cogl-tex-tile.c:
	* tests/interactive/test-paint-wrapper.c: Drop the usage of
	CoglColor whenever it is possible.
This commit is contained in:
Emmanuele Bassi
2008-11-12 13:57:58 +00:00
parent 0ff710d37b
commit c823bf9c83
30 changed files with 347 additions and 214 deletions

View File

@ -349,23 +349,20 @@ static void
foo_actor_paint (ClutterActor *actor)
{
FooActor *foo_actor = FOO_ACTOR (actor);
ClutterColor color = { 0, };
ClutterUnit w, h, r;
/* FooActor has a specific background color */
color.red = foo_actor-&gt;bg_color.red;
color.green = foo_actor-&gt;bg_color.green;
color.blue = foo_actor-&gt;bg_color.blue;
/* the alpha component must take into account the absolute
/* FooActor has a specific background color
*
* the alpha component must take into account the absolute
* opacity of the actor on the screen at this point in the
* scenegraph; this value is obtained by calling
* clutter_actor_get_paint_opacity().
*/
color.alpha = clutter_actor_get_paint_opacity (actor);
/* set the color of the pen */
cogl_color (&amp;color);
cogl_set_source_color4ub (priv-&gt;fgcol.red,
priv-&gt;fgcol.green,
priv-&gt;fgcol.blue,
clutter_actor_get_paint_opacity (actor));
/* get the size of the actor with sub-pixel precision */
w = CLUTTER_UNITS_TO_FIXED (clutter_actor_get_widthu (actor));
@ -439,7 +436,8 @@ foo_actor_pick (ClutterActor *actor,
const ClutterColor *pick_color)
{
FooActor *foo_actor = FOO_ACTOR (actor);
ClutterUnit w, h, r;
ClutterUnit width, height;
ClutterFixed radius;
/* it is possible to avoid a costly paint by checking whether the
* actor should really be painted in pick mode
@ -447,17 +445,19 @@ foo_actor_pick (ClutterActor *actor,
if (!clutter_actor_should_pick_paint (actor))
return;
w = CLUTTER_UNITS_TO_FIXED (clutter_actor_get_widthu (actor));
h = CLUTTER_UNITS_TO_FIXED (clutter_actor_get_heightu (actor));
clutter_actor_get_sizeu (actor, &amp;width, &amp;height);
/* this is the arc radius for the rounded rectangle corners */
r = CLUTTER_UNITS_TO_FIXED (foo_actor->radius);
radius = CLUTTER_UNITS_TO_FIXED (foo_actor-&amp;radius);
/* use the passed color to paint ourselves */
cogl_color (pick_color);
cogl_set_source_color4ub (pick_color-&gt;red,
pick_color-&gt;green,
pick_color-&gt;blue,
pick_color-&gt;alpha);
/* paint a round rectangle */
cogl_round_rectangle (0, 0, w, h, r, 5);
cogl_round_rectangle (0, 0, width, height, radius, 5);
/* and fill it with the current color */
cogl_fill ();

View File

@ -63,9 +63,6 @@ cogl_util_next_p2
<SECTION>
<FILE>cogl-primitives</FILE>
<TITLE>Primitives</TITLE>
cogl_color
cogl_path_fill
cogl_path_stroke
cogl_path_move_to
cogl_path_close
cogl_path_line_to
@ -80,6 +77,15 @@ cogl_path_polygon
cogl_path_rectangle
cogl_path_round_rectangle
cogl_path_ellipse
<SUBSECTION>
cogl_path_fill
cogl_path_stroke
cogl_set_source_color
cogl_set_source_color4ub
cogl_set_source_color4x
<SUBSECTION>
cogl_rectangle
cogl_rectanglex
</SECTION>
@ -236,8 +242,12 @@ cogl_double_to_unit
<FILE>cogl-color</FILE>
<TITLE>Color Type</TITLE>
CoglColor
cogl_color_new
cogl_color_copy
cogl_color_free
cogl_color_set_from_4ub
cogl_color_set_from_4d
cogl_color_set_from_4x
<SUBSECTION>
cogl_color_get_red
@ -264,11 +274,13 @@ cogl_color_get_alpha_float
cogl_mesh_new
cogl_mesh_ref
cogl_mesh_unref
CoglMeshAttributeFlags
cogl_mesh_add_attribute
cogl_mesh_delete_attribute
cogl_mesh_enable_attribute
cogl_mesh_disable_attribute
cogl_mesh_draw_arrays
cogl_mesh_draw_range_elements
cogl_mesh_submit
</SECTION>