[cheese/gnome-3-0] cheese-camera: make effect previews scale with the cheese window
- From: Raluca Elena Podiuc <ralucap src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/gnome-3-0] cheese-camera: make effect previews scale with the cheese window
- Date: Thu, 14 Jul 2011 19:14:27 +0000 (UTC)
commit 097676a1028adb1f67b684199bc712180a5a2134
Author: Raluca Elena Podiuc <ralucaelena1985 gmail com>
Date: Sun Jul 10 19:39:11 2011 +0300
cheese-camera: make effect previews scale with the cheese window
Before this patch, when you scaled Cheese's main window, in the the
effects preview mode, the window would scale but the 9 videos inside
the window would remain at the same size.
I had to remove the fixed scaling from the effects pipeline and let
the size of the textures be governed by the layout manager.
Now when you scale the Cheese effect preview window all 9 videos are
automatically scaled (keeping aspect-ratio) to fill the available space.
libcheese/cheese-camera.c | 15 ++-------------
src/cheese-window.vala | 14 ++++----------
2 files changed, 6 insertions(+), 23 deletions(-)
---
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index dd073f7..8b988b1 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -80,7 +80,6 @@ typedef struct
GstElement *effect_filter;
GstElement *video_balance, *csp_post_balance;
GstElement *camera_tee, *effects_tee;
- GstElement *effects_downscaler;
GstElement *main_valve, *effects_valve;
GstCaps *preview_caps;
@@ -416,24 +415,14 @@ cheese_camera_create_effects_preview_bin (CheeseCamera *camera, GError **error)
{
cheese_camera_set_error_element_not_found (error, "effects_valve");
}
- priv->effects_downscaler = gst_parse_bin_from_description (
- "videoscale ! video/x-raw-yuv,width=160,height=120 ! ffmpegcolorspace",
- TRUE,
- &err);
- if (priv->effects_downscaler == NULL || err != NULL)
- {
- cheese_camera_set_error_element_not_found (error, "effects_downscaler");
- }
if (error != NULL && *error != NULL)
return FALSE;
gst_bin_add_many (GST_BIN (priv->effects_preview_bin),
- priv->effects_downscaler, priv->effects_tee,
- priv->effects_valve, NULL);
+ priv->effects_valve, priv->effects_tee, NULL);
- ok &= gst_element_link_many (priv->effects_valve, priv->effects_downscaler,
- priv->effects_tee, NULL);
+ ok &= gst_element_link_many (priv->effects_valve, priv->effects_tee, NULL);
/* add ghostpads */
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index 1d60f90..8886f46 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -963,8 +963,6 @@ public class Cheese.MainWindow : Gtk.Window
Clutter.TableLayout table_layout = new TableLayout ();
Clutter.Box grid = new Clutter.Box (table_layout);
effects_grids.add (grid);
- grid.set_size (viewport.width, viewport.height);
-
table_layout.set_column_spacing (10);
table_layout.set_row_spacing (10);
}
@@ -973,8 +971,8 @@ public class Cheese.MainWindow : Gtk.Window
{
Effect effect = effects_manager.effects[i];
Clutter.Texture texture = new Clutter.Texture ();
- Clutter.BinLayout layout = new Clutter.BinLayout (Clutter.BinAlignment.FILL,
- Clutter.BinAlignment.FILL);
+ Clutter.BinLayout layout = new Clutter.BinLayout (Clutter.BinAlignment.CENTER,
+ Clutter.BinAlignment.CENTER);
Clutter.Box box = new Clutter.Box (layout);
Clutter.Text text = new Clutter.Text ();
Clutter.Rectangle rect = new Clutter.Rectangle ();
@@ -982,9 +980,8 @@ public class Cheese.MainWindow : Gtk.Window
rect.opacity = 128;
rect.color = Clutter.Color.from_string ("black");
- box.pack ((Clutter.Actor) texture,
- "x-align", Clutter.BinAlignment.FILL,
- "y-align", Clutter.BinAlignment.FILL, null);
+ texture.keep_aspect_ratio = true;
+ box.pack ((Clutter.Actor) texture, null, null);
box.reactive = true;
box.set_data ("effect", effect);
effect.set_data ("texture", texture);
@@ -1004,9 +1001,6 @@ public class Cheese.MainWindow : Gtk.Window
"y-align", Clutter.BinAlignment.END, null);
Clutter.TableLayout table_layout = (Clutter.TableLayout) effects_grids[i / EFFECTS_PER_PAGE].layout_manager;
- box.width = (viewport.width - 2 * table_layout.get_column_spacing ()) / 3;
- box.height = (viewport.height - 2 * table_layout.get_row_spacing ()) / 3;
-
table_layout.pack ((Clutter.Actor) box,
(i % EFFECTS_PER_PAGE) % 3,
(i % EFFECTS_PER_PAGE) / 3);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]