[gdk-pixbuf: 4/24] Move the macros to convert the DPI/DPM density units to where they are needed



commit a90b4e5bf43d62f9ea5ebd913b06716e52d4654f
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon May 14 17:44:11 2018 -0500

    Move the macros to convert the DPI/DPM density units to where they are needed
    
    We'll be removing gdk-pixbuf-private.h from io-*.c shortly.

 gdk-pixbuf/gdk-pixbuf-private.h | 6 ------
 gdk-pixbuf/io-jpeg.c            | 3 +++
 gdk-pixbuf/io-png.c             | 4 ++++
 gdk-pixbuf/io-tiff.c            | 3 +++
 4 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/gdk-pixbuf/gdk-pixbuf-private.h b/gdk-pixbuf/gdk-pixbuf-private.h
index fc63d8f90..79ccf1531 100644
--- a/gdk-pixbuf/gdk-pixbuf-private.h
+++ b/gdk-pixbuf/gdk-pixbuf-private.h
@@ -46,12 +46,6 @@ typedef struct _GdkPixbufClass GdkPixbufClass;
 #define GDK_IS_PIXBUF_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF))
 #define GDK_PIXBUF_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF, GdkPixbufClass))
 
-/* Helper macros to convert between density units */
-#define DPI_TO_DPM(value) ((int) round ((value) * 1000 / 25.4))
-#define DPI_TO_DPCM(value) ((int) round ((value) / 2.54))
-#define DPM_TO_DPI(value) ((int) round ((value) * 25.4 / 1000))
-#define DPCM_TO_DPI(value) ((int) round ((value) * 2.54))
-
 /* Default fill color */
 #define DEFAULT_FILL_COLOR 0x979899ff
 
diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c
index 8b94dbc0a..15c0d635f 100644
--- a/gdk-pixbuf/io-jpeg.c
+++ b/gdk-pixbuf/io-jpeg.c
@@ -44,6 +44,9 @@
 #endif
 
 
+/* Helper macros to convert between density units */
+#define DPCM_TO_DPI(value) ((int) round ((value) * 2.54))
+
 /* we are a "source manager" as far as libjpeg is concerned */
 #define JPEG_PROG_BUF_SIZE 65536
 
diff --git a/gdk-pixbuf/io-png.c b/gdk-pixbuf/io-png.c
index b039af678..ac1aa9a11 100644
--- a/gdk-pixbuf/io-png.c
+++ b/gdk-pixbuf/io-png.c
@@ -30,6 +30,10 @@
 #include "gdk-pixbuf-private.h"
 #include "fallback-c89.c"
 
+/* Helper macros to convert between density units */
+#define DPI_TO_DPM(value) ((int) round ((value) * 1000 / 25.4))
+#define DPM_TO_DPI(value) ((int) round ((value) * 25.4 / 1000))
+
 static gboolean
 setup_png_transformations(png_structp png_read_ptr, png_infop png_info_ptr,
                           GError **error,
diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c
index c25c28707..607d2e325 100644
--- a/gdk-pixbuf/io-tiff.c
+++ b/gdk-pixbuf/io-tiff.c
@@ -47,6 +47,9 @@
 #endif
 
 
+/* Helper macros to convert between density units */
+#define DPCM_TO_DPI(value) ((int) round ((value) * 2.54))
+
 typedef struct _TiffContext TiffContext;
 struct _TiffContext
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]