summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/video-player.c11
-rw-r--r--examples/video-sink.c35
-rw-r--r--tests/test-rgb-upload.c35
-rw-r--r--tests/test-yuv-upload.c15
4 files changed, 50 insertions, 46 deletions
diff --git a/examples/video-player.c b/examples/video-player.c
index b6c929a..2cbdc55 100644
--- a/examples/video-player.c
+++ b/examples/video-player.c
@@ -197,9 +197,9 @@ input_cb (ClutterStage *stage,
static void
size_change (ClutterTexture *texture,
- gint width,
- gint height,
- VideoApp *app)
+ gfloat width,
+ gfloat height,
+ VideoApp *app)
{
ClutterActor *stage = app->stage;
gfloat new_x, new_y, new_width, new_height;
@@ -225,10 +225,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);
}
static void
diff --git a/examples/video-sink.c b/examples/video-sink.c
index e26d7b6..aa49e27 100644
--- a/examples/video-sink.c
+++ b/examples/video-sink.c
@@ -2,34 +2,39 @@
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_width - 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-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