changeset 2837:c8cc3884bc8d

Ref #160: Replace print dialog by standard GTK dialog https://github.com/BestImageViewer/geeqie/issues/160 Rotate to exif orientation
author Colin Clark <colin.clark@cclark.uk>
date Thu, 04 Oct 2018 16:16:25 +0100
parents bb44bd76f857
children ac5d820c9a9e
files src/print.c
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/print.c	Tue Oct 02 13:01:06 2018 +0100
+++ b/src/print.c	Thu Oct 04 16:16:25 2018 +0100
@@ -21,8 +21,10 @@
 #include "main.h"
 #include "print.h"
 
+#include "exif.h"
 #include "filedata.h"
 #include "image-load.h"
+#include "pixbuf_util.h"
 #include "ui_misc.h"
 #include "ui_fileops.h"
 
@@ -527,6 +529,7 @@
 	gdouble height_offset;
 	GdkPixbuf *pixbuf;
 	GdkPixbuf *pixbuf_scaled;
+	GdkPixbuf *rotated = NULL;
 	PangoLayout *layout_image = NULL;
 	PangoLayout *layout_page = NULL;
 	PangoFontDescription *desc;
@@ -543,12 +546,18 @@
 	GtkTextIter start, end;
 	gchar *tmp;
 
+	fd = g_list_nth_data(pw->source_selection, page_nr);
+
 	pixbuf = g_list_nth_data(pw->print_pixbuf_queue, page_nr);
+	if (fd->exif_orientation != EXIF_ORIENTATION_TOP_LEFT)
+		{
+		rotated = pixbuf_apply_orientation(pixbuf, fd->exif_orientation);
+		pixbuf = rotated;
+		}
+
 	pixbuf_image_width = gdk_pixbuf_get_width(pixbuf);
 	pixbuf_image_height = gdk_pixbuf_get_height(pixbuf);
 
-	fd = g_list_nth_data(pw->source_selection, page_nr);
-
 	if (options->printer.show_image_text)
 		{
 		if (pw->text_fields & TEXT_INFO_FILENAME)
@@ -749,6 +758,7 @@
 		}
 
 	g_object_unref(pixbuf_scaled);
+	if (rotated) g_object_unref(rotated);
 
 	return;
 }