# HG changeset patch # User Klaus Ethgen # Date 1439331992 -3600 # Node ID a9b5d451b83a70998879ede146f70f2c452d1e8e # Parent f2b8d63842ca8d8b0b0e696d889ed0d7748e7ccd# Parent 349d01cd2671e6c8b073c0080790066381d6b1bf Merge requests 12, 13 and 14 into master * origin/merge-requests/12: Fix typo in debug messages * origin/merge-requests/13: fix include statements for large file support on 32-bit * origin/merge-requests/14: Add support for Green-Magenta and Yellow-Blue anaglyph modes diff -r f2b8d63842ca -r a9b5d451b83a src/fullscreen.c --- a/src/fullscreen.c Tue Aug 11 23:21:37 2015 +0100 +++ b/src/fullscreen.c Tue Aug 11 23:26:32 2015 +0100 @@ -301,12 +301,12 @@ if (fs->same_region) { - DEBUG_0("Original vindow is not visible, enabling std. fullscreen mode"); + DEBUG_0("Original window is not visible, enabling std. fullscreen mode"); image_move_from_image(fs->imd, fs->normal_imd); } else { - DEBUG_0("Original vindow is still visible, enabling presentation fullscreen mode"); + DEBUG_0("Original window is still visible, enabling presentation fullscreen mode"); image_copy_from_image(fs->imd, fs->normal_imd); } diff -r f2b8d63842ca -r a9b5d451b83a src/pixbuf-renderer.c --- a/src/pixbuf-renderer.c Tue Aug 11 23:21:37 2015 +0100 +++ b/src/pixbuf-renderer.c Tue Aug 11 23:26:32 2015 +0100 @@ -2150,7 +2150,11 @@ */ #define COLOR_BYTES 3 /* rgb */ -static void pr_create_anaglyph_RC(GdkPixbuf *pixbuf, GdkPixbuf *right, gint x, gint y, gint w, gint h) +#define RC 0 /* Red-Cyan */ +#define GM 1 /* Green-Magenta */ +#define YB 2 /* Yellow-Blue */ + +static void pr_create_anaglyph_color(GdkPixbuf *pixbuf, GdkPixbuf *right, gint x, gint y, gint w, gint h, guint mode) { gint srs, drs; guchar *s_pix, *d_pix; @@ -2172,14 +2176,26 @@ dp = dpi + (i * drs); for (j = 0; j < w; j++) { - *dp = *sp; /* copy red channel */ + switch(mode) + { + case RC: + dp[0] = sp[0]; /* copy red channel */ + break; + case GM: + dp[1] = sp[1]; + break; + case YB: + dp[0] = sp[0]; + dp[1] = sp[1]; + break; + } sp += COLOR_BYTES; dp += COLOR_BYTES; } } } -static void pr_create_anaglyph_gray(GdkPixbuf *pixbuf, GdkPixbuf *right, gint x, gint y, gint w, gint h) +static void pr_create_anaglyph_gray(GdkPixbuf *pixbuf, GdkPixbuf *right, gint x, gint y, gint w, gint h, guint mode) { gint srs, drs; guchar *s_pix, *d_pix; @@ -2204,28 +2220,63 @@ { guchar g1 = dp[0] * gc[0] + dp[1] * gc[1] + dp[2] * gc[2]; guchar g2 = sp[0] * gc[0] + sp[1] * gc[1] + sp[2] * gc[2]; - dp[0] = g2; /* red channel from sp */ - dp[1] = g1; /* green and blue from dp */ - dp[2] = g1; + switch(mode) + { + case RC: + dp[0] = g2; /* red channel from sp */ + dp[1] = g1; /* green and blue from dp */ + dp[2] = g1; + break; + case GM: + dp[0] = g1; + dp[1] = g2; + dp[2] = g1; + break; + case YB: + dp[0] = g2; + dp[1] = g2; + dp[2] = g1; + break; + } sp += COLOR_BYTES; dp += COLOR_BYTES; } } } -const double pr_dubois_matrix[3][6] = { - { 0.456, 0.500, 0.176, -0.043, -0.088, -0.002}, - {-0.040, -0.038, -0.016, 0.378, 0.734, -0.018}, - {-0.015, -0.021, -0.005, -0.072, -0.113, 1.226} - }; - -static void pr_create_anaglyph_dubois(GdkPixbuf *pixbuf, GdkPixbuf *right, gint x, gint y, gint w, gint h) +static void pr_create_anaglyph_dubois(GdkPixbuf *pixbuf, GdkPixbuf *right, gint x, gint y, gint w, gint h, guint mode) { gint srs, drs; guchar *s_pix, *d_pix; guchar *sp, *dp; guchar *spi, *dpi; gint i, j, k; + double pr_dubois_matrix[3][6]; + const static double pr_dubois_matrix_RC[3][6] = { + { 0.456, 0.500, 0.176, -0.043, -0.088, -0.002}, + {-0.040, -0.038, -0.016, 0.378, 0.734, -0.018}, + {-0.015, -0.021, -0.005, -0.072, -0.113, 1.226}}; + const static double pr_dubois_matrix_GM[3][6] = { + {-0.062, -0.158, -0.039, 0.529, 0.705, 0.024}, + { 0.284, 0.668, 0.143, -0.016, -0.015, -0.065}, + {-0.015, -0.027, 0.021, 0.009, 0.075, 0.937}}; + const static double pr_dubois_matrix_YB[3][6] = { + { 1.000, -0.193, 0.282, -0.015, -0.116, -0.016}, + {-0.024, 0.855, 0.064, 0.006, 0.058, -0.016}, + {-0.036, -0.163, 0.021, 0.089, 0.174, 0.858}}; + + switch(mode) + { + case RC: + memcpy(pr_dubois_matrix, pr_dubois_matrix_RC, sizeof pr_dubois_matrix); + break; + case GM: + memcpy(pr_dubois_matrix, pr_dubois_matrix_GM, sizeof pr_dubois_matrix); + break; + case YB: + memcpy(pr_dubois_matrix, pr_dubois_matrix_YB, sizeof pr_dubois_matrix); + break; + } srs = gdk_pixbuf_get_rowstride(right); s_pix = gdk_pixbuf_get_pixels(right); @@ -2261,11 +2312,23 @@ void pr_create_anaglyph(guint mode, GdkPixbuf *pixbuf, GdkPixbuf *right, gint x, gint y, gint w, gint h) { if (mode & PR_STEREO_ANAGLYPH_RC) - pr_create_anaglyph_RC(pixbuf, right, x, y, w, h); - else if (mode & PR_STEREO_ANAGLYPH_GRAY) - pr_create_anaglyph_gray(pixbuf, right, x, y, w, h); - else if (mode & PR_STEREO_ANAGLYPH_DB) - pr_create_anaglyph_dubois(pixbuf, right, x, y, w, h); + pr_create_anaglyph_color(pixbuf, right, x, y, w, h, RC); + else if (mode & PR_STEREO_ANAGLYPH_GM) + pr_create_anaglyph_color(pixbuf, right, x, y, w, h, GM); + else if (mode & PR_STEREO_ANAGLYPH_YB) + pr_create_anaglyph_color(pixbuf, right, x, y, w, h, YB); + else if (mode & PR_STEREO_ANAGLYPH_GRAY_RC) + pr_create_anaglyph_gray(pixbuf, right, x, y, w, h, RC); + else if (mode & PR_STEREO_ANAGLYPH_GRAY_GM) + pr_create_anaglyph_gray(pixbuf, right, x, y, w, h, GM); + else if (mode & PR_STEREO_ANAGLYPH_GRAY_YB) + pr_create_anaglyph_gray(pixbuf, right, x, y, w, h, YB); + else if (mode & PR_STEREO_ANAGLYPH_DB_RC) + pr_create_anaglyph_dubois(pixbuf, right, x, y, w, h, RC); + else if (mode & PR_STEREO_ANAGLYPH_DB_GM) + pr_create_anaglyph_dubois(pixbuf, right, x, y, w, h, GM); + else if (mode & PR_STEREO_ANAGLYPH_DB_YB) + pr_create_anaglyph_dubois(pixbuf, right, x, y, w, h, YB); } /* diff -r f2b8d63842ca -r a9b5d451b83a src/preferences.c --- a/src/preferences.c Tue Aug 11 23:21:37 2015 +0100 +++ b/src/preferences.c Tue Aug 11 23:26:32 2015 +0100 @@ -528,24 +528,42 @@ *option = PR_STEREO_ANAGLYPH_RC; break; case 2: - *option = PR_STEREO_ANAGLYPH_GRAY; + *option = PR_STEREO_ANAGLYPH_GM; break; case 3: - *option = PR_STEREO_ANAGLYPH_DB; + *option = PR_STEREO_ANAGLYPH_YB; break; case 4: - *option = PR_STEREO_HORIZ; + *option = PR_STEREO_ANAGLYPH_GRAY_RC; break; case 5: + *option = PR_STEREO_ANAGLYPH_GRAY_GM; + break; + case 6: + *option = PR_STEREO_ANAGLYPH_GRAY_YB; + break; + case 7: + *option = PR_STEREO_ANAGLYPH_DB_RC; + break; + case 8: + *option = PR_STEREO_ANAGLYPH_DB_GM; + break; + case 9: + *option = PR_STEREO_ANAGLYPH_DB_YB; + break; + case 10: + *option = PR_STEREO_HORIZ; + break; + case 11: *option = PR_STEREO_HORIZ | PR_STEREO_HALF; break; - case 6: + case 12: *option = PR_STEREO_VERT; break; - case 7: + case 13: *option = PR_STEREO_VERT | PR_STEREO_HALF; break; - case 8: + case 14: *option = PR_STEREO_FIXED; break; } @@ -567,31 +585,43 @@ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Anaglyph Red-Cyan")); if (option & PR_STEREO_ANAGLYPH_RC) current = 1; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Anaglyph Green-Magenta")); + if (option & PR_STEREO_ANAGLYPH_GM) current = 2; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Anaglyph Yellow-Blue")); + if (option & PR_STEREO_ANAGLYPH_YB) current = 3; gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Anaglyph Gray Red-Cyan")); - if (option & PR_STEREO_ANAGLYPH_GRAY) current = 2; - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Anaglyph Dubois")); - if (option & PR_STEREO_ANAGLYPH_DB) current = 3; + if (option & PR_STEREO_ANAGLYPH_GRAY_RC) current = 4; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Anaglyph Gray Green-Magenta")); + if (option & PR_STEREO_ANAGLYPH_GRAY_GM) current = 5; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Anaglyph Gray Yellow-Blue")); + if (option & PR_STEREO_ANAGLYPH_GRAY_YB) current = 6; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Anaglyph Dubois Red-Cyan")); + if (option & PR_STEREO_ANAGLYPH_DB_RC) current = 7; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Anaglyph Dubois Green-Magenta")); + if (option & PR_STEREO_ANAGLYPH_DB_GM) current = 8; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Anaglyph Dubois Yellow-Blue")); + if (option & PR_STEREO_ANAGLYPH_DB_YB) current = 9; gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Side by Side")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Side by Side Half size")); if (option & PR_STEREO_HORIZ) { - current = 4; - if (option & PR_STEREO_HALF) current = 5; + current = 10; + if (option & PR_STEREO_HALF) current = 11; } gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Top - Bottom")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Top - Bottom Half size")); if (option & PR_STEREO_VERT) { - current = 6; - if (option & PR_STEREO_HALF) current = 7; + current = 12; + if (option & PR_STEREO_HALF) current = 13; } if (add_fixed) { gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Fixed position")); - if (option & PR_STEREO_FIXED) current = 8; + if (option & PR_STEREO_FIXED) current = 14; } gtk_combo_box_set_active(GTK_COMBO_BOX(combo), current); diff -r f2b8d63842ca -r a9b5d451b83a src/secure_save.c --- a/src/secure_save.c Tue Aug 11 23:21:37 2015 +0100 +++ b/src/secure_save.c Tue Aug 11 23:26:32 2015 +0100 @@ -9,12 +9,12 @@ * This software comes with no warranty of any kind, use at your own risk! */ +#include "main.h" #include #include #include #include -#include "main.h" #include "secure_save.h" diff -r f2b8d63842ca -r a9b5d451b83a src/typedefs.h --- a/src/typedefs.h Tue Aug 11 23:21:37 2015 +0100 +++ b/src/typedefs.h Tue Aug 11 23:26:32 2015 +0100 @@ -188,28 +188,42 @@ } ToolbarType; typedef enum { - PR_STEREO_NONE = 0, /* do nothing */ - PR_STEREO_DUAL = 1 << 0, /* independent stereo buffers, for example nvidia opengl */ - PR_STEREO_FIXED = 1 << 1, /* custom position */ - PR_STEREO_HORIZ = 1 << 2, /* side by side */ - PR_STEREO_VERT = 1 << 3, /* above below */ - PR_STEREO_RIGHT = 1 << 4, /* render right buffer */ - PR_STEREO_ANAGLYPH_RC = 1 << 5, /* anaglyph red-cyan */ - PR_STEREO_ANAGLYPH_GRAY = 1 << 6, /* anaglyph gray red-cyan*/ - PR_STEREO_ANAGLYPH_DB = 1 << 7, /* anaglyph dubois*/ - PR_STEREO_ANAGLYPH = PR_STEREO_ANAGLYPH_RC | PR_STEREO_ANAGLYPH_GRAY | PR_STEREO_ANAGLYPH_DB, /* anaglyph mask */ + PR_STEREO_NONE = 0, /* do nothing */ + PR_STEREO_DUAL = 1 << 0, /* independent stereo buffers, for example nvidia opengl */ + PR_STEREO_FIXED = 1 << 1, /* custom position */ + PR_STEREO_HORIZ = 1 << 2, /* side by side */ + PR_STEREO_VERT = 1 << 3, /* above below */ + PR_STEREO_RIGHT = 1 << 4, /* render right buffer */ + PR_STEREO_ANAGLYPH_RC = 1 << 5, /* anaglyph red-cyan */ + PR_STEREO_ANAGLYPH_GM = 1 << 6, /* anaglyph green-magenta */ + PR_STEREO_ANAGLYPH_YB = 1 << 7, /* anaglyph yellow-blue */ + PR_STEREO_ANAGLYPH_GRAY_RC = 1 << 8, /* anaglyph gray red-cyan*/ + PR_STEREO_ANAGLYPH_GRAY_GM = 1 << 9, /* anaglyph gray green-magenta */ + PR_STEREO_ANAGLYPH_GRAY_YB = 1 << 10, /* anaglyph gray yellow-blue */ + PR_STEREO_ANAGLYPH_DB_RC = 1 << 11, /* anaglyph dubois red-cyan */ + PR_STEREO_ANAGLYPH_DB_GM = 1 << 12, /* anaglyph dubois green-magenta */ + PR_STEREO_ANAGLYPH_DB_YB = 1 << 13, /* anaglyph dubois yellow-blue */ + PR_STEREO_ANAGLYPH = PR_STEREO_ANAGLYPH_RC | + PR_STEREO_ANAGLYPH_GM | + PR_STEREO_ANAGLYPH_YB | + PR_STEREO_ANAGLYPH_GRAY_RC | + PR_STEREO_ANAGLYPH_GRAY_GM | + PR_STEREO_ANAGLYPH_GRAY_YB | + PR_STEREO_ANAGLYPH_DB_RC | + PR_STEREO_ANAGLYPH_DB_GM | + PR_STEREO_ANAGLYPH_DB_YB, /* anaglyph mask */ - PR_STEREO_MIRROR_LEFT = 1 << 8, /* mirror */ - PR_STEREO_FLIP_LEFT = 1 << 9, /* flip */ + PR_STEREO_MIRROR_LEFT = 1 << 14, /* mirror */ + PR_STEREO_FLIP_LEFT = 1 << 15, /* flip */ - PR_STEREO_MIRROR_RIGHT = 1 << 10, /* mirror */ - PR_STEREO_FLIP_RIGHT = 1 << 11, /* flip */ + PR_STEREO_MIRROR_RIGHT = 1 << 16, /* mirror */ + PR_STEREO_FLIP_RIGHT = 1 << 17, /* flip */ - 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 << 12, /* swap left and right buffers */ - PR_STEREO_TEMP_DISABLE = 1 << 13, /* temporarily disable stereo mode if source image is not stereo */ - PR_STEREO_HALF = 1 << 14 + 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 << 18, /* swap left and right buffers */ + PR_STEREO_TEMP_DISABLE = 1 << 19, /* temporarily disable stereo mode if source image is not stereo */ + PR_STEREO_HALF = 1 << 20 } PixbufRendererStereoMode; typedef enum { diff -r f2b8d63842ca -r a9b5d451b83a src/ui_fileops.h --- a/src/ui_fileops.h Tue Aug 11 23:21:37 2015 +0100 +++ b/src/ui_fileops.h Tue Aug 11 23:26:32 2015 +0100 @@ -14,7 +14,7 @@ #ifndef UI_FILEOPS_H #define UI_FILEOPS_H - +#include "config.h" #include #include #include