changeset 2711:70457fceb02c

Merge remote-tracking branches 'github/merge-requests/581', 'github/merge-requests/576', 'github/merge-requests/574' and 'github/merge-requests/573' * github/merge-requests/581: Fix crash after strange behaviour of the "Really Continue" dialog * github/merge-requests/576: Trap build errors * github/merge-requests/574: Fix spelling mistake occured/occurred * github/merge-requests/573: Partially fix #561: Hi-DPI-aware rendering of images.
author Klaus Ethgen <Klaus@Ethgen.de>
date Mon, 22 Jan 2018 21:07:11 +0100
parents 88b48668094b (diff) 79b668de97df (current diff)
children d7f6f1ce57eb
files src/Makefile.am src/renderer-tiles.c
diffstat 4 files changed, 22 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/src/Makefile.am	Thu Dec 28 19:32:22 2017 +0100
+++ b/src/Makefile.am	Mon Jan 22 21:07:11 2018 +0100
@@ -64,7 +64,7 @@
 	 echo '#ifndef UI_ICONS_H'; \
 	 echo '#define UI_ICONS_H'; echo; \
 	 $(GDK_PIXBUF_CSOURCE) --raw --extern --build-list $(ICON_PAIRS); \
-	 echo '#endif /* UI_ICONS_H */'" > $@ || echo "!!! Failed to generate $@ !!!"
+	 echo '#endif /* UI_ICONS_H */'" > $@ || { echo "!!! Failed to generate $@ !!!"; exit 1; }
 
 ClayRGB1998_icc.h: ClayRGB1998.icc
 	echo "/*" > $@
--- a/src/print.c	Thu Dec 28 19:32:22 2017 +0100
+++ b/src/print.c	Mon Jan 22 21:07:11 2018 +0100
@@ -1975,7 +1975,7 @@
 				parent, TRUE, NULL, NULL);
 	generic_dialog_add_button(gd, GTK_STOCK_OK, NULL, NULL, TRUE);
 
-	buf = g_strdup_printf(_("An error occured printing to %s."), print_output_name(pw->output));
+	buf = g_strdup_printf(_("An error occurred printing to %s."), print_output_name(pw->output));
 	generic_dialog_add_message(gd, GTK_STOCK_DIALOG_ERROR, _("Printing error"), buf, TRUE);
 	g_free(buf);
 
--- a/src/remote.c	Thu Dec 28 19:32:22 2017 +0100
+++ b/src/remote.c	Mon Jan 22 21:07:11 2018 +0100
@@ -279,11 +279,11 @@
 	return rc;
 }
 
-static sig_atomic_t sigpipe_occured = FALSE;
+static sig_atomic_t sigpipe_occurred = FALSE;
 
 static void sighandler_sigpipe(gint sig)
 {
-	sigpipe_occured = TRUE;
+	sigpipe_occurred = TRUE;
 }
 
 static gboolean remote_client_send(RemoteConnection *rc, const gchar *text)
@@ -296,7 +296,7 @@
 	if (!rc || rc->server) return FALSE;
 	if (!text) return TRUE;
 
-	sigpipe_occured = FALSE;
+	sigpipe_occurred = FALSE;
 
 	new_action.sa_handler = sighandler_sigpipe;
 	sigemptyset(&new_action.sa_mask);
--- a/src/renderer-tiles.c	Thu Dec 28 19:32:22 2017 +0100
+++ b/src/renderer-tiles.c	Mon Jan 22 21:07:11 2018 +0100
@@ -147,7 +147,6 @@
 	gint x_scroll;  /* allow local adjustment and mirroring */
 	gint y_scroll;
 
-	gint hidpi_scale;
 };
 
 
@@ -500,25 +499,6 @@
 	return PR_TILE_SIZE * PR_TILE_SIZE * 4 / 8;
 }
 
-static void rt_hidpi_aware_draw(
-	RendererTiles *rt,
-	cairo_t *cr,
-	GdkPixbuf *pixbuf,
-	double x,
-	double y)
-{
-#if GTK_CHECK_VERSION(3, 10, 0)
-	cairo_surface_t *surface;
-	surface = gdk_cairo_surface_create_from_pixbuf(pixbuf, rt->hidpi_scale, NULL);
-	cairo_set_source_surface(cr, surface, x, y);
-	cairo_fill(cr);
-	cairo_surface_destroy(surface);
-#else
-	gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y);
-	cairo_fill(cr);
-#endif
-}
-
 static void rt_tile_prepare(RendererTiles *rt, ImageTile *it)
 {
 	PixbufRenderer *pr = rt->pr;
@@ -531,7 +511,7 @@
 		                                            CAIRO_CONTENT_COLOR,
 		                                            rt->tile_width, rt->tile_height);
 
-		size = pixmap_calc_size(surface) * rt->hidpi_scale * rt->hidpi_scale;
+		size = pixmap_calc_size(surface);
 		rt_tile_free_space(rt, size, it);
 
 		it->surface = surface;
@@ -543,9 +523,9 @@
 		{
 		GdkPixbuf *pixbuf;
 		guint size;
-		pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, rt->hidpi_scale * rt->tile_width, rt->hidpi_scale * rt->tile_height);
+		pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, rt->tile_width, rt->tile_height);
 
-		size = gdk_pixbuf_get_rowstride(pixbuf) * rt->tile_height * rt->hidpi_scale;
+		size = gdk_pixbuf_get_rowstride(pixbuf) * rt->tile_height;
 		rt_tile_free_space(rt, size, it);
 
 		it->pixbuf = pixbuf;
@@ -643,7 +623,7 @@
 				cairo_fill_preserve(cr);
 
 				gdk_cairo_set_source_pixbuf(cr, od->pixbuf, px - rx, py - ry);
-				cairo_fill(cr);
+				cairo_fill (cr);
 				cairo_destroy (cr);
 
 				cr = gdk_cairo_create(od->window);
@@ -901,7 +881,7 @@
 
 static GdkPixbuf *rt_get_spare_tile(RendererTiles *rt)
 {
-	if (!rt->spare_tile) rt->spare_tile = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, rt->tile_width * rt->hidpi_scale, rt->tile_height * rt->hidpi_scale);
+	if (!rt->spare_tile) rt->spare_tile = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, rt->tile_width, rt->tile_height);
 	return rt->spare_tile;
 }
 
@@ -916,7 +896,7 @@
 	guchar *sp, *dp;
 	guchar *ip, *spi, *dpi;
 	gint i, j;
-	gint tw = rt->tile_width * rt->hidpi_scale;
+	gint tw = rt->tile_width;
 
 	srs = gdk_pixbuf_get_rowstride(src);
 	s_pix = gdk_pixbuf_get_pixels(src);
@@ -952,7 +932,7 @@
 	guchar *sp, *dp;
 	guchar *ip, *spi, *dpi;
 	gint i, j;
-	gint th = rt->tile_height * rt->hidpi_scale;
+	gint th = rt->tile_height;
 
 	srs = gdk_pixbuf_get_rowstride(src);
 	s_pix = gdk_pixbuf_get_pixels(src);
@@ -989,7 +969,7 @@
 	guchar *spi, *dpi;
 	gint i, j;
 
-	gint tw = rt->tile_width * rt->hidpi_scale;
+	gint tw = rt->tile_width;
 
 	srs = gdk_pixbuf_get_rowstride(src);
 	s_pix = gdk_pixbuf_get_pixels(src);
@@ -1025,8 +1005,8 @@
 	guchar *sp, *dp;
 	guchar *dpi;
 	gint i, j;
-	gint tw = rt->tile_width * rt->hidpi_scale;
-	gint th = rt->tile_height * rt->hidpi_scale;
+	gint tw = rt->tile_width;
+	gint th = rt->tile_height;
 
 	srs = gdk_pixbuf_get_rowstride(src);
 	s_pix = gdk_pixbuf_get_pixels(src);
@@ -1061,7 +1041,7 @@
 	guchar *sp, *dp;
 	guchar *spi, *dpi;
 	gint i;
-	gint th = rt->tile_height * rt->hidpi_scale;
+	gint th = rt->tile_height;
 
 	srs = gdk_pixbuf_get_rowstride(src);
 	s_pix = gdk_pixbuf_get_pixels(src);
@@ -1170,12 +1150,12 @@
 				if (st->blank)
 					{
 					cairo_set_source_rgb(cr, 0, 0, 0);
-					cairo_fill (cr);
 					}
 				else /* (pr->zoom == 1.0 || pr->scale == 1.0) */
 					{
-					rt_hidpi_aware_draw(rt, cr, st->pixbuf, -it->x + st->x, -it->y + st->y);
+					gdk_cairo_set_source_pixbuf(cr, st->pixbuf, -it->x + st->x, -it->y + st->y);
 					}
+				cairo_fill (cr);
 				cairo_destroy (cr);
 				}
 			}
@@ -1376,8 +1356,8 @@
 
 		if (pr->image_width == 0 || pr->image_height == 0) return;
 
-		scale_x = rt->hidpi_scale * (gdouble)pr->width / pr->image_width;
-		scale_y = rt->hidpi_scale * (gdouble)pr->height / pr->image_height;
+		scale_x = (gdouble)pr->width / pr->image_width;
+		scale_y = (gdouble)pr->height / pr->image_height;
 
 		pr_tile_coords_map_orientation(orientation, it->x, it->y,
 					    pr->width, pr->height,
@@ -1389,13 +1369,6 @@
 					    &pb_x, &pb_y,
 					    &pb_w, &pb_h);
 
-		src_x *= rt->hidpi_scale;
-		src_y *= rt->hidpi_scale;
-		pb_x *= rt->hidpi_scale;
-		pb_y *= rt->hidpi_scale;
-		pb_w *= rt->hidpi_scale;
-		pb_h *= rt->hidpi_scale;
-
 		switch (orientation)
 			{
 			gdouble tmp;
@@ -1451,7 +1424,8 @@
 
 		cr = cairo_create(it->surface);
 		cairo_rectangle (cr, x, y, w, h);
-		rt_hidpi_aware_draw(rt, cr, it->pixbuf, 0, 0);
+		gdk_cairo_set_source_pixbuf(cr, it->pixbuf, 0, 0);
+		cairo_fill (cr);
 		cairo_destroy (cr);
 		}
 }
@@ -2190,12 +2164,6 @@
 	rt->stereo_off_x = 0;
 	rt->stereo_off_y = 0;
 
-#if GTK_CHECK_VERSION(3, 10, 0)
-	rt->hidpi_scale = gtk_widget_get_scale_factor(GTK_WIDGET(rt->pr));
-#else
-	rt->hidpi_scale = 1;
-#endif
-
 	g_signal_connect(G_OBJECT(pr), "hierarchy-changed",
 			 G_CALLBACK(rt_hierarchy_changed_cb), rt);
 
@@ -2206,7 +2174,6 @@
 	g_signal_connect(G_OBJECT(pr), "expose_event",
 	                 G_CALLBACK(rt_expose_cb), rt);
 #endif
-
 	return (RendererFuncs *) rt;
 }