[tests] Use floats, not ClutterFixed
The COGL API expects floats, not ClutterFixed, so we need to use the right type when calling it.
This commit is contained in:
parent
f82c9e7dba
commit
6bee140e74
@ -36,22 +36,20 @@ instructions[] =
|
||||
static void
|
||||
path_shapes (gint x, gint y, gint width, gint height)
|
||||
{
|
||||
cogl_path_move_to (CLUTTER_INT_TO_FIXED (x), CLUTTER_INT_TO_FIXED (y));
|
||||
cogl_path_line_to (CLUTTER_INT_TO_FIXED (x),
|
||||
CLUTTER_INT_TO_FIXED (y + height * 4 / 5));
|
||||
cogl_path_line_to (CLUTTER_INT_TO_FIXED (x + width * 4 / 15),
|
||||
CLUTTER_INT_TO_FIXED (y + height * 4 / 5));
|
||||
cogl_path_move_to (x, y);
|
||||
cogl_path_line_to (x, (y + height * 4 / 5));
|
||||
cogl_path_line_to ((x + width * 4 / 15), (y + height * 4 / 5));
|
||||
cogl_path_close ();
|
||||
|
||||
cogl_path_rectangle (CLUTTER_INT_TO_FIXED (x + width / 3),
|
||||
CLUTTER_INT_TO_FIXED (y),
|
||||
CLUTTER_INT_TO_FIXED (width * 4 / 15),
|
||||
CLUTTER_INT_TO_FIXED (height * 4 / 5));
|
||||
cogl_path_rectangle ((x + width / 3),
|
||||
y,
|
||||
(width * 4 / 15),
|
||||
(height * 4 / 5));
|
||||
|
||||
cogl_path_ellipse (CLUTTER_INT_TO_FIXED (x + width * 4 / 5),
|
||||
CLUTTER_INT_TO_FIXED (y + height * 2 / 5),
|
||||
CLUTTER_INT_TO_FIXED (width * 2 / 15),
|
||||
CLUTTER_INT_TO_FIXED (height * 2 / 5));
|
||||
cogl_path_ellipse ((x + width * 4 / 5),
|
||||
(y + height * 2 / 5),
|
||||
(width * 2 / 15),
|
||||
(height * 2 / 5));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -73,17 +71,17 @@ make_clip_path (Clip *clip)
|
||||
break;
|
||||
|
||||
case CLIP_RECTANGLE:
|
||||
cogl_path_rectangle (CLUTTER_INT_TO_FIXED (clip->x1),
|
||||
CLUTTER_INT_TO_FIXED (clip->y1),
|
||||
CLUTTER_INT_TO_FIXED (clip->x2 - clip->x1),
|
||||
CLUTTER_INT_TO_FIXED (clip->y2 - clip->y1));
|
||||
cogl_path_rectangle (clip->x1,
|
||||
clip->y1,
|
||||
(clip->x2 - clip->x1),
|
||||
(clip->y2 - clip->y1));
|
||||
break;
|
||||
|
||||
case CLIP_ELLIPSE:
|
||||
cogl_path_ellipse (CLUTTER_INT_TO_FIXED (clip->x1 + clip->x2) / 2,
|
||||
CLUTTER_INT_TO_FIXED (clip->y1 + clip->y2) / 2,
|
||||
CLUTTER_INT_TO_FIXED (clip->x2 - clip->x1) / 2,
|
||||
CLUTTER_INT_TO_FIXED (clip->y2 - clip->y1) / 2);
|
||||
cogl_path_ellipse ((clip->x1 + clip->x2) / 2,
|
||||
(clip->y1 + clip->y2) / 2,
|
||||
(clip->x2 - clip->x1) / 2,
|
||||
(clip->y2 - clip->y1) / 2);
|
||||
break;
|
||||
|
||||
case CLIP_SHAPES:
|
||||
@ -136,10 +134,10 @@ on_paint (ClutterActor *actor, CallbackData *data)
|
||||
Clip *clip = (Clip *) node->data;
|
||||
|
||||
if (clip->type == CLIP_RECTANGLE)
|
||||
cogl_clip_push (CLUTTER_INT_TO_FIXED (clip->x1),
|
||||
CLUTTER_INT_TO_FIXED (clip->y1),
|
||||
CLUTTER_INT_TO_FIXED (clip->x2 - clip->x1),
|
||||
CLUTTER_INT_TO_FIXED (clip->y2 - clip->y1));
|
||||
cogl_clip_push (clip->x1,
|
||||
clip->y1,
|
||||
clip->x2 - clip->x1,
|
||||
clip->y2 - clip->y1);
|
||||
else
|
||||
{
|
||||
make_clip_path (clip);
|
||||
@ -166,11 +164,11 @@ on_paint (ClutterActor *actor, CallbackData *data)
|
||||
cogl_set_source_color4ub (0xff, 0xff, 0xff, 0xff);
|
||||
|
||||
cogl_set_source_texture (data->hand);
|
||||
cogl_rectangle_with_texture_coords (CLUTTER_INT_TO_FIXED (-hand_width / 2),
|
||||
CLUTTER_INT_TO_FIXED (-hand_height / 2),
|
||||
CLUTTER_INT_TO_FIXED (hand_width / 2),
|
||||
CLUTTER_INT_TO_FIXED (hand_height / 2),
|
||||
0, 0, CFX_ONE, CFX_ONE);
|
||||
cogl_rectangle_with_texture_coords ((-hand_width / 2),
|
||||
(-hand_height / 2),
|
||||
(hand_width / 2),
|
||||
(hand_height / 2),
|
||||
0, 0, 1, 1);
|
||||
|
||||
cogl_pop_matrix ();
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ typedef struct _TestMultiLayerMaterialState
|
||||
CoglHandle alpha_tex;
|
||||
CoglHandle redhand_tex;
|
||||
CoglHandle light_tex0;
|
||||
ClutterFixed *tex_coords;
|
||||
gfloat *tex_coords;
|
||||
|
||||
CoglMatrix tex_matrix;
|
||||
CoglMatrix rot_matrix;
|
||||
@ -45,13 +45,11 @@ material_rectangle_paint (ClutterActor *actor, gpointer data)
|
||||
TestMultiLayerMaterialState *state = data;
|
||||
|
||||
cogl_set_source (state->material);
|
||||
cogl_rectangle_with_multitexture_coords (
|
||||
CLUTTER_INT_TO_FIXED(0),
|
||||
CLUTTER_INT_TO_FIXED(0),
|
||||
CLUTTER_INT_TO_FIXED(TIMELINE_FRAME_COUNT),
|
||||
CLUTTER_INT_TO_FIXED(TIMELINE_FRAME_COUNT),
|
||||
state->tex_coords,
|
||||
12);
|
||||
cogl_rectangle_with_multitexture_coords (0, 0,
|
||||
TIMELINE_FRAME_COUNT,
|
||||
TIMELINE_FRAME_COUNT,
|
||||
state->tex_coords,
|
||||
12);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT int
|
||||
@ -63,12 +61,12 @@ test_cogl_multitexture_main (int argc, char *argv[])
|
||||
ClutterColor stage_color = { 0x61, 0x56, 0x56, 0xff };
|
||||
TestMultiLayerMaterialState *state = g_new0 (TestMultiLayerMaterialState, 1);
|
||||
ClutterGeometry geom;
|
||||
ClutterFixed tex_coords[] =
|
||||
gfloat tex_coords[] =
|
||||
{
|
||||
/* tx1 ty1 tx2 ty2 */
|
||||
0, 0, CLUTTER_INT_TO_FIXED (1), CLUTTER_INT_TO_FIXED (1),
|
||||
0, 0, CLUTTER_INT_TO_FIXED (1), CLUTTER_INT_TO_FIXED (1),
|
||||
0, 0, CLUTTER_INT_TO_FIXED (1), CLUTTER_INT_TO_FIXED (1)
|
||||
/* tx1 ty1 tx2 ty2 */
|
||||
0, 0, 1, 1,
|
||||
0, 0, 1, 1,
|
||||
0, 0, 1, 1
|
||||
};
|
||||
|
||||
clutter_init (&argc, &argv);
|
||||
@ -76,8 +74,7 @@ test_cogl_multitexture_main (int argc, char *argv[])
|
||||
stage = clutter_stage_get_default ();
|
||||
clutter_actor_get_geometry (stage, &geom);
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage),
|
||||
&stage_color);
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
||||
|
||||
/* We create a non-descript actor that we know doesn't have a
|
||||
* default paint handler, so that we can easily control
|
||||
|
@ -81,12 +81,7 @@ static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
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)
|
||||
};
|
||||
gfloat texcoords[4] = { 0, 0, 1, 1 };
|
||||
CoglHandle material;
|
||||
|
||||
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
@ -96,11 +91,9 @@ test_coglbox_paint(ClutterActor *self)
|
||||
|
||||
cogl_set_source_texture (priv->texhand_id);
|
||||
cogl_rectangle_with_texture_coords (0, 0,
|
||||
CLUTTER_INT_TO_FIXED (400),
|
||||
CLUTTER_INT_TO_FIXED (400),
|
||||
400, 400,
|
||||
0, 0,
|
||||
CLUTTER_INT_TO_FIXED (6),
|
||||
CLUTTER_INT_TO_FIXED (6));
|
||||
6, 6);
|
||||
|
||||
cogl_draw_buffer (COGL_OFFSCREEN_BUFFER, priv->offscreen_id);
|
||||
|
||||
@ -116,10 +109,8 @@ test_coglbox_paint(ClutterActor *self)
|
||||
cogl_material_set_color4ub (material, 0xff, 0xff, 0xff, 0x88);
|
||||
cogl_material_set_layer (material, 0, priv->texture_id);
|
||||
cogl_set_source (material);
|
||||
cogl_rectangle_with_texture_coords (CLUTTER_INT_TO_FIXED (100),
|
||||
CLUTTER_INT_TO_FIXED (100),
|
||||
CLUTTER_INT_TO_FIXED (300),
|
||||
CLUTTER_INT_TO_FIXED (300),
|
||||
cogl_rectangle_with_texture_coords (100, 100,
|
||||
300, 300,
|
||||
texcoords[0],
|
||||
texcoords[1],
|
||||
texcoords[2],
|
||||
|
@ -10,44 +10,29 @@ typedef void (*PaintFunc) (void);
|
||||
static void
|
||||
test_paint_line ()
|
||||
{
|
||||
cogl_path_line (CLUTTER_INT_TO_FIXED (-50),
|
||||
CLUTTER_INT_TO_FIXED (-25),
|
||||
CLUTTER_INT_TO_FIXED (50),
|
||||
CLUTTER_INT_TO_FIXED (25));
|
||||
cogl_path_line (-50, -25, 50, 25);
|
||||
}
|
||||
|
||||
static void
|
||||
test_paint_rect ()
|
||||
{
|
||||
cogl_path_rectangle (CLUTTER_INT_TO_FIXED (-50),
|
||||
CLUTTER_INT_TO_FIXED (-25),
|
||||
CLUTTER_INT_TO_FIXED (100),
|
||||
CLUTTER_INT_TO_FIXED (50));
|
||||
cogl_path_rectangle (-50, -25, 100, 50);
|
||||
}
|
||||
|
||||
static void
|
||||
test_paint_rndrect()
|
||||
{
|
||||
cogl_path_round_rectangle (CLUTTER_INT_TO_FIXED (-50),
|
||||
CLUTTER_INT_TO_FIXED (-25),
|
||||
CLUTTER_INT_TO_FIXED (100),
|
||||
CLUTTER_INT_TO_FIXED (50),
|
||||
CLUTTER_INT_TO_FIXED (10),
|
||||
5);
|
||||
cogl_path_round_rectangle (-50, -25, 100, 50, 10, 5);
|
||||
}
|
||||
|
||||
static void
|
||||
test_paint_polyl ()
|
||||
{
|
||||
ClutterFixed poly_coords[] = {
|
||||
CLUTTER_INT_TO_FIXED (-50),
|
||||
CLUTTER_INT_TO_FIXED (-50),
|
||||
CLUTTER_INT_TO_FIXED (+50),
|
||||
CLUTTER_INT_TO_FIXED (-30),
|
||||
CLUTTER_INT_TO_FIXED (+30),
|
||||
CLUTTER_INT_TO_FIXED (+30),
|
||||
CLUTTER_INT_TO_FIXED (-30),
|
||||
CLUTTER_INT_TO_FIXED (+40)
|
||||
gfloat poly_coords[] = {
|
||||
-50, -50,
|
||||
+50, -30,
|
||||
+30, +30,
|
||||
-30, +40
|
||||
};
|
||||
|
||||
cogl_path_polyline (poly_coords, 4);
|
||||
@ -57,14 +42,10 @@ static void
|
||||
test_paint_polyg ()
|
||||
{
|
||||
gfloat poly_coords[] = {
|
||||
CLUTTER_INT_TO_FIXED (-50),
|
||||
CLUTTER_INT_TO_FIXED (-50),
|
||||
CLUTTER_INT_TO_FIXED (+50),
|
||||
CLUTTER_INT_TO_FIXED (-30),
|
||||
CLUTTER_INT_TO_FIXED (+30),
|
||||
CLUTTER_INT_TO_FIXED (+30),
|
||||
CLUTTER_INT_TO_FIXED (-30),
|
||||
CLUTTER_INT_TO_FIXED (+40)
|
||||
-50, -50,
|
||||
+50, -30,
|
||||
+30, +30,
|
||||
-30, +40
|
||||
};
|
||||
|
||||
cogl_path_polygon (poly_coords, 4);
|
||||
@ -73,23 +54,17 @@ test_paint_polyg ()
|
||||
static void
|
||||
test_paint_elp ()
|
||||
{
|
||||
cogl_path_ellipse (0, 0,
|
||||
CLUTTER_INT_TO_FIXED (60),
|
||||
CLUTTER_INT_TO_FIXED (40));
|
||||
cogl_path_ellipse (0, 0, 60, 40);
|
||||
}
|
||||
|
||||
static void
|
||||
test_paint_curve ()
|
||||
{
|
||||
cogl_path_move_to (CLUTTER_INT_TO_FIXED (-50),
|
||||
CLUTTER_INT_TO_FIXED (+50));
|
||||
cogl_path_move_to (-50, +50);
|
||||
|
||||
cogl_path_curve_to (CLUTTER_INT_TO_FIXED (+100),
|
||||
CLUTTER_INT_TO_FIXED (-50),
|
||||
CLUTTER_INT_TO_FIXED (-100),
|
||||
CLUTTER_INT_TO_FIXED (-50),
|
||||
CLUTTER_INT_TO_FIXED (+50),
|
||||
CLUTTER_INT_TO_FIXED (+50));
|
||||
cogl_path_curve_to (+100, -50,
|
||||
-100, -50,
|
||||
+50, +50);
|
||||
}
|
||||
|
||||
static PaintFunc paint_func []=
|
||||
|
@ -80,12 +80,7 @@ static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
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)
|
||||
};
|
||||
gfloat texcoords[4] = { 0.0, 0.0, 1.0, 1.0 };
|
||||
|
||||
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
|
||||
@ -94,9 +89,7 @@ test_coglbox_paint(ClutterActor *self)
|
||||
|
||||
cogl_push_matrix ();
|
||||
cogl_set_source_texture (priv->cogl_tex_id[0]);
|
||||
cogl_rectangle_with_texture_coords (0, 0,
|
||||
CLUTTER_INT_TO_FIXED (200),
|
||||
CLUTTER_INT_TO_FIXED (213),
|
||||
cogl_rectangle_with_texture_coords (0, 0, 200, 213,
|
||||
texcoords[0], texcoords[1],
|
||||
texcoords[2], texcoords[3]);
|
||||
|
||||
@ -104,9 +97,7 @@ test_coglbox_paint(ClutterActor *self)
|
||||
cogl_push_matrix ();
|
||||
cogl_translate (200, 0, 0);
|
||||
cogl_set_source_texture (priv->cogl_tex_id[1]);
|
||||
cogl_rectangle_with_texture_coords (0, 0,
|
||||
CLUTTER_INT_TO_FIXED (200),
|
||||
CLUTTER_INT_TO_FIXED (213),
|
||||
cogl_rectangle_with_texture_coords (0, 0, 200, 213,
|
||||
texcoords[0], texcoords[1],
|
||||
texcoords[2], texcoords[3]);
|
||||
|
||||
@ -114,9 +105,7 @@ test_coglbox_paint(ClutterActor *self)
|
||||
cogl_push_matrix ();
|
||||
cogl_translate (0, 200, 0);
|
||||
cogl_set_source_texture (priv->cogl_tex_id[2]);
|
||||
cogl_rectangle_with_texture_coords (0, 0,
|
||||
CLUTTER_INT_TO_FIXED (200),
|
||||
CLUTTER_INT_TO_FIXED (213),
|
||||
cogl_rectangle_with_texture_coords (0, 0, 200, 213,
|
||||
texcoords[0], texcoords[1],
|
||||
texcoords[2], texcoords[3]);
|
||||
|
||||
@ -124,9 +113,7 @@ test_coglbox_paint(ClutterActor *self)
|
||||
cogl_push_matrix ();
|
||||
cogl_translate (200, 200, 0);
|
||||
cogl_set_source_texture (priv->cogl_tex_id[3]);
|
||||
cogl_rectangle_with_texture_coords (0, 0,
|
||||
CLUTTER_INT_TO_FIXED (200),
|
||||
CLUTTER_INT_TO_FIXED (213),
|
||||
cogl_rectangle_with_texture_coords (0, 0, 200, 213,
|
||||
texcoords[0], texcoords[1],
|
||||
texcoords[2], texcoords[3]);
|
||||
|
||||
|
@ -80,12 +80,7 @@ static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
ClutterFixed texcoords[4] = {
|
||||
CLUTTER_FLOAT_TO_FIXED (0.3f),
|
||||
CLUTTER_FLOAT_TO_FIXED (0.3f),
|
||||
CLUTTER_FLOAT_TO_FIXED (0.7f),
|
||||
CLUTTER_FLOAT_TO_FIXED (0.7f)
|
||||
};
|
||||
gfloat texcoords[4] = { 0.3f, 0.3f, 0.7f, 0.7f };
|
||||
|
||||
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
|
||||
@ -96,9 +91,7 @@ test_coglbox_paint(ClutterActor *self)
|
||||
|
||||
cogl_translate (100,100,0);
|
||||
cogl_set_source_texture (priv->cogl_handle);
|
||||
cogl_rectangle_with_texture_coords (0, 0,
|
||||
CLUTTER_INT_TO_FIXED (200),
|
||||
CLUTTER_INT_TO_FIXED (200),
|
||||
cogl_rectangle_with_texture_coords (0, 0, 200, 200,
|
||||
texcoords[0], texcoords[1],
|
||||
texcoords[2], texcoords[3]);
|
||||
|
||||
|
@ -79,12 +79,7 @@ static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
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)
|
||||
};
|
||||
gfloat texcoords[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
|
||||
|
||||
priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
|
||||
@ -95,9 +90,7 @@ test_coglbox_paint(ClutterActor *self)
|
||||
|
||||
cogl_translate (100, 100, 0);
|
||||
cogl_set_source_texture (priv->cogl_tex_id[1]);
|
||||
cogl_rectangle_with_texture_coords (0, 0,
|
||||
CLUTTER_INT_TO_FIXED (200),
|
||||
CLUTTER_INT_TO_FIXED (213),
|
||||
cogl_rectangle_with_texture_coords (0, 0, 200, 213,
|
||||
texcoords[0], texcoords[1],
|
||||
texcoords[2], texcoords[3]);
|
||||
|
||||
|
@ -80,14 +80,14 @@ struct _TestCoglboxPrivate
|
||||
|
||||
static void
|
||||
test_coglbox_fade_texture (CoglHandle tex_id,
|
||||
ClutterFixed x1,
|
||||
ClutterFixed y1,
|
||||
ClutterFixed x2,
|
||||
ClutterFixed y2,
|
||||
ClutterFixed tx1,
|
||||
ClutterFixed ty1,
|
||||
ClutterFixed tx2,
|
||||
ClutterFixed ty2)
|
||||
gfloat x1,
|
||||
gfloat y1,
|
||||
gfloat x2,
|
||||
gfloat y2,
|
||||
gfloat tx1,
|
||||
gfloat ty1,
|
||||
gfloat tx2,
|
||||
gfloat ty2)
|
||||
{
|
||||
CoglTextureVertex vertices[4];
|
||||
int i;
|
||||
@ -130,14 +130,14 @@ test_coglbox_fade_texture (CoglHandle tex_id,
|
||||
|
||||
static void
|
||||
test_coglbox_triangle_texture (CoglHandle tex_id,
|
||||
ClutterFixed x,
|
||||
ClutterFixed y,
|
||||
ClutterFixed tx1,
|
||||
ClutterFixed ty1,
|
||||
ClutterFixed tx2,
|
||||
ClutterFixed ty2,
|
||||
ClutterFixed tx3,
|
||||
ClutterFixed ty3)
|
||||
gfloat x,
|
||||
gfloat y,
|
||||
gfloat tx1,
|
||||
gfloat ty1,
|
||||
gfloat tx2,
|
||||
gfloat ty2,
|
||||
gfloat tx3,
|
||||
gfloat ty3)
|
||||
{
|
||||
CoglTextureVertex vertices[3];
|
||||
int tex_width = cogl_texture_get_width (tex_id);
|
||||
@ -187,16 +187,13 @@ test_coglbox_paint (ClutterActor *self)
|
||||
|
||||
/* Draw a hand and refect it */
|
||||
cogl_set_source_texture (tex_handle);
|
||||
cogl_rectangle_with_texture_coords (0, 0,
|
||||
CLUTTER_INT_TO_FIXED (tex_width),
|
||||
CLUTTER_INT_TO_FIXED (tex_height),
|
||||
0, 0, CFX_ONE, CFX_ONE);
|
||||
cogl_rectangle_with_texture_coords (0, 0, tex_width, tex_height,
|
||||
0, 0, 1, 1);
|
||||
test_coglbox_fade_texture (tex_handle,
|
||||
0, CLUTTER_INT_TO_FIXED (tex_height),
|
||||
CLUTTER_INT_TO_FIXED (tex_width),
|
||||
CLUTTER_INT_TO_FIXED (tex_height * 3 / 2),
|
||||
0, CFX_ONE,
|
||||
CFX_ONE, CFX_ONE / 2);
|
||||
0, tex_height,
|
||||
tex_width, (tex_height * 3 / 2),
|
||||
0.0, 1.0,
|
||||
1.0, 0.5);
|
||||
|
||||
cogl_pop_matrix ();
|
||||
|
||||
@ -209,13 +206,13 @@ test_coglbox_paint (ClutterActor *self)
|
||||
test_coglbox_triangle_texture (tex_handle,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, CFX_ONE,
|
||||
CFX_ONE, CFX_ONE);
|
||||
0, 1,
|
||||
1, 1);
|
||||
test_coglbox_triangle_texture (tex_handle,
|
||||
CLUTTER_INT_TO_FIXED (20), 0,
|
||||
20, 0,
|
||||
0, 0,
|
||||
CFX_ONE, 0,
|
||||
CFX_ONE, CFX_ONE);
|
||||
1, 0,
|
||||
1, 1);
|
||||
|
||||
cogl_pop_matrix ();
|
||||
}
|
||||
|
@ -78,25 +78,20 @@ struct _TestCoglboxPrivate
|
||||
*--------------------------------------------------*/
|
||||
|
||||
static void
|
||||
test_coglbox_paint(ClutterActor *self)
|
||||
test_coglbox_paint (ClutterActor *self)
|
||||
{
|
||||
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
|
||||
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;
|
||||
gfloat texcoords[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
|
||||
gfloat sin_frame, cos_frame;
|
||||
gfloat frac_frame;
|
||||
gint pingpong_frame;
|
||||
gint t;
|
||||
sin_frame = clutter_sinx (priv->frame);
|
||||
cos_frame = clutter_cosx (priv->frame);
|
||||
|
||||
sin_frame = sinf ((float) priv->frame);
|
||||
cos_frame = cosf ((float) priv->frame);
|
||||
|
||||
pingpong_frame = (priv->frame <= 180 ? priv->frame : 360 - priv->frame);
|
||||
frac_frame = (CLUTTER_INT_TO_FIXED (pingpong_frame) /
|
||||
CLUTTER_INT_TO_FIXED (180));
|
||||
frac_frame = (float) pingpong_frame / 180.0;
|
||||
frac_frame += 0.5;
|
||||
frac_frame *= 2;
|
||||
|
||||
@ -118,9 +113,7 @@ test_coglbox_paint(ClutterActor *self)
|
||||
|
||||
cogl_translate (100, 100, 0);
|
||||
cogl_set_source_texture (priv->cogl_tex_id);
|
||||
cogl_rectangle_with_texture_coords (0, 0,
|
||||
CLUTTER_INT_TO_FIXED (200),
|
||||
CLUTTER_INT_TO_FIXED (213),
|
||||
cogl_rectangle_with_texture_coords (0, 0, 200, 213,
|
||||
texcoords[0], texcoords[1],
|
||||
texcoords[2], texcoords[3]);
|
||||
|
||||
|
@ -17,9 +17,9 @@ on_entry_paint (ClutterActor *actor,
|
||||
|
||||
cogl_set_source_color4ub (255, 255, 255, 255);
|
||||
cogl_path_round_rectangle (0, 0,
|
||||
CLUTTER_UNITS_TO_FIXED (width),
|
||||
CLUTTER_UNITS_TO_FIXED (height),
|
||||
(float)(4),
|
||||
CLUTTER_UNITS_TO_FLOAT (width),
|
||||
CLUTTER_UNITS_TO_FLOAT (height),
|
||||
4.0,
|
||||
COGL_ANGLE_FROM_DEG (1.0));
|
||||
cogl_path_stroke ();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user