summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/io-jpeg.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdk-pixbuf/io-jpeg.c')
-rw-r--r--gdk-pixbuf/io-jpeg.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c
index 87c705c6c..f22b5070d 100644
--- a/gdk-pixbuf/io-jpeg.c
+++ b/gdk-pixbuf/io-jpeg.c
@@ -33,8 +33,8 @@
#include <jpeglib.h>
#include <jerror.h>
#include <math.h>
-
-#include "gdk-pixbuf-private.h"
+#include <glib/gi18n-lib.h>
+#include "gdk-pixbuf-io.h"
#include "fallback-c89.c"
#ifndef HAVE_SIGSETJMP
@@ -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
@@ -677,14 +680,14 @@ gdk_pixbuf__jpeg_image_load (FILE *f, GError **error)
g_free (icc_profile_base64);
}
- dptr = pixbuf->pixels;
+ dptr = gdk_pixbuf_get_pixels (pixbuf);
/* decompress all the lines, a few at a time */
while (cinfo.output_scanline < cinfo.output_height) {
lptr = lines;
for (i = 0; i < cinfo.rec_outbuf_height; i++) {
*lptr++ = dptr;
- dptr += pixbuf->rowstride;
+ dptr += gdk_pixbuf_get_rowstride (pixbuf);
}
jpeg_read_scanlines (&cinfo, lines, cinfo.rec_outbuf_height);
@@ -915,7 +918,7 @@ gdk_pixbuf__jpeg_image_load_lines (JpegProgContext *context,
rowptr = context->dptr;
for (i=0; i < cinfo->rec_outbuf_height; i++) {
*lptr++ = rowptr;
- rowptr += context->pixbuf->rowstride;
+ rowptr += gdk_pixbuf_get_rowstride (context->pixbuf);
}
nlines = jpeg_read_scanlines (cinfo, lines,
@@ -943,7 +946,7 @@ gdk_pixbuf__jpeg_image_load_lines (JpegProgContext *context,
return FALSE;
}
- context->dptr += (gsize)nlines * context->pixbuf->rowstride;
+ context->dptr += (gsize)nlines * gdk_pixbuf_get_rowstride (context->pixbuf);
/* send updated signal */
if (context->updated_func)
@@ -1182,7 +1185,7 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data,
/* Use pixbuf buffer to store decompressed data */
- context->dptr = context->pixbuf->pixels;
+ context->dptr = gdk_pixbuf_get_pixels (context->pixbuf);
/* Notify the client that we are ready to go */
if (context->prepared_func)
@@ -1227,7 +1230,7 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data,
if (!context->in_output) {
if (jpeg_start_output (cinfo, cinfo->input_scan_number)) {
context->in_output = TRUE;
- context->dptr = context->pixbuf->pixels;
+ context->dptr = gdk_pixbuf_get_pixels (context->pixbuf);
}
else
break;