mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1210 - Add CoglColor API * clutter/cogl/cogl-color.h: * clutter/cogl/cogl.h.in: * clutter/cogl/common/Makefile.am: * clutter/cogl/common/cogl-color.c: * clutter/cogl/gl/Makefile.am: * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/Makefile.am: * clutter/cogl/gles/cogl-texture.c: * clutter/cogl/gles/cogl.c: Add a new color-type, to be used by COGL. CoglColor is optimized to allow the minimum amount of conversions possible for both GL and GLES implementations. * clutter/clutter-actor.c: * clutter/clutter-clone-texture.c: * clutter/clutter-entry.c: * clutter/clutter-main.c: * clutter/clutter-rectangle.c: * clutter/clutter-stage.c: * clutter/clutter-texture.c: Use CoglColor when needed. * clutter/pango/pangoclutter-render.c: Use CoglColor when needed. * doc/reference/cogl/cogl-docs.sgml: * doc/reference/cogl/cogl-sections.txt: Update the documentation. * tests/test-cogl-offscreen.c: * tests/test-cogl-primitives.c: * tests/test-cogl-tex-convert.c: * tests/test-cogl-tex-foreign.c: * tests/test-cogl-tex-getset.c: * tests/test-cogl-tex-polygon.c: * tests/test-cogl-tex-tile.c: * tests/test-paint-wrapper.c: Update the tests. * README: Update release notes.
This commit is contained in:
parent
911b395c8a
commit
a547cdbc4d
40
ChangeLog
40
ChangeLog
@ -1,3 +1,43 @@
|
||||
2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
|
||||
Bug 1210 - Add CoglColor API
|
||||
|
||||
* clutter/cogl/cogl-color.h:
|
||||
* clutter/cogl/cogl.h.in:
|
||||
* clutter/cogl/common/Makefile.am:
|
||||
* clutter/cogl/common/cogl-color.c:
|
||||
* clutter/cogl/gl/Makefile.am:
|
||||
* clutter/cogl/gl/cogl.c:
|
||||
* clutter/cogl/gles/Makefile.am:
|
||||
* clutter/cogl/gles/cogl-texture.c:
|
||||
* clutter/cogl/gles/cogl.c: Add a new color-type, to be used by
|
||||
COGL. CoglColor is optimized to allow the minimum amount of
|
||||
conversions possible for both GL and GLES implementations.
|
||||
|
||||
* clutter/clutter-actor.c:
|
||||
* clutter/clutter-clone-texture.c:
|
||||
* clutter/clutter-entry.c:
|
||||
* clutter/clutter-main.c:
|
||||
* clutter/clutter-rectangle.c:
|
||||
* clutter/clutter-stage.c:
|
||||
* clutter/clutter-texture.c: Use CoglColor when needed.
|
||||
|
||||
* clutter/pango/pangoclutter-render.c: Use CoglColor when needed.
|
||||
|
||||
* doc/reference/cogl/cogl-docs.sgml:
|
||||
* doc/reference/cogl/cogl-sections.txt: Update the documentation.
|
||||
|
||||
* tests/test-cogl-offscreen.c:
|
||||
* tests/test-cogl-primitives.c:
|
||||
* tests/test-cogl-tex-convert.c:
|
||||
* tests/test-cogl-tex-foreign.c:
|
||||
* tests/test-cogl-tex-getset.c:
|
||||
* tests/test-cogl-tex-polygon.c:
|
||||
* tests/test-cogl-tex-tile.c:
|
||||
* tests/test-paint-wrapper.c: Update the tests.
|
||||
|
||||
* README: Update release notes.
|
||||
|
||||
2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
|
||||
|
||||
Bug 1209 - Move fixed point API in COGL
|
||||
|
5
README
5
README
@ -170,6 +170,11 @@ wanting to port to newer releases (See NEWS for general new feature info).
|
||||
Release Notes for Clutter 1.0
|
||||
-------------------------------
|
||||
|
||||
* COGL has an internal Color type, used to store a color definition
|
||||
that can be efficiently used with the least amount of conversions
|
||||
by both the GL and GLES implementations. The COGL API has been
|
||||
changed to drop the usage of ClutterColor in favour of CoglColor.
|
||||
|
||||
* The fixed point API implementation Clutter uses internally has been
|
||||
moved from the Clutter namespace to the COGL one. The ClutterFixed
|
||||
type and relative API is just a wrapper around CoglFixed and its
|
||||
|
@ -608,7 +608,14 @@ clutter_actor_real_pick (ClutterActor *self,
|
||||
*/
|
||||
if (clutter_actor_should_pick_paint (self))
|
||||
{
|
||||
cogl_color (color);
|
||||
CoglColor c;
|
||||
|
||||
cogl_color_set_from_4ub (&c,
|
||||
color->red,
|
||||
color->green,
|
||||
color->blue,
|
||||
color->alpha);
|
||||
cogl_color (&c);
|
||||
cogl_rectangle (0, 0,
|
||||
clutter_actor_get_width (self),
|
||||
clutter_actor_get_height (self));
|
||||
|
@ -142,7 +142,7 @@ clutter_clone_texture_paint (ClutterActor *self)
|
||||
ClutterCloneTexturePrivate *priv;
|
||||
ClutterActor *parent_texture;
|
||||
gint x_1, y_1, x_2, y_2;
|
||||
ClutterColor col = { 0xff, 0xff, 0xff, 0xff };
|
||||
CoglColor col;
|
||||
CoglHandle cogl_texture;
|
||||
ClutterFixed t_w, t_h;
|
||||
guint tex_width, tex_height;
|
||||
@ -165,7 +165,8 @@ clutter_clone_texture_paint (ClutterActor *self)
|
||||
if (!CLUTTER_ACTOR_IS_REALIZED (parent_texture))
|
||||
clutter_actor_realize (parent_texture);
|
||||
|
||||
col.alpha = clutter_actor_get_paint_opacity (self);
|
||||
cogl_color_set_from_4ub (&col, 255, 255, 255,
|
||||
clutter_actor_get_paint_opacity (self));
|
||||
cogl_color (&col);
|
||||
|
||||
clutter_actor_get_allocation_coords (self, &x_1, &y_1, &x_2, &y_2);
|
||||
|
@ -410,7 +410,14 @@ clutter_entry_paint_cursor (ClutterEntry *entry)
|
||||
|
||||
if (priv->show_cursor)
|
||||
{
|
||||
cogl_color (&priv->fgcol);
|
||||
CoglColor cursor_color;
|
||||
|
||||
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,
|
||||
|
@ -351,7 +351,7 @@ _clutter_do_pick (ClutterStage *stage,
|
||||
ClutterMainContext *context;
|
||||
guchar pixel[4];
|
||||
GLint viewport[4];
|
||||
ClutterColor white = { 0xff, 0xff, 0xff, 0xff };
|
||||
CoglColor white;
|
||||
guint32 id;
|
||||
GLboolean dither_was_on;
|
||||
|
||||
@ -362,6 +362,7 @@ _clutter_do_pick (ClutterStage *stage,
|
||||
/* needed for when a context switch happens */
|
||||
_clutter_stage_maybe_setup_viewport (stage);
|
||||
|
||||
cogl_color_set_from_4ub (&white, 255, 255, 255, 255);
|
||||
cogl_paint_init (&white);
|
||||
|
||||
/* Disable dithering (if any) when doing the painting in pick mode */
|
||||
|
@ -73,7 +73,8 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
ClutterRectangle *rectangle = CLUTTER_RECTANGLE(self);
|
||||
ClutterRectanglePrivate *priv;
|
||||
ClutterGeometry geom;
|
||||
ClutterColor tmp_col;
|
||||
CoglColor tmp_col;
|
||||
guint8 tmp_alpha;
|
||||
|
||||
rectangle = CLUTTER_RECTANGLE(self);
|
||||
priv = rectangle->priv;
|
||||
@ -84,18 +85,24 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
: "unknown");
|
||||
clutter_actor_get_allocation_geometry (self, &geom);
|
||||
|
||||
/* compute the composited opacity of the actor taking into
|
||||
* account the opacity of the color set by the user
|
||||
*/
|
||||
tmp_alpha = clutter_actor_get_paint_opacity (self)
|
||||
* priv->border_color.alpha
|
||||
/ 255;
|
||||
|
||||
/* parent paint call will have translated us into position so
|
||||
* paint from 0, 0
|
||||
*/
|
||||
if (priv->has_border)
|
||||
{
|
||||
tmp_col.red = priv->border_color.red;
|
||||
tmp_col.green = priv->border_color.green;
|
||||
tmp_col.blue = priv->border_color.blue;
|
||||
tmp_col.alpha = clutter_actor_get_paint_opacity (self)
|
||||
* 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);
|
||||
|
||||
/* this sucks, but it's the only way to make a border */
|
||||
@ -116,13 +123,12 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
priv->border_width,
|
||||
geom.height - priv->border_width);
|
||||
|
||||
tmp_col.red = priv->color.red;
|
||||
tmp_col.green = priv->color.green;
|
||||
tmp_col.blue = priv->color.blue;
|
||||
tmp_col.alpha = clutter_actor_get_paint_opacity (self)
|
||||
* 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_rectangle (priv->border_width, priv->border_width,
|
||||
@ -131,13 +137,11 @@ clutter_rectangle_paint (ClutterActor *self)
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_col.red = priv->color.red;
|
||||
tmp_col.green = priv->color.green;
|
||||
tmp_col.blue = priv->color.blue;
|
||||
tmp_col.alpha = clutter_actor_get_paint_opacity (self)
|
||||
* 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_rectangle (0, 0, geom.width, geom.height);
|
||||
|
@ -209,16 +209,22 @@ static void
|
||||
clutter_stage_paint (ClutterActor *self)
|
||||
{
|
||||
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
||||
CoglColor stage_color;
|
||||
|
||||
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_PAINT);
|
||||
|
||||
CLUTTER_NOTE (PAINT, "Initializing stage paint");
|
||||
|
||||
cogl_paint_init (&priv->color);
|
||||
cogl_color_set_from_4ub (&stage_color,
|
||||
priv->color.red,
|
||||
priv->color.green,
|
||||
priv->color.blue,
|
||||
priv->color.alpha);
|
||||
cogl_paint_init (&stage_color);
|
||||
|
||||
if (priv->use_fog)
|
||||
{
|
||||
cogl_fog_set (&priv->color,
|
||||
cogl_fog_set (&stage_color,
|
||||
priv->fog.density,
|
||||
priv->fog.z_near,
|
||||
priv->fog.z_far);
|
||||
|
@ -492,8 +492,8 @@ clutter_texture_paint (ClutterActor *self)
|
||||
ClutterTexture *texture = CLUTTER_TEXTURE (self);
|
||||
ClutterTexturePrivate *priv = texture->priv;
|
||||
gint x_1, y_1, x_2, y_2;
|
||||
ClutterColor col = { 0xff, 0xff, 0xff, 0xff };
|
||||
ClutterColor transparent_col = { 0, 0, 0, 0 };
|
||||
CoglColor col;
|
||||
CoglColor transparent_col;
|
||||
ClutterFixed t_w, t_h;
|
||||
|
||||
if (!CLUTTER_ACTOR_IS_REALIZED (CLUTTER_ACTOR(texture)))
|
||||
@ -547,6 +547,7 @@ clutter_texture_paint (ClutterActor *self)
|
||||
}
|
||||
|
||||
/* cogl_paint_init is called to clear the buffers */
|
||||
cogl_color_set_from_4ub (&transparent_col, 0, 0, 0, 0);
|
||||
cogl_paint_init (&transparent_col);
|
||||
|
||||
/* Clear the clipping stack so that if the FBO actor is being
|
||||
@ -575,7 +576,12 @@ clutter_texture_paint (ClutterActor *self)
|
||||
"painting texture '%s'",
|
||||
clutter_actor_get_name (self) ? clutter_actor_get_name (self)
|
||||
: "unknown");
|
||||
col.alpha = clutter_actor_get_paint_opacity (self);
|
||||
|
||||
cogl_color_set_from_4ub (&col,
|
||||
255,
|
||||
255,
|
||||
255,
|
||||
clutter_actor_get_paint_opacity (self));
|
||||
cogl_color (&col);
|
||||
|
||||
clutter_actor_get_allocation_coords (self, &x_1, &y_1, &x_2, &y_2);
|
||||
|
223
clutter/cogl/cogl-color.h
Normal file
223
clutter/cogl/cogl-color.h
Normal file
@ -0,0 +1,223 @@
|
||||
#ifndef __COGL_COLOR_H__
|
||||
#define __COGL_COLOR_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <cogl/cogl-fixed.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _CoglColor CoglColor;
|
||||
|
||||
/**
|
||||
* CoglColor:
|
||||
*
|
||||
* A structure for holding a color definition. The contents of
|
||||
* the CoglColor structure are private and should never by accessed
|
||||
* directly.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
struct _CoglColor
|
||||
{
|
||||
/*< private >*/
|
||||
CoglFixed red;
|
||||
CoglFixed green;
|
||||
CoglFixed blue;
|
||||
|
||||
CoglFixed alpha;
|
||||
};
|
||||
|
||||
/**
|
||||
* cogl_color_set_from_4ub:
|
||||
* @dest: return location for a #CoglColor
|
||||
* @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 values of the passed channel into a #CoglColor.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void cogl_color_set_from_4ub (CoglColor *dest,
|
||||
guint8 red,
|
||||
guint8 green,
|
||||
guint8 blue,
|
||||
guint8 alpha);
|
||||
/**
|
||||
* cogl_color_set_from_4ub:
|
||||
* @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.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void cogl_color_set_from_4d (CoglColor *dest,
|
||||
gdouble red,
|
||||
gdouble green,
|
||||
gdouble blue,
|
||||
gdouble alpha);
|
||||
|
||||
/**
|
||||
* cogl_color_get_red_byte:
|
||||
* @color: a #CoglColor
|
||||
*
|
||||
* Retrieves the red channel of @color as a byte value
|
||||
* between 0 and 255
|
||||
*
|
||||
* Return value: the red channel of the passed color
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
unsigned char cogl_color_get_red_byte (const CoglColor *color);
|
||||
|
||||
/**
|
||||
* cogl_color_get_green_byte:
|
||||
* @color: a #CoglColor
|
||||
*
|
||||
* Retrieves the green channel of @color as a byte value
|
||||
* between 0 and 255
|
||||
*
|
||||
* Return value: the green channel of the passed color
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
unsigned char cogl_color_get_green_byte (const CoglColor *color);
|
||||
|
||||
/**
|
||||
* cogl_color_get_blue_byte:
|
||||
* @color: a #CoglColor
|
||||
*
|
||||
* Retrieves the blue channel of @color as a byte value
|
||||
* between 0 and 255
|
||||
*
|
||||
* Return value: the blue channel of the passed color
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
unsigned char cogl_color_get_blue_byte (const CoglColor *color);
|
||||
|
||||
/**
|
||||
* cogl_color_get_alpha_byte:
|
||||
* @color: a #CoglColor
|
||||
*
|
||||
* Retrieves the alpha channel of @color as a byte value
|
||||
* between 0 and 255
|
||||
*
|
||||
* Return value: the alpha channel of the passed color
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
unsigned char cogl_color_get_alpha_byte (const CoglColor *color);
|
||||
|
||||
/**
|
||||
* cogl_color_get_red_float:
|
||||
* @color: a #CoglColor
|
||||
*
|
||||
* Retrieves the red channel of @color as a floating point
|
||||
* value between 0.0 and 1.0
|
||||
*
|
||||
* Return value: the red channel of the passed color
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
float cogl_color_get_red_float (const CoglColor *color);
|
||||
|
||||
/**
|
||||
* cogl_color_get_green_float:
|
||||
* @color: a #CoglColor
|
||||
*
|
||||
* Retrieves the green channel of @color as a floating point
|
||||
* value between 0.0 and 1.0
|
||||
*
|
||||
* Return value: the green channel of the passed color
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
float cogl_color_get_green_float (const CoglColor *color);
|
||||
|
||||
/**
|
||||
* cogl_color_get_blue_float:
|
||||
* @color: a #CoglColor
|
||||
*
|
||||
* Retrieves the blue channel of @color as a floating point
|
||||
* value between 0.0 and 1.0
|
||||
*
|
||||
* Return value: the blue channel of the passed color
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
float cogl_color_get_blue_float (const CoglColor *color);
|
||||
|
||||
/**
|
||||
* cogl_color_get_alpha_float:
|
||||
* @color: a #CoglColor
|
||||
*
|
||||
* Retrieves the alpha channel of @color as a floating point
|
||||
* value between 0.0 and 1.0
|
||||
*
|
||||
* Return value: the alpha channel of the passed color
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
float cogl_color_get_alpha_float (const CoglColor *color);
|
||||
|
||||
/**
|
||||
* cogl_color_get_red:
|
||||
* @color: a #CoglColor
|
||||
*
|
||||
* Retrieves the red channel of @color as a fixed point
|
||||
* value between 0 and %COGL_FIXED_1.
|
||||
*
|
||||
* Return value: the red channel of the passed color
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
CoglFixed cogl_color_get_red (const CoglColor *color);
|
||||
|
||||
/**
|
||||
* cogl_color_get_green:
|
||||
* @color: a #CoglColor
|
||||
*
|
||||
* Retrieves the green channel of @color as a fixed point
|
||||
* value between 0 and %COGL_FIXED_1.
|
||||
*
|
||||
* Return value: the green channel of the passed color
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
CoglFixed cogl_color_get_green (const CoglColor *color);
|
||||
|
||||
/**
|
||||
* cogl_color_get_blue:
|
||||
* @color: a #CoglColor
|
||||
*
|
||||
* Retrieves the blue channel of @color as a fixed point
|
||||
* value between 0 and %COGL_FIXED_1.
|
||||
*
|
||||
* Return value: the blue channel of the passed color
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
CoglFixed cogl_color_get_blue (const CoglColor *color);
|
||||
|
||||
/**
|
||||
* cogl_color_get_alpha:
|
||||
* @color: a #CoglColor
|
||||
*
|
||||
* Retrieves the alpha channel of @color as a fixed point
|
||||
* value between 0 and %COGL_FIXED_1.
|
||||
*
|
||||
* Return value: the alpha channel of the passed color
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
CoglFixed cogl_color_get_alpha (const CoglColor *color);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_COLOR_H__ */
|
@ -43,12 +43,11 @@
|
||||
#define __COGL_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <clutter/clutter-color.h>
|
||||
#include <clutter/clutter-feature.h>
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
#include <cogl/cogl-defines-@CLUTTER_COGL@.h>
|
||||
#include <cogl/cogl-fixed.h>
|
||||
#include <cogl/cogl-color.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -212,7 +211,7 @@ struct _CoglTextureVertex
|
||||
{
|
||||
CoglFixed x, y, z;
|
||||
CoglFixed tx, ty;
|
||||
ClutterColor color;
|
||||
CoglColor color;
|
||||
};
|
||||
|
||||
typedef struct _CoglTextureVertex CoglTextureVertex;
|
||||
@ -618,7 +617,7 @@ void cogl_alpha_func (COGLenum func,
|
||||
* with @fog_color. Fogging will remain enabled until the next call to
|
||||
* cogl_paint_init().
|
||||
*/
|
||||
void cogl_fog_set (const ClutterColor *fog_color,
|
||||
void cogl_fog_set (const CoglColor *fog_color,
|
||||
CoglFixed density,
|
||||
CoglFixed z_near,
|
||||
CoglFixed z_far);
|
||||
@ -630,7 +629,7 @@ void cogl_fog_set (const ClutterColor *fog_color,
|
||||
* Clears the color buffer to @color. The depth buffer and stencil
|
||||
* buffers are also cleared and fogging and lighting are disabled.
|
||||
*/
|
||||
void cogl_paint_init (const ClutterColor *color);
|
||||
void cogl_paint_init (const CoglColor *color);
|
||||
|
||||
/**
|
||||
* SECTION:cogl-texture
|
||||
@ -1019,12 +1018,12 @@ void cogl_texture_polygon (CoglHandle handle,
|
||||
|
||||
/**
|
||||
* cogl_color:
|
||||
* @color: new current @ClutterColor.
|
||||
* @color: new current @CoglColor.
|
||||
*
|
||||
* Changes the color of cogl's current paint, which is used for filling and stroking
|
||||
* primitives.
|
||||
*/
|
||||
void cogl_color (const ClutterColor *color);
|
||||
void cogl_color (const CoglColor *color);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -26,4 +26,5 @@ libclutter_cogl_common_la_SOURCES = \
|
||||
cogl-bitmap-pixbuf.c \
|
||||
cogl-clip-stack.h \
|
||||
cogl-clip-stack.c \
|
||||
cogl-fixed.c
|
||||
cogl-fixed.c \
|
||||
cogl-color.c
|
||||
|
107
clutter/cogl/common/cogl-color.c
Normal file
107
clutter/cogl/common/cogl-color.c
Normal file
@ -0,0 +1,107 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "cogl-color.h"
|
||||
|
||||
void
|
||||
cogl_color_set_from_4ub (CoglColor *dest,
|
||||
guint8 red,
|
||||
guint8 green,
|
||||
guint8 blue,
|
||||
guint8 alpha)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_color_set_from_4d (CoglColor *dest,
|
||||
gdouble red,
|
||||
gdouble green,
|
||||
gdouble blue,
|
||||
gdouble alpha)
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
unsigned char
|
||||
cogl_color_get_red_byte (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_INT (color->red * 255);
|
||||
}
|
||||
|
||||
float
|
||||
cogl_color_get_red_float (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_FLOAT (color->red);
|
||||
}
|
||||
|
||||
CoglFixed
|
||||
cogl_color_get_red (const CoglColor *color)
|
||||
{
|
||||
return color->red;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
cogl_color_get_green_byte (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_INT (color->green * 255);
|
||||
}
|
||||
|
||||
float
|
||||
cogl_color_get_green_float (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_FLOAT (color->green);
|
||||
}
|
||||
|
||||
CoglFixed
|
||||
cogl_color_get_green (const CoglColor *color)
|
||||
{
|
||||
return color->green;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
cogl_color_get_blue_byte (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_INT (color->blue * 255);
|
||||
}
|
||||
|
||||
float
|
||||
cogl_color_get_blue_float (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_FLOAT (color->blue);
|
||||
}
|
||||
|
||||
CoglFixed
|
||||
cogl_color_get_blue (const CoglColor *color)
|
||||
{
|
||||
return color->blue;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
cogl_color_get_alpha_byte (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_INT (color->alpha * 255);
|
||||
}
|
||||
|
||||
float
|
||||
cogl_color_get_alpha_float (const CoglColor *color)
|
||||
{
|
||||
return COGL_FIXED_TO_FLOAT (color->alpha);
|
||||
}
|
||||
|
||||
CoglFixed
|
||||
cogl_color_get_alpha (const CoglColor *color)
|
||||
{
|
||||
return color->alpha;
|
||||
}
|
@ -2,6 +2,7 @@ libclutterincludedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/cogl
|
||||
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-fixed.h
|
||||
|
||||
INCLUDES = \
|
||||
@ -23,6 +24,7 @@ noinst_LTLIBRARIES = libclutter-cogl.la
|
||||
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-fixed.h \
|
||||
cogl-internal.h \
|
||||
cogl-texture.h \
|
||||
|
@ -169,12 +169,12 @@ cogl_check_extension (const gchar *name, const gchar *ext)
|
||||
}
|
||||
|
||||
void
|
||||
cogl_paint_init (const ClutterColor *color)
|
||||
cogl_paint_init (const CoglColor *color)
|
||||
{
|
||||
GE( glClearColor (((float) color->red / 0xff * 1.0),
|
||||
((float) color->green / 0xff * 1.0),
|
||||
((float) color->blue / 0xff * 1.0),
|
||||
0.0) );
|
||||
GE( glClearColor (cogl_color_get_red_float (color),
|
||||
cogl_color_get_green_float (color),
|
||||
cogl_color_get_blue_float (color),
|
||||
0.0) );
|
||||
|
||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
glDisable (GL_LIGHTING);
|
||||
@ -380,17 +380,17 @@ cogl_enable_backface_culling (gboolean setting)
|
||||
}
|
||||
|
||||
void
|
||||
cogl_color (const ClutterColor *color)
|
||||
cogl_color (const CoglColor *color)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
glColor4ub (color->red,
|
||||
color->green,
|
||||
color->blue,
|
||||
color->alpha);
|
||||
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));
|
||||
|
||||
/* Store alpha for proper blending enables */
|
||||
ctx->color_alpha = color->alpha;
|
||||
ctx->color_alpha = cogl_color_get_alpha_byte (color);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1242,17 +1242,17 @@ cogl_get_bitmasks (gint *red, gint *green, gint *blue, gint *alpha)
|
||||
}
|
||||
|
||||
void
|
||||
cogl_fog_set (const ClutterColor *fog_color,
|
||||
cogl_fog_set (const CoglColor *fog_color,
|
||||
CoglFixed density,
|
||||
CoglFixed start,
|
||||
CoglFixed stop)
|
||||
{
|
||||
GLfloat fogColor[4];
|
||||
|
||||
fogColor[0] = ((float) fog_color->red / 0xff * 1.0);
|
||||
fogColor[1] = ((float) fog_color->green / 0xff * 1.0);
|
||||
fogColor[2] = ((float) fog_color->blue / 0xff * 1.0);
|
||||
fogColor[3] = ((float) fog_color->alpha / 0xff * 1.0);
|
||||
fogColor[0] = cogl_color_get_red_float (fog_color);
|
||||
fogColor[1] = cogl_color_get_green_float (fog_color);
|
||||
fogColor[2] = cogl_color_get_blue_float (fog_color);
|
||||
fogColor[3] = cogl_color_get_alpha_float (fog_color);
|
||||
|
||||
glEnable (GL_FOG);
|
||||
|
||||
|
@ -2,6 +2,7 @@ libclutterincludedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/cogl
|
||||
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-fixed.h
|
||||
|
||||
INCLUDES = \
|
||||
@ -23,6 +24,7 @@ noinst_LTLIBRARIES = libclutter-cogl.la
|
||||
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-fixed.h \
|
||||
cogl-internal.h \
|
||||
cogl-texture.h \
|
||||
|
@ -336,10 +336,10 @@ _cogl_texture_upload_to_gl (CoglTexture *tex)
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_texture_draw_and_read (CoglTexture *tex,
|
||||
CoglBitmap *target_bmp,
|
||||
ClutterColor *back_color,
|
||||
GLint *viewport)
|
||||
_cogl_texture_draw_and_read (CoglTexture *tex,
|
||||
CoglBitmap *target_bmp,
|
||||
CoglColor *back_color,
|
||||
GLint *viewport)
|
||||
{
|
||||
gint bpp;
|
||||
CoglFixed rx1, ry1;
|
||||
@ -460,15 +460,17 @@ _cogl_texture_download_from_gl (CoglTexture *tex,
|
||||
GLuint target_gl_format,
|
||||
GLuint target_gl_type)
|
||||
{
|
||||
gint bpp;
|
||||
GLint viewport[4];
|
||||
ClutterColor cwhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||
CoglBitmap alpha_bmp;
|
||||
COGLenum old_src_factor;
|
||||
COGLenum old_dst_factor;
|
||||
|
||||
gint bpp;
|
||||
GLint viewport[4];
|
||||
CoglColor cwhite;
|
||||
CoglBitmap alpha_bmp;
|
||||
COGLenum old_src_factor;
|
||||
COGLenum old_dst_factor;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
|
||||
|
||||
cogl_color_set_from_4ub (&cwhite, 0xff, 0xff, 0xff, 0xff);
|
||||
|
||||
bpp = _cogl_get_format_bpp (COGL_PIXEL_FORMAT_RGBA_8888);
|
||||
|
||||
/* Viewport needs to have some size and be inside the window for this */
|
||||
|
@ -86,16 +86,16 @@ cogl_check_extension (const gchar *name, const gchar *ext)
|
||||
}
|
||||
|
||||
void
|
||||
cogl_paint_init (const ClutterColor *color)
|
||||
cogl_paint_init (const CoglColor *color)
|
||||
{
|
||||
#if COGL_DEBUG
|
||||
fprintf(stderr, "\n ============== Paint Start ================ \n");
|
||||
#endif
|
||||
|
||||
cogl_wrap_glClearColorx ((color->red << 16) / 0xff,
|
||||
(color->green << 16) / 0xff,
|
||||
(color->blue << 16) / 0xff,
|
||||
0xff);
|
||||
cogl_wrap_glClearColorx (cogl_color_get_red (color),
|
||||
cogl_color_get_green (color),
|
||||
cogl_color_get_blue (color),
|
||||
0);
|
||||
|
||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
cogl_wrap_glDisable (GL_LIGHTING);
|
||||
@ -291,7 +291,7 @@ cogl_enable_backface_culling (gboolean setting)
|
||||
}
|
||||
|
||||
void
|
||||
cogl_color (const ClutterColor *color)
|
||||
cogl_color (const CoglColor *color)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
@ -315,14 +315,14 @@ cogl_color (const ClutterColor *color)
|
||||
|
||||
#else
|
||||
/* conversion can cause issues with picking on some gles implementations */
|
||||
GE( cogl_wrap_glColor4x ((color->red << 16) / 0xff,
|
||||
(color->green << 16) / 0xff,
|
||||
(color->blue << 16) / 0xff,
|
||||
(color->alpha << 16) / 0xff));
|
||||
GE( cogl_wrap_glColor4x (cogl_color_get_red (color),
|
||||
cogl_color_get_green (color),
|
||||
cogl_color_get_blue (color),
|
||||
cogl_color_get_alpha (color)) );
|
||||
#endif
|
||||
|
||||
/* Store alpha for proper blending enables */
|
||||
ctx->color_alpha = color->alpha;
|
||||
ctx->color_alpha = cogl_color_get_alpha_byte (color);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -898,17 +898,17 @@ cogl_get_bitmasks (gint *red, gint *green, gint *blue, gint *alpha)
|
||||
}
|
||||
|
||||
void
|
||||
cogl_fog_set (const ClutterColor *fog_color,
|
||||
cogl_fog_set (const CoglColor *fog_color,
|
||||
CoglFixed density,
|
||||
CoglFixed z_near,
|
||||
CoglFixed z_far)
|
||||
{
|
||||
GLfixed fogColor[4];
|
||||
|
||||
fogColor[0] = (fog_color->red << 16) / 0xff;
|
||||
fogColor[1] = (fog_color->green << 16) / 0xff;
|
||||
fogColor[2] = (fog_color->blue << 16) / 0xff;
|
||||
fogColor[3] = (fog_color->alpha << 16) / 0xff;
|
||||
fogColor[0] = cogl_color_get_red (fog_color);
|
||||
fogColor[1] = cogl_color_get_green (fog_color);
|
||||
fogColor[2] = cogl_color_get_blue (fog_color);
|
||||
fogColor[3] = cogl_color_get_alpha (fog_color);
|
||||
|
||||
cogl_wrap_glEnable (GL_FOG);
|
||||
|
||||
|
@ -47,7 +47,7 @@ struct _PangoClutterRenderer
|
||||
PangoRenderer parent_instance;
|
||||
|
||||
/* The color to draw the glyphs with */
|
||||
ClutterColor color;
|
||||
CoglColor color;
|
||||
|
||||
/* Two caches of glyphs as textures, one with mipmapped textures and
|
||||
one without */
|
||||
@ -143,7 +143,11 @@ pango_clutter_render_layout_subpixel (PangoLayout *layout,
|
||||
(PANGO_CLUTTER_FONT_MAP (font_map));
|
||||
priv = PANGO_CLUTTER_RENDERER (renderer);
|
||||
|
||||
priv->color = *color;
|
||||
cogl_color_set_from_4ub (&priv->color,
|
||||
color->red,
|
||||
color->green,
|
||||
color->blue,
|
||||
color->alpha);
|
||||
|
||||
pango_renderer_draw_layout (renderer, layout, x, y);
|
||||
}
|
||||
@ -180,7 +184,11 @@ pango_clutter_render_layout_line (PangoLayoutLine *line,
|
||||
(PANGO_CLUTTER_FONT_MAP (font_map));
|
||||
priv = PANGO_CLUTTER_RENDERER (renderer);
|
||||
|
||||
priv->color = *color;
|
||||
cogl_color_set_from_4ub (&priv->color,
|
||||
color->red,
|
||||
color->green,
|
||||
color->blue,
|
||||
color->alpha);
|
||||
|
||||
pango_renderer_draw_layout_line (renderer, line, x, y);
|
||||
}
|
||||
@ -320,14 +328,15 @@ pango_clutter_renderer_set_color_for_part (PangoRenderer *renderer,
|
||||
{
|
||||
PangoColor *pango_color = pango_renderer_get_color (renderer, part);
|
||||
PangoClutterRenderer *priv = PANGO_CLUTTER_RENDERER (renderer);
|
||||
ClutterColor clutter_color;
|
||||
CoglColor clutter_color;
|
||||
|
||||
if (pango_color)
|
||||
{
|
||||
clutter_color.red = pango_color->red >> 8;
|
||||
clutter_color.green = pango_color->green >> 8;
|
||||
clutter_color.blue = pango_color->blue >> 8;
|
||||
clutter_color.alpha = priv->color.alpha;
|
||||
cogl_color_set_from_4ub (&clutter_color,
|
||||
pango_color->red >> 8,
|
||||
pango_color->green >> 8,
|
||||
pango_color->blue >> 8,
|
||||
cogl_color_get_alpha_byte (&priv->color));
|
||||
}
|
||||
else
|
||||
clutter_color = priv->color;
|
||||
|
@ -59,6 +59,7 @@
|
||||
<xi:include href="xml/cogl-shaders.xml"/>
|
||||
<xi:include href="xml/cogl-offscreen.xml"/>
|
||||
<xi:include href="xml/cogl-fixed.xml"/>
|
||||
<xi:include href="xml/cogl-color.xml"/>
|
||||
|
||||
</chapter>
|
||||
|
||||
|
@ -231,3 +231,29 @@ cogl_double_to_fixed
|
||||
cogl_double_to_int
|
||||
cogl_double_to_unit
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>cogl-color</FILE>
|
||||
<TITLE>Color Type</TITLE>
|
||||
CoglColor
|
||||
cogl_color_set_from_4ub
|
||||
cogl_color_set_from_4d
|
||||
|
||||
<SUBSECTION>
|
||||
cogl_color_get_red
|
||||
cogl_color_get_green
|
||||
cogl_color_get_blue
|
||||
cogl_color_get_alpha
|
||||
|
||||
<SUBSECTION>
|
||||
cogl_color_get_red_byte
|
||||
cogl_color_get_green_byte
|
||||
cogl_color_get_blue_byte
|
||||
cogl_color_get_alpha_byte
|
||||
|
||||
<SUBSECTION>
|
||||
cogl_color_get_red_float
|
||||
cogl_color_get_green_float
|
||||
cogl_color_get_blue_float
|
||||
cogl_color_get_alpha_float
|
||||
</SECTION>
|
||||
|
@ -80,13 +80,7 @@ static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
|
||||
ClutterColor cback = {0x66, 0x66, 0xDD, 0xFF};
|
||||
ClutterColor cred = {0xFF, 0x0, 0x0, 0xFF};
|
||||
ClutterColor cgreen = {0x0, 0xFF, 0x0, 0xFF};
|
||||
ClutterColor cfullopaque = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||
ClutterColor chalfopaque = {0xFF, 0xFF, 0xFF, 0x88};
|
||||
|
||||
CoglColor color;
|
||||
ClutterFixed texcoords[4] = {
|
||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||
@ -95,11 +89,13 @@ test_coglbox_paint(ClutterActor *self)
|
||||
};
|
||||
|
||||
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
|
||||
cogl_color (&cback);
|
||||
|
||||
cogl_color_set_from_4ub (&color, 0x66, 0x66, 0xdd, 0xff);
|
||||
cogl_color (&color);
|
||||
cogl_rectangle (0,0,400,400);
|
||||
|
||||
cogl_color (&cfullopaque);
|
||||
|
||||
cogl_color_set_from_4ub (&color, 0xff, 0xff, 0xff, 0xff);
|
||||
cogl_color (&color);
|
||||
cogl_texture_rectangle (priv->texhand_id,
|
||||
0,0,
|
||||
CLUTTER_INT_TO_FIXED (400),
|
||||
@ -110,15 +106,18 @@ test_coglbox_paint(ClutterActor *self)
|
||||
|
||||
cogl_draw_buffer (COGL_OFFSCREEN_BUFFER, priv->offscreen_id);
|
||||
|
||||
cogl_color (&cred);
|
||||
cogl_color_set_from_4ub (&color, 0xff, 0, 0, 0xff);
|
||||
cogl_color (&color);
|
||||
cogl_rectangle (20,20,100,100);
|
||||
|
||||
cogl_color (&cgreen);
|
||||
|
||||
cogl_color_set_from_4ub (&color, 0, 0xff, 0, 0xff);
|
||||
cogl_color (&color);
|
||||
cogl_rectangle (80,80,100,100);
|
||||
|
||||
cogl_draw_buffer (COGL_WINDOW_BUFFER, 0);
|
||||
|
||||
cogl_color (&chalfopaque);
|
||||
|
||||
cogl_color_set_from_4ub (&color, 0xff, 0xff, 0xff, 0x88);
|
||||
cogl_color (&color);
|
||||
cogl_texture_rectangle (priv->texture_id,
|
||||
CLUTTER_INT_TO_FIXED (100),
|
||||
CLUTTER_INT_TO_FIXED (100),
|
||||
|
@ -176,9 +176,8 @@ static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv;
|
||||
|
||||
ClutterColor cfill;
|
||||
ClutterColor cstroke;
|
||||
CoglColor cfill;
|
||||
CoglColor cstroke;
|
||||
|
||||
static GTimer *timer = NULL;
|
||||
static gint paint_index = 0;
|
||||
@ -202,16 +201,9 @@ test_coglbox_paint(ClutterActor *self)
|
||||
paint_index = paint_index % NUM_PAINT_FUNCS;
|
||||
g_timer_start (timer);
|
||||
}
|
||||
|
||||
cfill.red = 0;
|
||||
cfill.green = 160;
|
||||
cfill.blue = 0;
|
||||
cfill.alpha = 255;
|
||||
|
||||
cstroke.red = 200;
|
||||
cstroke.green = 0;
|
||||
cstroke.blue = 0;
|
||||
cstroke.alpha = 255;
|
||||
|
||||
cogl_color_set_from_4ub (&cfill, 0, 160, 0, 255);
|
||||
cogl_color_set_from_4ub (&cstroke, 200, 0, 0, 255);
|
||||
|
||||
cogl_push_matrix ();
|
||||
|
||||
|
@ -79,9 +79,9 @@ static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
CoglColor cback;
|
||||
CoglColor cwhite;
|
||||
|
||||
ClutterColor cback = {0x66, 0x66, 0xDD, 0xFF};
|
||||
ClutterColor cwhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||
ClutterFixed texcoords[4] = {
|
||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||
@ -91,9 +91,11 @@ 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_rectangle (0,0,400,400);
|
||||
|
||||
cogl_color_set_from_4ub (&cwhite, 0xff, 0xff, 0xff, 0xff);
|
||||
cogl_color (&cwhite);
|
||||
|
||||
cogl_push_matrix ();
|
||||
|
@ -79,9 +79,8 @@ static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
|
||||
ClutterColor cback = {0x66, 0x66, 0xDD, 0xFF};
|
||||
ClutterColor cwhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||
CoglColor cback;
|
||||
CoglColor cwhite;
|
||||
ClutterFixed texcoords[4] = {
|
||||
CLUTTER_FLOAT_TO_FIXED (0.3f),
|
||||
CLUTTER_FLOAT_TO_FIXED (0.3f),
|
||||
@ -91,9 +90,11 @@ 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_rectangle (0,0,400,400);
|
||||
|
||||
cogl_color_set_from_4ub (&cwhite, 0xff, 0xff, 0xff, 0xff);
|
||||
cogl_color (&cwhite);
|
||||
|
||||
cogl_push_matrix ();
|
||||
|
@ -78,9 +78,8 @@ static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
|
||||
ClutterColor cback = {0x66, 0x66, 0xDD, 0xFF};
|
||||
ClutterColor cwhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||
CoglColor cback;
|
||||
CoglColor cwhite;
|
||||
ClutterFixed texcoords[4] = {
|
||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||
CLUTTER_FLOAT_TO_FIXED (0.0f),
|
||||
@ -90,9 +89,11 @@ 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_rectangle (0,0,400,400);
|
||||
|
||||
cogl_color_set_from_4ub (&cwhite, 0xff, 0xff, 0xff, 0xff);
|
||||
cogl_color (&cwhite);
|
||||
|
||||
cogl_push_matrix ();
|
||||
|
@ -89,8 +89,8 @@ test_coglbox_fade_texture (CoglHandle tex_id,
|
||||
ClutterFixed ty2)
|
||||
{
|
||||
CoglTextureVertex vertices[4];
|
||||
CoglColor white;
|
||||
int i;
|
||||
static const ClutterColor white = { 0xff, 0xff, 0xff, 0xff };
|
||||
|
||||
vertices[0].x = x1;
|
||||
vertices[0].y = y1;
|
||||
@ -115,14 +115,16 @@ test_coglbox_fade_texture (CoglHandle tex_id,
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
vertices[i].color.red = 255;
|
||||
vertices[i].color.green = 255;
|
||||
vertices[i].color.blue = 255;
|
||||
vertices[i].color.alpha = ((i ^ (i >> 1)) & 1) ? 0 : 128;
|
||||
cogl_color_set_from_4ub (&(vertices[i].color),
|
||||
255,
|
||||
255,
|
||||
255,
|
||||
((i ^ (i >> 1)) & 1) ? 0 : 128);
|
||||
}
|
||||
|
||||
cogl_texture_polygon (tex_id, 4, vertices, TRUE);
|
||||
|
||||
cogl_color_set_from_4ub (&white, 0xff, 0xff, 0xff, 0xff);
|
||||
cogl_color (&white);
|
||||
}
|
||||
|
||||
@ -166,12 +168,13 @@ static void
|
||||
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;
|
||||
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);
|
||||
static const ClutterColor white = { 0xff, 0xff, 0xff, 0xff };
|
||||
|
||||
cogl_color_set_from_4ub (&white, 255, 255, 255, 255);
|
||||
cogl_color (&white);
|
||||
|
||||
cogl_texture_set_filters (tex_handle,
|
||||
|
@ -80,8 +80,8 @@ test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
|
||||
ClutterColor cback = {0x66, 0x66, 0xDD, 0xFF};
|
||||
ClutterColor cwhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||
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),
|
||||
@ -115,10 +115,12 @@ test_coglbox_paint(ClutterActor *self)
|
||||
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
|
||||
cogl_push_matrix ();
|
||||
|
||||
|
||||
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_translate (100,100,0);
|
||||
cogl_texture_rectangle (priv->cogl_tex_id,
|
||||
|
@ -123,13 +123,14 @@ static void
|
||||
hand_pre_paint (ClutterActor *actor,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterColor red = { 255, 0, 0, 128 };
|
||||
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_rectangle (0, 0, w / 2, h / 2);
|
||||
|
||||
@ -140,13 +141,14 @@ static void
|
||||
hand_post_paint (ClutterActor *actor,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterColor green = { 0, 255, 0, 128 };
|
||||
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_rectangle (w / 2, h / 2, w / 2, h / 2);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user