diff options
author | Matthias Clasen <matthiasc@src.gnome.org> | 2004-09-13 23:34:34 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2004-09-13 23:34:34 +0000 |
commit | 01743e7235b1840bb2ce04ba35afbd766b10c122 (patch) | |
tree | 2343542b7b7d9af2fc632a390b460bc2ad619240 /gdk-pixbuf/io-jpeg.c | |
parent | 221233a981fddd4fb1b3dd931e9257de0365e2d6 (diff) | |
download | gtk+-01743e7235b1840bb2ce04ba35afbd766b10c122.tar.gz |
Handle 4-channel pixbufs when saving to jpeg.
Diffstat (limited to 'gdk-pixbuf/io-jpeg.c')
-rw-r--r-- | gdk-pixbuf/io-jpeg.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c index 1a42feeb6b..1bf4bede11 100644 --- a/gdk-pixbuf/io-jpeg.c +++ b/gdk-pixbuf/io-jpeg.c @@ -872,6 +872,7 @@ real_save_jpeg (GdkPixbuf *pixbuf, int i, j; int w, h = 0; int rowstride = 0; + int n_channels; struct error_handler_data jerr; ToFunctionDestinationManager to_callback_destmgr; @@ -922,6 +923,7 @@ real_save_jpeg (GdkPixbuf *pixbuf, } rowstride = gdk_pixbuf_get_rowstride (pixbuf); + n_channels = gdk_pixbuf_get_n_channels (pixbuf); w = gdk_pixbuf_get_width (pixbuf); h = gdk_pixbuf_get_height (pixbuf); @@ -994,7 +996,7 @@ real_save_jpeg (GdkPixbuf *pixbuf, while (cinfo.next_scanline < cinfo.image_height) { /* convert scanline from ARGB to RGB packed */ for (j = 0; j < w; j++) - memcpy (&(buf[j*3]), &(ptr[i*rowstride + j*3]), 3); + memcpy (&(buf[j*3]), &(ptr[i*rowstride + j*n_channels]), 3); /* write scanline */ jbuf = (JSAMPROW *)(&buf); |