From 19f041e7e105a568a57b22cc36e30590ccc75de7 Mon Sep 17 00:00:00 2001 From: Vladimir Nadvornik Date: Sun, 20 Mar 2011 12:49:00 +0100 Subject: [PATCH] added half-size (3dtv) stereo mode --- src/pixbuf-renderer.c | 11 +++++++++++ src/preferences.c | 32 ++++++++++++++++++++++++-------- src/typedefs.h | 4 ++-- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/pixbuf-renderer.c b/src/pixbuf-renderer.c index ce60bfff..f074e2b7 100644 --- a/src/pixbuf-renderer.c +++ b/src/pixbuf-renderer.c @@ -2621,6 +2621,16 @@ static void pr_stereo_set(PixbufRenderer *pr) if (pr->renderer2) pr->renderer2->free(pr->renderer2); pr->renderer2 = NULL; } + if (pr->stereo_mode & PR_STEREO_HALF) + { + if (pr->stereo_mode & PR_STEREO_HORIZ) pr->aspect_ratio = 2.0; + else if (pr->stereo_mode & PR_STEREO_VERT) pr->aspect_ratio = 0.5; + else pr->aspect_ratio = 1.0; + } + else + { + pr->aspect_ratio = 1.0; + } } void pixbuf_renderer_stereo_set(PixbufRenderer *pr, gint stereo_mode) @@ -2665,6 +2675,7 @@ static void pr_stereo_temp_disable(PixbufRenderer *pr, gboolean disable) pr->renderer->stereo_set(pr->renderer, PR_STEREO_NONE); if (pr->renderer2) pr->renderer2->free(pr->renderer2); pr->renderer2 = NULL; + pr->aspect_ratio = 1.0; } else { diff --git a/src/preferences.c b/src/preferences.c index d26aa0dd..83a2cfef 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -311,14 +311,14 @@ static void config_window_apply(void) options->metadata.confirm_on_dir_change = c_options->metadata.confirm_on_dir_change; options->metadata.keywords_case_sensitive = c_options->metadata.keywords_case_sensitive; options->metadata.write_orientation = c_options->metadata.write_orientation; - options->stereo.mode = (c_options->stereo.mode & (PR_STEREO_HORIZ | PR_STEREO_VERT | PR_STEREO_FIXED | PR_STEREO_ANAGLYPH)) | + options->stereo.mode = (c_options->stereo.mode & (PR_STEREO_HORIZ | PR_STEREO_VERT | PR_STEREO_FIXED | PR_STEREO_ANAGLYPH | PR_STEREO_HALF)) | (c_options->stereo.tmp.mirror_right ? PR_STEREO_MIRROR_RIGHT : 0) | (c_options->stereo.tmp.flip_right ? PR_STEREO_FLIP_RIGHT : 0) | (c_options->stereo.tmp.mirror_left ? PR_STEREO_MIRROR_LEFT : 0) | (c_options->stereo.tmp.flip_left ? PR_STEREO_FLIP_LEFT : 0) | (c_options->stereo.tmp.swap ? PR_STEREO_SWAP : 0) | (c_options->stereo.tmp.temp_disable ? PR_STEREO_TEMP_DISABLE : 0); - options->stereo.fsmode = (c_options->stereo.fsmode & (PR_STEREO_HORIZ | PR_STEREO_VERT | PR_STEREO_FIXED | PR_STEREO_ANAGLYPH)) | + options->stereo.fsmode = (c_options->stereo.fsmode & (PR_STEREO_HORIZ | PR_STEREO_VERT | PR_STEREO_FIXED | PR_STEREO_ANAGLYPH | PR_STEREO_HALF)) | (c_options->stereo.tmp.fs_mirror_right ? PR_STEREO_MIRROR_RIGHT : 0) | (c_options->stereo.tmp.fs_flip_right ? PR_STEREO_FLIP_RIGHT : 0) | (c_options->stereo.tmp.fs_mirror_left ? PR_STEREO_MIRROR_LEFT : 0) | @@ -572,9 +572,15 @@ static void stereo_mode_menu_cb(GtkWidget *combo, gpointer data) *option = PR_STEREO_HORIZ; break; case 3: - *option = PR_STEREO_VERT; + *option = PR_STEREO_HORIZ | PR_STEREO_HALF; break; case 4: + *option = PR_STEREO_VERT; + break; + case 5: + *option = PR_STEREO_VERT | PR_STEREO_HALF; + break; + case 6: *option = PR_STEREO_FIXED; break; } @@ -598,15 +604,25 @@ static void add_stereo_mode_menu(GtkWidget *table, gint column, gint row, const if (option & PR_STEREO_ANAGLYPH) current = 1; gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Side by Side")); - if (option & PR_STEREO_HORIZ) current = 2; + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Side by Side Half size")); + if (option & PR_STEREO_HORIZ) + { + current = 2; + if (option & PR_STEREO_HALF) current = 3; + } - gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Above - below")); - if (option & PR_STEREO_VERT) current = 3; - + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Top - Bottom")); + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Top - Bottom Half size")); + if (option & PR_STEREO_VERT) + { + current = 4; + if (option & PR_STEREO_HALF) current = 5; + } + if (add_fixed) { gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Fixed position")); - if (option & PR_STEREO_FIXED) current = 4; + if (option & PR_STEREO_FIXED) current = 6; } gtk_combo_box_set_active(GTK_COMBO_BOX(combo), current); diff --git a/src/typedefs.h b/src/typedefs.h index 3e7d3043..cdc2205b 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -204,8 +204,8 @@ typedef enum { PR_STEREO_MIRROR = PR_STEREO_MIRROR_LEFT | PR_STEREO_MIRROR_RIGHT, /* mirror mask*/ PR_STEREO_FLIP = PR_STEREO_FLIP_LEFT | PR_STEREO_FLIP_RIGHT, /* flip mask*/ PR_STEREO_SWAP = 1 << 10, /* swap left and right buffers */ - PR_STEREO_TEMP_DISABLE = 1 << 11 /* temporarily disable stereo mode if source image is not stereo */ - + PR_STEREO_TEMP_DISABLE = 1 << 11, /* temporarily disable stereo mode if source image is not stereo */ + PR_STEREO_HALF = 1 << 12 } PixbufRendererStereoMode; typedef enum { -- 2.20.1