mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
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:
parent
0ff710d37b
commit
c823bf9c83
47
ChangeLog
47
ChangeLog
@ -1,3 +1,50 @@
|
||||
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.
|
||||
|
||||
2008-11-12 Neil Roberts <neil@linux.intel.com>
|
||||
|
||||
Bug 1057 - cogl_texture_rectangle doesn't support backward
|
||||
|
@ -608,14 +608,10 @@ clutter_actor_real_pick (ClutterActor *self,
|
||||
*/
|
||||
if (clutter_actor_should_pick_paint (self))
|
||||
{
|
||||
CoglColor c;
|
||||
|
||||
cogl_color_set_from_4ub (&c,
|
||||
color->red,
|
||||
color->green,
|
||||
color->blue,
|
||||
color->alpha);
|
||||
cogl_color (&c);
|
||||
cogl_set_source_color4ub (color->red,
|
||||
color->green,
|
||||
color->blue,
|
||||
color->alpha);
|
||||
cogl_rectangle (0, 0,
|
||||
clutter_actor_get_width (self),
|
||||
clutter_actor_get_height (self));
|
||||
|
@ -142,7 +142,6 @@ clutter_clone_texture_paint (ClutterActor *self)
|
||||
ClutterCloneTexturePrivate *priv;
|
||||
ClutterActor *parent_texture;
|
||||
gint x_1, y_1, x_2, y_2;
|
||||
CoglColor col;
|
||||
CoglHandle cogl_texture;
|
||||
ClutterFixed t_w, t_h;
|
||||
guint tex_width, tex_height;
|
||||
@ -178,9 +177,8 @@ clutter_clone_texture_paint (ClutterActor *self)
|
||||
CLUTTER_TEXTURE_IN_CLONE_PAINT);
|
||||
}
|
||||
|
||||
cogl_color_set_from_4ub (&col, 255, 255, 255,
|
||||
clutter_actor_get_paint_opacity (self));
|
||||
cogl_color (&col);
|
||||
cogl_set_source_color4ub (255, 255, 255,
|
||||
clutter_actor_get_paint_opacity (self));
|
||||
|
||||
clutter_actor_get_allocation_coords (self, &x_1, &y_1, &x_2, &y_2);
|
||||
|
||||
|
@ -411,14 +411,11 @@ clutter_entry_paint_cursor (ClutterEntry *entry)
|
||||
|
||||
if (priv->show_cursor)
|
||||
{
|
||||
CoglColor cursor_color;
|
||||
cogl_set_source_color4ub (priv->fgcol.red,
|
||||
priv->fgcol.green,
|
||||
priv->fgcol.blue,
|
||||
priv->fgcol.alpha);
|
||||
|
||||
cogl_color_set_from_4ub (&cursor_color,
|
||||
priv->fgcol.red,
|
||||
priv->fgcol.green,
|
||||
priv->fgcol.blue,
|
||||
priv->fgcol.alpha);
|
||||
cogl_color (&cursor_color);
|
||||
cogl_rectangle (priv->cursor_pos.x,
|
||||
priv->cursor_pos.y,
|
||||
priv->cursor_pos.width,
|
||||
@ -435,7 +432,7 @@ clutter_entry_paint (ClutterActor *self)
|
||||
gint width, actor_width;
|
||||
gint text_width;
|
||||
gint cursor_x;
|
||||
CoglColor color;
|
||||
CoglColor color = { 0, };
|
||||
|
||||
entry = CLUTTER_ENTRY(self);
|
||||
priv = entry->priv;
|
||||
|
@ -281,8 +281,8 @@ clutter_label_paint (ClutterActor *self)
|
||||
ClutterLabel *label = CLUTTER_LABEL (self);
|
||||
ClutterLabelPrivate *priv = label->priv;
|
||||
PangoLayout *layout;
|
||||
CoglColor color;
|
||||
ClutterActorBox alloc = { 0, };
|
||||
CoglColor color = { 0, };
|
||||
|
||||
if (priv->font_desc == NULL || priv->text == NULL)
|
||||
{
|
||||
|
@ -73,7 +73,6 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
ClutterRectangle *rectangle = CLUTTER_RECTANGLE(self);
|
||||
ClutterRectanglePrivate *priv;
|
||||
ClutterGeometry geom;
|
||||
CoglColor tmp_col;
|
||||
guint8 tmp_alpha;
|
||||
|
||||
rectangle = CLUTTER_RECTANGLE(self);
|
||||
@ -94,16 +93,14 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
* account the opacity of the color set by the user
|
||||
*/
|
||||
tmp_alpha = clutter_actor_get_paint_opacity (self)
|
||||
* priv->border_color.alpha
|
||||
/ 255;
|
||||
* priv->border_color.alpha
|
||||
/ 255;
|
||||
|
||||
/* paint the border */
|
||||
cogl_color_set_from_4ub (&tmp_col,
|
||||
priv->border_color.red,
|
||||
priv->border_color.green,
|
||||
priv->border_color.blue,
|
||||
tmp_alpha);
|
||||
cogl_color (&tmp_col);
|
||||
cogl_set_source_color4ub (priv->border_color.red,
|
||||
priv->border_color.green,
|
||||
priv->border_color.blue,
|
||||
tmp_alpha);
|
||||
|
||||
/* this sucks, but it's the only way to make a border */
|
||||
cogl_rectangle (priv->border_width, 0,
|
||||
@ -124,16 +121,14 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
geom.height - priv->border_width);
|
||||
|
||||
tmp_alpha = clutter_actor_get_paint_opacity (self)
|
||||
* priv->color.alpha
|
||||
/ 255;
|
||||
* priv->color.alpha
|
||||
/ 255;
|
||||
|
||||
/* now paint the rectangle */
|
||||
cogl_color_set_from_4ub (&tmp_col,
|
||||
priv->color.red,
|
||||
priv->color.green,
|
||||
priv->color.blue,
|
||||
tmp_alpha);
|
||||
cogl_color (&tmp_col);
|
||||
cogl_set_source_color4ub (priv->color.red,
|
||||
priv->color.green,
|
||||
priv->color.blue,
|
||||
tmp_alpha);
|
||||
|
||||
cogl_rectangle (priv->border_width, priv->border_width,
|
||||
geom.width - priv->border_width * 2,
|
||||
@ -145,15 +140,13 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
* account the opacity of the color set by the user
|
||||
*/
|
||||
tmp_alpha = clutter_actor_get_paint_opacity (self)
|
||||
* priv->color.alpha
|
||||
/ 255;
|
||||
* priv->color.alpha
|
||||
/ 255;
|
||||
|
||||
cogl_color_set_from_4ub (&tmp_col,
|
||||
priv->color.red,
|
||||
priv->color.green,
|
||||
priv->color.blue,
|
||||
tmp_alpha);
|
||||
cogl_color (&tmp_col);
|
||||
cogl_set_source_color4ub (priv->color.red,
|
||||
priv->color.green,
|
||||
priv->color.blue,
|
||||
tmp_alpha);
|
||||
|
||||
cogl_rectangle (0, 0, geom.width, geom.height);
|
||||
}
|
||||
|
@ -473,7 +473,6 @@ clutter_texture_paint (ClutterActor *self)
|
||||
ClutterTexture *texture = CLUTTER_TEXTURE (self);
|
||||
ClutterTexturePrivate *priv = texture->priv;
|
||||
gint x_1, y_1, x_2, y_2;
|
||||
CoglColor col;
|
||||
CoglColor transparent_col;
|
||||
ClutterFixed t_w, t_h;
|
||||
|
||||
@ -565,12 +564,8 @@ clutter_texture_paint (ClutterActor *self)
|
||||
clutter_actor_get_name (self) ? clutter_actor_get_name (self)
|
||||
: "unknown");
|
||||
|
||||
cogl_color_set_from_4ub (&col,
|
||||
255,
|
||||
255,
|
||||
255,
|
||||
clutter_actor_get_paint_opacity (self));
|
||||
cogl_color (&col);
|
||||
cogl_set_source_color4ub (255, 255, 255,
|
||||
clutter_actor_get_paint_opacity (self));
|
||||
|
||||
clutter_actor_get_allocation_coords (self, &x_1, &y_1, &x_2, &y_2);
|
||||
|
||||
|
@ -28,6 +28,10 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
CoglColor *cogl_color_new (void);
|
||||
CoglColor *cogl_color_copy (const CoglColor *color);
|
||||
void cogl_color_free (CoglColor *color);
|
||||
|
||||
/**
|
||||
* cogl_color_set_from_4ub:
|
||||
* @dest: return location for a #CoglColor
|
||||
@ -36,7 +40,7 @@ G_BEGIN_DECLS
|
||||
* @blue: value of the blue channel, between 0 and 255
|
||||
* @alpha: value of the alpha channel, between 0 and 255
|
||||
*
|
||||
* Sets the values of the passed channel into a #CoglColor.
|
||||
* Sets the values of the passed channels into a #CoglColor.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
@ -46,14 +50,14 @@ void cogl_color_set_from_4ub (CoglColor *dest,
|
||||
guint8 blue,
|
||||
guint8 alpha);
|
||||
/**
|
||||
* cogl_color_set_from_4ub:
|
||||
* cogl_color_set_from_4d:
|
||||
* @dest: return location for a #CoglColor
|
||||
* @red: value of the red channel, between 0 and 1
|
||||
* @green: value of the green channel, between 0 and 1
|
||||
* @blue: value of the blue channel, between 0 and 1
|
||||
* @alpha: value of the alpha channel, between 0 and 1
|
||||
*
|
||||
* Sets the values of the passed channel into a #CoglColor.
|
||||
* Sets the values of the passed channels into a #CoglColor.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
@ -63,6 +67,24 @@ void cogl_color_set_from_4d (CoglColor *dest,
|
||||
gdouble blue,
|
||||
gdouble alpha);
|
||||
|
||||
/**
|
||||
* cogl_color_set_from_4x:
|
||||
* @dest: return location for a #CoglColor
|
||||
* @red: value of the red channel, between 0 and %COGL_FIXED_1
|
||||
* @green: value of the green channel, between 0 and %COGL_FIXED_1
|
||||
* @blue: value of the blue channel, between 0 and %COGL_FIXED_1
|
||||
* @alpha: value of the alpha channel, between 0 and %COGL_FIXED_1
|
||||
*
|
||||
* Sets the values of the passed channels into a #CoglColor
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void cogl_color_set_from_4x (CoglColor *dest,
|
||||
CoglFixed red,
|
||||
CoglFixed green,
|
||||
CoglFixed blue,
|
||||
CoglFixed alpha);
|
||||
|
||||
/**
|
||||
* cogl_color_get_red_byte:
|
||||
* @color: a #CoglColor
|
||||
@ -219,6 +241,61 @@ CoglFixed cogl_color_get_blue (const CoglColor *color);
|
||||
*/
|
||||
CoglFixed cogl_color_get_alpha (const CoglColor *color);
|
||||
|
||||
/**
|
||||
* cogl_set_source_color:
|
||||
* @color: a #CoglColor
|
||||
*
|
||||
* Sets the source color using normalized values for each component.
|
||||
* This color will be used for any subsequent drawing operation.
|
||||
*
|
||||
* See also cogl_set_source_color4ub() and cogl_set_source_color4x()
|
||||
* if you already have the color components.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void cogl_set_source_color (const CoglColor *color);
|
||||
|
||||
/**
|
||||
* cogl_set_source_color4ub:
|
||||
* @red: value of the red channel, between 0 and 255
|
||||
* @green: value of the green channel, between 0 and 255
|
||||
* @blue: value of the blue channel, between 0 and 255
|
||||
* @alpha: value of the alpha channel, between 0 and 255
|
||||
*
|
||||
* Sets the source color using unsigned bytes for each component. This
|
||||
* color will be used for any subsequent drawing operation.
|
||||
*
|
||||
* The value for each component is an unsigned byte in the range
|
||||
* between 0 and 255.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void cogl_set_source_color4ub (guint8 red,
|
||||
guint8 green,
|
||||
guint8 blue,
|
||||
guint8 alpha);
|
||||
|
||||
/**
|
||||
* cogl_set_source_color4x:
|
||||
* @red: value of the red channel, between 0 and %COGL_FIXED_1
|
||||
* @green: value of the green channel, between 0 and %COGL_FIXED_1
|
||||
* @blue: value of the blue channel, between 0 and %COGL_FIXED_1
|
||||
* @alpha: value of the alpha channel, between 0 and %COGL_FIXED_1
|
||||
*
|
||||
* Sets the source color using normalized values for each component.
|
||||
* This color will be used for any subsequent drawing operation.
|
||||
*
|
||||
* The value for each component is a fixed point number in the range
|
||||
* between 0 and %COGL_FIXED_1. If the values passed in are outside that
|
||||
* range, they will be clamped.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void cogl_set_source_color4x (CoglFixed red,
|
||||
CoglFixed green,
|
||||
CoglFixed blue,
|
||||
CoglFixed alpha);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_COLOR_H__ */
|
||||
|
5
clutter/cogl/cogl-deprecated.h
Normal file
5
clutter/cogl/cogl-deprecated.h
Normal file
@ -0,0 +1,5 @@
|
||||
#ifndef COGL_DEPRECATED_H
|
||||
|
||||
#define cogl_color cogl_color_REPLACED_BY_cogl_set_source_color
|
||||
|
||||
#endif
|
@ -50,16 +50,6 @@ G_BEGIN_DECLS
|
||||
* rather then in the absolute coordinates.
|
||||
*/
|
||||
|
||||
/**
|
||||
* cogl_color:
|
||||
* @color: new current @CoglColor.
|
||||
*
|
||||
* Changes the color of cogl's current paint, which is used for filling and stroking
|
||||
* primitives.
|
||||
*/
|
||||
void cogl_color (const CoglColor *color);
|
||||
|
||||
|
||||
/**
|
||||
* cogl_rectangle:
|
||||
* @x: X coordinate of the top-left corner
|
||||
|
@ -230,11 +230,11 @@ typedef enum
|
||||
struct _CoglColor
|
||||
{
|
||||
/*< private >*/
|
||||
CoglFixed red;
|
||||
CoglFixed green;
|
||||
CoglFixed blue;
|
||||
guint8 red;
|
||||
guint8 green;
|
||||
guint8 blue;
|
||||
|
||||
CoglFixed alpha;
|
||||
guint8 alpha;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <cogl/cogl-shader.h>
|
||||
#include <cogl/cogl-texture.h>
|
||||
#include <cogl/cogl-types.h>
|
||||
#include <cogl/cogl-deprecated.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -5,6 +5,28 @@
|
||||
#include "cogl-color.h"
|
||||
#include "cogl-fixed.h"
|
||||
|
||||
CoglColor *
|
||||
cogl_color_new (void)
|
||||
{
|
||||
return g_slice_new (CoglColor);
|
||||
}
|
||||
|
||||
CoglColor *
|
||||
cogl_color_copy (const CoglColor *color)
|
||||
{
|
||||
if (G_LIKELY (color))
|
||||
return g_slice_dup (CoglColor, color);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_color_free (CoglColor *color)
|
||||
{
|
||||
if (G_LIKELY (color))
|
||||
g_slice_free (CoglColor, color);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_color_set_from_4ub (CoglColor *dest,
|
||||
guint8 red,
|
||||
@ -14,10 +36,10 @@ cogl_color_set_from_4ub (CoglColor *dest,
|
||||
{
|
||||
g_return_if_fail (dest != NULL);
|
||||
|
||||
dest->red = COGL_FIXED_FROM_FLOAT ((float) red / 0xff * 1.0);
|
||||
dest->green = COGL_FIXED_FROM_FLOAT ((float) green / 0xff * 1.0);
|
||||
dest->blue = COGL_FIXED_FROM_FLOAT ((float) blue / 0xff * 1.0);
|
||||
dest->alpha = COGL_FIXED_FROM_FLOAT ((float) alpha / 0xff * 1.0);
|
||||
dest->red = red;
|
||||
dest->green = green;
|
||||
dest->blue = blue;
|
||||
dest->alpha = alpha;
|
||||
}
|
||||
|
||||
void
|
||||
@ -29,80 +51,119 @@ cogl_color_set_from_4d (CoglColor *dest,
|
||||
{
|
||||
g_return_if_fail (dest != NULL);
|
||||
|
||||
dest->red = COGL_FIXED_FROM_FLOAT (CLAMP (red, 0.0, 1.0));
|
||||
dest->green = COGL_FIXED_FROM_FLOAT (CLAMP (green, 0.0, 1.0));
|
||||
dest->blue = COGL_FIXED_FROM_FLOAT (CLAMP (blue, 0.0, 1.0));
|
||||
dest->alpha = COGL_FIXED_FROM_FLOAT (CLAMP (alpha, 0.0, 1.0));
|
||||
dest->red = 255 * red;
|
||||
dest->green = 255 * green;
|
||||
dest->blue = 255 * blue;
|
||||
dest->alpha = 255 * alpha;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_color_set_from_4x (CoglColor *dest,
|
||||
CoglFixed red,
|
||||
CoglFixed green,
|
||||
CoglFixed blue,
|
||||
CoglFixed alpha)
|
||||
{
|
||||
g_return_if_fail (dest != NULL);
|
||||
|
||||
dest->red = COGL_FIXED_TO_INT (red * 255);
|
||||
dest->green = COGL_FIXED_TO_INT (green * 255);
|
||||
dest->blue = COGL_FIXED_TO_INT (blue * 255);
|
||||
dest->alpha = COGL_FIXED_TO_INT (alpha * 255);
|
||||
}
|
||||
|
||||
unsigned char
|
||||
cogl_color_get_red_byte (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_INT (color->red * 255);
|
||||
return color->red;
|
||||
}
|
||||
|
||||
float
|
||||
cogl_color_get_red_float (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_FLOAT (color->red);
|
||||
return (float) color->red / 255.0;
|
||||
}
|
||||
|
||||
CoglFixed
|
||||
cogl_color_get_red (const CoglColor *color)
|
||||
{
|
||||
return color->red;
|
||||
return COGL_FIXED_FROM_FLOAT ((float) color->red / 255.0);
|
||||
}
|
||||
|
||||
unsigned char
|
||||
cogl_color_get_green_byte (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_INT (color->green * 255);
|
||||
return color->green;
|
||||
}
|
||||
|
||||
float
|
||||
cogl_color_get_green_float (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_FLOAT (color->green);
|
||||
return (float) color->green / 255.0;
|
||||
}
|
||||
|
||||
CoglFixed
|
||||
cogl_color_get_green (const CoglColor *color)
|
||||
{
|
||||
return color->green;
|
||||
return COGL_FIXED_FROM_FLOAT ((float) color->green / 255.0);
|
||||
}
|
||||
|
||||
unsigned char
|
||||
cogl_color_get_blue_byte (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_INT (color->blue * 255);
|
||||
return color->blue;
|
||||
}
|
||||
|
||||
float
|
||||
cogl_color_get_blue_float (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_FLOAT (color->blue);
|
||||
return (float) color->blue / 255.0;
|
||||
}
|
||||
|
||||
CoglFixed
|
||||
cogl_color_get_blue (const CoglColor *color)
|
||||
{
|
||||
return color->blue;
|
||||
return COGL_FIXED_FROM_FLOAT ((float) color->blue / 255.0);
|
||||
}
|
||||
|
||||
unsigned char
|
||||
cogl_color_get_alpha_byte (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_INT (color->alpha * 255);
|
||||
return color->alpha;
|
||||
}
|
||||
|
||||
float
|
||||
cogl_color_get_alpha_float (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_FLOAT (color->alpha);
|
||||
return (float) color->alpha / 255.0;
|
||||
}
|
||||
|
||||
CoglFixed
|
||||
cogl_color_get_alpha (const CoglColor *color)
|
||||
{
|
||||
return color->alpha;
|
||||
return COGL_FIXED_FROM_FLOAT ((float) color->alpha / 255.0);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_set_source_color4ub (guint8 red,
|
||||
guint8 green,
|
||||
guint8 blue,
|
||||
guint8 alpha)
|
||||
{
|
||||
CoglColor c = { 0, };
|
||||
|
||||
cogl_color_set_from_4ub (&c, red, green, blue, alpha);
|
||||
cogl_set_source_color (&c);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_set_source_color4x (CoglFixed red,
|
||||
CoglFixed green,
|
||||
CoglFixed blue,
|
||||
CoglFixed alpha)
|
||||
{
|
||||
CoglColor c = { 0, };
|
||||
|
||||
cogl_color_set_from_4x (&c, red, green, blue, alpha);
|
||||
cogl_set_source_color (&c);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ libclutterinclude_HEADERS = \
|
||||
$(top_builddir)/clutter/cogl/cogl.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-defines-gl.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-color.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-deprecated.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-fixed.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-offscreen.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-path.h \
|
||||
@ -32,6 +33,7 @@ libclutter_cogl_la_SOURCES = \
|
||||
$(top_builddir)/clutter/cogl/cogl.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-defines-gl.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-color.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-deprecated.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-fixed.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-offscreen.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-path.h \
|
||||
|
@ -2317,7 +2317,7 @@ cogl_texture_polygon (CoglHandle handle,
|
||||
GLfloat tx, ty;
|
||||
|
||||
if (use_color)
|
||||
cogl_color (&vertices[vnum].color);
|
||||
cogl_set_source_color (&vertices[vnum].color);
|
||||
|
||||
/* Transform the texture co-ordinates so they are
|
||||
relative to the slice */
|
||||
|
@ -380,14 +380,14 @@ cogl_enable_backface_culling (gboolean setting)
|
||||
}
|
||||
|
||||
void
|
||||
cogl_color (const CoglColor *color)
|
||||
cogl_set_source_color (const CoglColor *color)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
glColor4f (cogl_color_get_red_float (color),
|
||||
cogl_color_get_green_float (color),
|
||||
cogl_color_get_blue_float (color),
|
||||
cogl_color_get_alpha_float (color));
|
||||
glColor4ub (cogl_color_get_red_byte (color),
|
||||
cogl_color_get_green_byte (color),
|
||||
cogl_color_get_blue_byte (color),
|
||||
cogl_color_get_alpha_byte (color));
|
||||
|
||||
/* Store alpha for proper blending enables */
|
||||
ctx->color_alpha = cogl_color_get_alpha_byte (color);
|
||||
|
@ -3,6 +3,7 @@ libclutterinclude_HEADERS = \
|
||||
$(top_builddir)/clutter/cogl/cogl.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-defines-gles.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-color.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-deprecated.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-fixed.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-offscreen.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-path.h \
|
||||
@ -32,6 +33,7 @@ libclutter_cogl_la_SOURCES = \
|
||||
$(top_builddir)/clutter/cogl/cogl.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-defines-gles.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-color.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-deprecated.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-fixed.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-offscreen.h \
|
||||
$(top_builddir)/clutter/cogl/cogl-path.h \
|
||||
|
@ -505,7 +505,7 @@ _cogl_texture_download_from_gl (CoglTexture *tex,
|
||||
old_dst_factor = ctx->blend_dst_factor;
|
||||
|
||||
/* Direct copy operation */
|
||||
cogl_color (&cwhite);
|
||||
cogl_set_source_color (&cwhite);
|
||||
cogl_blend_func (CGL_ONE, CGL_ZERO);
|
||||
_cogl_texture_draw_and_read (tex, target_bmp,
|
||||
&cwhite, viewport);
|
||||
@ -2302,5 +2302,5 @@ cogl_texture_polygon (CoglHandle handle,
|
||||
/* Set the last color so that the cache of the alpha value will work
|
||||
properly */
|
||||
if (use_color && n_vertices > 0)
|
||||
cogl_color (&vertices[n_vertices - 1].color);
|
||||
cogl_set_source_color (&vertices[n_vertices - 1].color);
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ cogl_enable_backface_culling (gboolean setting)
|
||||
}
|
||||
|
||||
void
|
||||
cogl_color (const CoglColor *color)
|
||||
cogl_set_source_color (const CoglColor *color)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
|
@ -347,24 +347,20 @@ cogl_pango_ensure_glyph_cache_for_layout (PangoLayout *layout)
|
||||
|
||||
static void
|
||||
cogl_pango_renderer_set_color_for_part (PangoRenderer *renderer,
|
||||
PangoRenderPart part)
|
||||
PangoRenderPart part)
|
||||
{
|
||||
PangoColor *pango_color = pango_renderer_get_color (renderer, part);
|
||||
CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer);
|
||||
CoglColor color;
|
||||
|
||||
if (pango_color)
|
||||
{
|
||||
cogl_color_set_from_4ub (&color,
|
||||
pango_color->red >> 8,
|
||||
pango_color->green >> 8,
|
||||
pango_color->blue >> 8,
|
||||
cogl_color_get_alpha_byte (&priv->color));
|
||||
cogl_set_source_color4ub (pango_color->red >> 8,
|
||||
pango_color->green >> 8,
|
||||
pango_color->blue >> 8,
|
||||
cogl_color_get_alpha_byte (&priv->color));
|
||||
}
|
||||
else
|
||||
color = priv->color;
|
||||
|
||||
cogl_color (&color);
|
||||
cogl_set_source_color (&priv->color);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -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->bg_color.red;
|
||||
color.green = foo_actor->bg_color.green;
|
||||
color.blue = foo_actor->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 (&color);
|
||||
cogl_set_source_color4ub (priv->fgcol.red,
|
||||
priv->fgcol.green,
|
||||
priv->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, &width, &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-&radius);
|
||||
|
||||
/* use the passed color to paint ourselves */
|
||||
cogl_color (pick_color);
|
||||
cogl_set_source_color4ub (pick_color->red,
|
||||
pick_color->green,
|
||||
pick_color->blue,
|
||||
pick_color->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 ();
|
||||
|
@ -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>
|
||||
|
||||
|
@ -81,7 +81,6 @@ static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
CoglColor color;
|
||||
ClutterFixed texcoords[4] = {
|
||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||
@ -91,34 +90,29 @@ test_coglbox_paint(ClutterActor *self)
|
||||
|
||||
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
|
||||
cogl_color_set_from_4ub (&color, 0x66, 0x66, 0xdd, 0xff);
|
||||
cogl_color (&color);
|
||||
cogl_rectangle (0,0,400,400);
|
||||
cogl_set_source_color4ub (0x66, 0x66, 0xdd, 0xff);
|
||||
cogl_rectangle (0, 0, 400, 400);
|
||||
|
||||
cogl_color_set_from_4ub (&color, 0xff, 0xff, 0xff, 0xff);
|
||||
cogl_color (&color);
|
||||
cogl_set_source_color4ub (0xff, 0xff, 0xff, 0xff);
|
||||
cogl_texture_rectangle (priv->texhand_id,
|
||||
0,0,
|
||||
0, 0,
|
||||
CLUTTER_INT_TO_FIXED (400),
|
||||
CLUTTER_INT_TO_FIXED (400),
|
||||
0,0,
|
||||
0, 0,
|
||||
CLUTTER_INT_TO_FIXED (6),
|
||||
CLUTTER_INT_TO_FIXED (6));
|
||||
|
||||
cogl_draw_buffer (COGL_OFFSCREEN_BUFFER, priv->offscreen_id);
|
||||
|
||||
cogl_color_set_from_4ub (&color, 0xff, 0, 0, 0xff);
|
||||
cogl_color (&color);
|
||||
cogl_rectangle (20,20,100,100);
|
||||
cogl_set_source_color4ub (0xff, 0, 0, 0xff);
|
||||
cogl_rectangle (20, 20, 100, 100);
|
||||
|
||||
cogl_color_set_from_4ub (&color, 0, 0xff, 0, 0xff);
|
||||
cogl_color (&color);
|
||||
cogl_rectangle (80,80,100,100);
|
||||
cogl_set_source_color4ub (0, 0xff, 0, 0xff);
|
||||
cogl_rectangle (80, 80, 100, 100);
|
||||
|
||||
cogl_draw_buffer (COGL_WINDOW_BUFFER, 0);
|
||||
|
||||
cogl_color_set_from_4ub (&color, 0xff, 0xff, 0xff, 0x88);
|
||||
cogl_color (&color);
|
||||
cogl_set_source_color4ub (0xff, 0xff, 0xff, 0x88);
|
||||
cogl_texture_rectangle (priv->texture_id,
|
||||
CLUTTER_INT_TO_FIXED (100),
|
||||
CLUTTER_INT_TO_FIXED (100),
|
||||
|
@ -177,8 +177,6 @@ static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv;
|
||||
CoglColor cfill;
|
||||
CoglColor cstroke;
|
||||
|
||||
static GTimer *timer = NULL;
|
||||
static gint paint_index = 0;
|
||||
@ -202,20 +200,17 @@ test_coglbox_paint(ClutterActor *self)
|
||||
paint_index = paint_index % NUM_PAINT_FUNCS;
|
||||
g_timer_start (timer);
|
||||
}
|
||||
|
||||
cogl_color_set_from_4ub (&cfill, 0, 160, 0, 255);
|
||||
cogl_color_set_from_4ub (&cstroke, 200, 0, 0, 255);
|
||||
|
||||
|
||||
cogl_push_matrix ();
|
||||
|
||||
paint_func[paint_index] ();
|
||||
|
||||
cogl_translate (100,100,0);
|
||||
cogl_color (&cstroke);
|
||||
cogl_translate (100, 100, 0);
|
||||
cogl_set_source_color4ub (0, 160, 0, 255);
|
||||
cogl_path_stroke ();
|
||||
|
||||
cogl_translate (150,0,0);
|
||||
cogl_color (&cfill);
|
||||
cogl_translate (150, 0, 0);
|
||||
cogl_set_source_color4ub (200, 0, 0, 255);
|
||||
cogl_path_fill ();
|
||||
|
||||
cogl_pop_matrix();
|
||||
|
@ -80,25 +80,20 @@ static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
CoglColor cback;
|
||||
CoglColor cwhite;
|
||||
|
||||
ClutterFixed texcoords[4] = {
|
||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||
CLUTTER_FLOAT_TO_FIXED (1.0f),
|
||||
CLUTTER_FLOAT_TO_FIXED (1.0f)
|
||||
};
|
||||
|
||||
|
||||
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
|
||||
cogl_color_set_from_4ub (&cback, 0x66, 0x66, 0xdd, 0xff);
|
||||
cogl_color (&cback);
|
||||
cogl_rectangle (0,0,400,400);
|
||||
|
||||
cogl_color_set_from_4ub (&cwhite, 0xff, 0xff, 0xff, 0xff);
|
||||
cogl_color (&cwhite);
|
||||
|
||||
|
||||
cogl_set_source_color4ub (0x66, 0x66, 0xdd, 0xff);
|
||||
cogl_rectangle (0, 0, 400, 400);
|
||||
|
||||
cogl_set_source_color4ub (0xff, 0xff, 0xff, 0xff);
|
||||
|
||||
cogl_push_matrix ();
|
||||
cogl_texture_rectangle (priv->cogl_tex_id[0],
|
||||
0, 0,
|
||||
@ -106,37 +101,37 @@ test_coglbox_paint(ClutterActor *self)
|
||||
CLUTTER_INT_TO_FIXED (213),
|
||||
texcoords[0], texcoords[1],
|
||||
texcoords[2], texcoords[3]);
|
||||
|
||||
|
||||
cogl_pop_matrix ();
|
||||
cogl_push_matrix ();
|
||||
cogl_translate (200,0,0);
|
||||
cogl_translate (200, 0, 0);
|
||||
cogl_texture_rectangle (priv->cogl_tex_id[1],
|
||||
0, 0,
|
||||
CLUTTER_INT_TO_FIXED (200),
|
||||
CLUTTER_INT_TO_FIXED (213),
|
||||
texcoords[0], texcoords[1],
|
||||
texcoords[2], texcoords[3]);
|
||||
|
||||
|
||||
cogl_pop_matrix ();
|
||||
cogl_push_matrix ();
|
||||
cogl_translate (0,200,0);
|
||||
cogl_translate (0, 200, 0);
|
||||
cogl_texture_rectangle (priv->cogl_tex_id[2],
|
||||
0, 0,
|
||||
CLUTTER_INT_TO_FIXED (200),
|
||||
CLUTTER_INT_TO_FIXED (213),
|
||||
texcoords[0], texcoords[1],
|
||||
texcoords[2], texcoords[3]);
|
||||
|
||||
|
||||
cogl_pop_matrix ();
|
||||
cogl_push_matrix ();
|
||||
cogl_translate (200,200,0);
|
||||
cogl_translate (200, 200, 0);
|
||||
cogl_texture_rectangle (priv->cogl_tex_id[3],
|
||||
0, 0,
|
||||
CLUTTER_INT_TO_FIXED (200),
|
||||
CLUTTER_INT_TO_FIXED (213),
|
||||
texcoords[0], texcoords[1],
|
||||
texcoords[2], texcoords[3]);
|
||||
|
||||
|
||||
cogl_pop_matrix();
|
||||
}
|
||||
|
||||
|
@ -80,8 +80,6 @@ static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
CoglColor cback;
|
||||
CoglColor cwhite;
|
||||
ClutterFixed texcoords[4] = {
|
||||
CLUTTER_FLOAT_TO_FIXED (0.3f),
|
||||
CLUTTER_FLOAT_TO_FIXED (0.3f),
|
||||
@ -91,12 +89,10 @@ test_coglbox_paint(ClutterActor *self)
|
||||
|
||||
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
|
||||
cogl_color_set_from_4ub (&cback, 0x66, 0x66, 0xdd, 0xff);
|
||||
cogl_color (&cback);
|
||||
cogl_set_source_color4ub (0x66, 0x66, 0xdd, 0xff);
|
||||
cogl_rectangle (0,0,400,400);
|
||||
|
||||
cogl_color_set_from_4ub (&cwhite, 0xff, 0xff, 0xff, 0xff);
|
||||
cogl_color (&cwhite);
|
||||
cogl_set_source_color4ub (0xff, 0xff, 0xff, 0xff);
|
||||
|
||||
cogl_push_matrix ();
|
||||
|
||||
|
@ -79,27 +79,23 @@ static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
CoglColor cback;
|
||||
CoglColor cwhite;
|
||||
ClutterFixed texcoords[4] = {
|
||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||
CLUTTER_FLOAT_TO_FIXED (1.0f),
|
||||
CLUTTER_FLOAT_TO_FIXED (1.0f)
|
||||
};
|
||||
|
||||
|
||||
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
|
||||
cogl_color_set_from_4ub (&cback, 0x66, 0x66, 0xdd, 0xff);
|
||||
cogl_color (&cback);
|
||||
cogl_rectangle (0,0,400,400);
|
||||
|
||||
cogl_color_set_from_4ub (&cwhite, 0xff, 0xff, 0xff, 0xff);
|
||||
cogl_color (&cwhite);
|
||||
cogl_set_source_color4ub (0x66, 0x66, 0xdd, 0xff);
|
||||
cogl_rectangle (0, 0, 400, 400);
|
||||
|
||||
cogl_set_source_color4ub (0xff, 0xff, 0xff, 0xff);
|
||||
|
||||
cogl_push_matrix ();
|
||||
|
||||
cogl_translate (100,100,0);
|
||||
|
||||
cogl_translate (100, 100, 0);
|
||||
cogl_texture_rectangle (priv->cogl_tex_id[1],
|
||||
0, 0,
|
||||
CLUTTER_INT_TO_FIXED (200),
|
||||
|
@ -90,7 +90,6 @@ test_coglbox_fade_texture (CoglHandle tex_id,
|
||||
ClutterFixed ty2)
|
||||
{
|
||||
CoglTextureVertex vertices[4];
|
||||
CoglColor white;
|
||||
int i;
|
||||
|
||||
vertices[0].x = x1;
|
||||
@ -125,8 +124,7 @@ test_coglbox_fade_texture (CoglHandle tex_id,
|
||||
|
||||
cogl_texture_polygon (tex_id, 4, vertices, TRUE);
|
||||
|
||||
cogl_color_set_from_4ub (&white, 0xff, 0xff, 0xff, 0xff);
|
||||
cogl_color (&white);
|
||||
cogl_set_source_color4ub (255, 255, 255, 255);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -171,12 +169,10 @@ test_coglbox_paint (ClutterActor *self)
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
CoglHandle tex_handle = priv->use_sliced ? priv->sliced_tex
|
||||
: priv->not_sliced_tex;
|
||||
CoglColor white;
|
||||
int tex_width = cogl_texture_get_width (tex_handle);
|
||||
int tex_height = cogl_texture_get_height (tex_handle);
|
||||
|
||||
cogl_color_set_from_4ub (&white, 255, 255, 255, 255);
|
||||
cogl_color (&white);
|
||||
cogl_set_source_color4ub (255, 255, 255, 255);
|
||||
|
||||
cogl_texture_set_filters (tex_handle,
|
||||
priv->use_linear_filtering
|
||||
|
@ -80,21 +80,16 @@ static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
|
||||
CoglColor cback = {0x66, 0x66, 0xDD, 0xFF};
|
||||
CoglColor cwhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||
ClutterFixed texcoords[4] = {
|
||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||
CLUTTER_FLOAT_TO_FIXED (1.0f),
|
||||
CLUTTER_FLOAT_TO_FIXED (1.0f)
|
||||
};
|
||||
|
||||
};
|
||||
gint pingpong_frame;
|
||||
ClutterFixed sin_frame, cos_frame;
|
||||
ClutterFixed frac_frame;
|
||||
gint t;
|
||||
|
||||
sin_frame = clutter_sini (CLUTTER_ANGLE_FROM_DEG (priv->frame));
|
||||
cos_frame = clutter_cosi (CLUTTER_ANGLE_FROM_DEG (priv->frame));
|
||||
|
||||
@ -117,13 +112,11 @@ test_coglbox_paint(ClutterActor *self)
|
||||
|
||||
cogl_push_matrix ();
|
||||
|
||||
cogl_color_set_from_4ub (&cback, 0x66, 0x66, 0xdd, 0xff);
|
||||
cogl_color (&cback);
|
||||
cogl_rectangle (0,0,400,400);
|
||||
cogl_set_source_color4ub (0x66, 0x66, 0xdd, 0xff);
|
||||
cogl_rectangle (0, 0, 400, 400);
|
||||
|
||||
cogl_color_set_from_4ub (&cwhite, 0xff, 0xff, 0xff, 0xff);
|
||||
cogl_color (&cwhite);
|
||||
cogl_translate (100,100,0);
|
||||
cogl_set_source_color4ub (0xff, 0xff, 0xff, 0xff);
|
||||
cogl_translate (100, 100, 0);
|
||||
cogl_texture_rectangle (priv->cogl_tex_id,
|
||||
0, 0,
|
||||
CLUTTER_INT_TO_FIXED (200),
|
||||
|
@ -124,15 +124,13 @@ static void
|
||||
hand_pre_paint (ClutterActor *actor,
|
||||
gpointer user_data)
|
||||
{
|
||||
CoglColor red;
|
||||
guint w, h;
|
||||
|
||||
g_assert (hand_pre_paint_guard == FALSE);
|
||||
|
||||
clutter_actor_get_size (actor, &w, &h);
|
||||
|
||||
cogl_color_set_from_4ub (&red, 255, 0, 0, 128);
|
||||
cogl_color (&red);
|
||||
cogl_set_source_color4ub (255, 0, 0, 128);
|
||||
cogl_rectangle (0, 0, w / 2, h / 2);
|
||||
|
||||
hand_pre_paint_guard = TRUE;
|
||||
@ -142,15 +140,13 @@ static void
|
||||
hand_post_paint (ClutterActor *actor,
|
||||
gpointer user_data)
|
||||
{
|
||||
CoglColor green;
|
||||
guint w, h;
|
||||
|
||||
g_assert (hand_pre_paint_guard == TRUE);
|
||||
|
||||
clutter_actor_get_size (actor, &w, &h);
|
||||
|
||||
cogl_color_set_from_4ub (&green, 0, 255, 0, 128);
|
||||
cogl_color (&green);
|
||||
cogl_set_source_color4ub (0, 255, 0, 128);
|
||||
cogl_rectangle (w / 2, h / 2, w / 2, h / 2);
|
||||
|
||||
hand_pre_paint_guard = FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user