Fix #603, 971: lcms2 support broken / images with embedded color profile
authorColin Clark <colin.clark@cclark.uk>
Wed, 29 Jun 2022 09:05:03 +0000 (10:05 +0100)
committerColin Clark <colin.clark@cclark.uk>
Wed, 29 Jun 2022 09:05:03 +0000 (10:05 +0100)
https://github.com/BestImageViewer/geeqie/issues/603
https://github.com/BestImageViewer/geeqie/issues/971

The problem occurs when the screen scale factor is != 1

src/color-man.c
src/ui_fileops.c
src/ui_fileops.h

index 1c8c47a..dda2e2c 100644 (file)
@@ -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);
 
index 2c35490..3e3601a 100644 (file)
@@ -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: */
index 0122467..5d48b45 100644 (file)
@@ -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: */