From: Colin Clark Date: Wed, 29 Jun 2022 09:05:03 +0000 (+0100) Subject: Fix #603, 971: lcms2 support broken / images with embedded color profile X-Git-Tag: gtk2final~3 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=1007a04859748380929cbab58dbf9afec6b7164a Fix #603, 971: lcms2 support broken / images with embedded color profile https://github.com/BestImageViewer/geeqie/issues/603 https://github.com/BestImageViewer/geeqie/issues/971 The problem occurs when the screen scale factor is != 1 --- diff --git a/src/color-man.c b/src/color-man.c index 1c8c47a3..dda2e2c7 100644 --- a/src/color-man.c +++ b/src/color-man.c @@ -316,6 +316,13 @@ void color_man_correct_region(ColorMan *cm, GdkPixbuf *pixbuf, gint x, gint y, g pix = gdk_pixbuf_get_pixels(pixbuf); rs = gdk_pixbuf_get_rowstride(pixbuf); + /** @FIXME: x,y expected to be = 0. Maybe this is not the right place for scaling */ + if (!options->image.use_clutter_renderer) + { + w = w * scale_factor(); + h = h * scale_factor(); + } + w = MIN(w, pixbuf_width - x); h = MIN(h, pixbuf_height - y); diff --git a/src/ui_fileops.c b/src/ui_fileops.c index 2c35490d..3e3601ac 100644 --- a/src/ui_fileops.c +++ b/src/ui_fileops.c @@ -1163,4 +1163,22 @@ gboolean rmdir_recursive(GFile *file, GCancellable *cancellable, GError **error) return g_file_delete(file, cancellable, error); } +/** + * @brief Retrieves the internal scale factor that maps from window coordinates to the actual device pixels + * @param - + * @returns scale factor + * + * + */ +gint scale_factor() +{ + LayoutWindow *lw = NULL; + +#if GTK_CHECK_VERSION(3, 10, 0) + layout_valid(&lw); + return gtk_widget_get_scale_factor(lw->window); +#else + return 1; +#endif +} /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ diff --git a/src/ui_fileops.h b/src/ui_fileops.h index 0122467b..5d48b45d 100644 --- a/src/ui_fileops.h +++ b/src/ui_fileops.h @@ -119,5 +119,7 @@ gboolean md5_get_digest_from_file_utf8(const gchar *path, guchar digest[16]); gboolean download_web_file(const gchar *text, gboolean minimized, gpointer data); gboolean rmdir_recursive(GFile *file, GCancellable *cancellable, GError **error); +gint scale_factor(); + #endif /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */