[gdk-pixbuf] Move density unit convesion macros into a common header. Fix conversion from dpcm to dpi
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] Move density unit convesion macros into a common header. Fix conversion from dpcm to dpi
- Date: Wed, 22 Oct 2014 15:38:27 +0000 (UTC)
commit c009067769567e235bd75da5514451467b805384
Author: Robert Ancell <robert ancell canonical com>
Date: Wed Oct 22 11:38:10 2014 -0400
Move density unit convesion macros into a common header. Fix conversion from dpcm to dpi
gdk-pixbuf/gdk-pixbuf-private.h | 6 ++++++
gdk-pixbuf/io-jpeg.c | 2 --
gdk-pixbuf/io-png.c | 3 ---
3 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gdk-pixbuf/gdk-pixbuf-private.h b/gdk-pixbuf/gdk-pixbuf-private.h
index e209694..e985459 100644
--- a/gdk-pixbuf/gdk-pixbuf-private.h
+++ b/gdk-pixbuf/gdk-pixbuf-private.h
@@ -45,6 +45,12 @@ 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))
+
/* Private part of the GdkPixbuf structure */
struct _GdkPixbuf {
GObject parent_instance;
diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c
index 5e266b6..c43aee6 100644
--- a/gdk-pixbuf/io-jpeg.c
+++ b/gdk-pixbuf/io-jpeg.c
@@ -46,8 +46,6 @@
/* we are a "source manager" as far as libjpeg is concerned */
#define JPEG_PROG_BUF_SIZE 65536
-#define DPCM_TO_DPI(value) ((int) round ((value) / 2.54))
-
typedef struct {
struct jpeg_source_mgr pub; /* public fields */
diff --git a/gdk-pixbuf/io-png.c b/gdk-pixbuf/io-png.c
index 35708e9..c1e6bcd 100644
--- a/gdk-pixbuf/io-png.c
+++ b/gdk-pixbuf/io-png.c
@@ -31,9 +31,6 @@
-#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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]