summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2009-05-22 03:13:25 +0100
committerDamien Lespiau <damien.lespiau@intel.com>2009-05-22 03:13:25 +0100
commitb1c6a6d8fcc9b9931dfd8de3e0da5d2d42d6e4e3 (patch)
tree1b9921c0ef48535eacfc2ef31748248721d33f7e /tests
parent3df6b85959f015af631bd024afef872979810ade (diff)
downloadclutter-gst-b1c6a6d8fcc9b9931dfd8de3e0da5d2d42d6e4e3.tar.gz
Finishes the port of all the examples/tests to 1.0 API
Diffstat (limited to 'tests')
-rw-r--r--tests/test-rgb-upload.c35
-rw-r--r--tests/test-yuv-upload.c15
2 files changed, 26 insertions, 24 deletions
diff --git a/tests/test-rgb-upload.c b/tests/test-rgb-upload.c
index 3d9db0a..3d3e1bc 100644
--- a/tests/test-rgb-upload.c
+++ b/tests/test-rgb-upload.c
@@ -35,34 +35,39 @@ static GOptionEntry options[] =
void
size_change (ClutterTexture *texture,
- gint width,
- gint height,
- gpointer user_data)
+ gfloat width,
+ gfloat height,
+ gpointer user_data)
{
- gint new_x, new_y, new_width, new_height;
+ ClutterActor *stage;
+ gfloat new_x, new_y, new_width, new_height;
+ gfloat stage_width, stage_height;
- new_height = ( height * CLUTTER_STAGE_WIDTH() ) / width;
- if (new_height <= CLUTTER_STAGE_HEIGHT())
+ stage = clutter_actor_get_stage (CLUTTER_ACTOR (texture));
+ if (stage == NULL)
+ return;
+
+ clutter_actor_get_size (stage, &stage_width, &stage_height);
+
+ new_height = (height * stage_width) / width;
+ if (new_height <= stage_height)
{
- new_width = CLUTTER_STAGE_WIDTH();
+ new_width = stage_width;
new_x = 0;
- new_y = (CLUTTER_STAGE_HEIGHT() - new_height) / 2;
+ new_y = (stage_height - new_height) / 2;
}
else
{
- new_width = ( width * CLUTTER_STAGE_HEIGHT() ) / height;
- new_height = CLUTTER_STAGE_HEIGHT();
+ new_width = (width * stage_height) / height;
+ new_height = stage_height;
- new_x = (CLUTTER_STAGE_WIDTH() - new_width) / 2;
+ new_x = (stage_height - new_width) / 2;
new_y = 0;
}
clutter_actor_set_position (CLUTTER_ACTOR (texture), new_x, new_y);
-
- clutter_actor_set_size (CLUTTER_ACTOR (texture),
- new_width,
- new_height);
+ clutter_actor_set_size (CLUTTER_ACTOR (texture), new_width, new_height);
}
int
diff --git a/tests/test-yuv-upload.c b/tests/test-yuv-upload.c
index c727b57..0fd8096 100644
--- a/tests/test-yuv-upload.c
+++ b/tests/test-yuv-upload.c
@@ -34,9 +34,9 @@ parse_fourcc (const gchar *fourcc)
void
size_change (ClutterTexture *texture,
- gint width,
- gint height,
- gpointer user_data)
+ gfloat width,
+ gfloat height,
+ gpointer user_data)
{
ClutterActor *stage;
gfloat new_x, new_y, new_width, new_height;
@@ -48,7 +48,7 @@ size_change (ClutterTexture *texture,
clutter_actor_get_size (stage, &stage_width, &stage_height);
- new_height = ( height * stage_width ) / width;
+ new_height = (height * stage_width) / width;
if (new_height <= stage_height)
{
new_width = stage_width;
@@ -58,7 +58,7 @@ size_change (ClutterTexture *texture,
}
else
{
- new_width = ( width * stage_height ) / height;
+ new_width = (width * stage_height) / height;
new_height = stage_height;
new_x = (stage_width - new_width) / 2;
@@ -66,10 +66,7 @@ size_change (ClutterTexture *texture,
}
clutter_actor_set_position (CLUTTER_ACTOR (texture), new_x, new_y);
-
- clutter_actor_set_size (CLUTTER_ACTOR (texture),
- new_width,
- new_height);
+ clutter_actor_set_size (CLUTTER_ACTOR (texture), new_width, new_height);
}
int