… | |
… | |
4 | |
4 | |
5 | #include <string.h> |
5 | #include <string.h> |
6 | #include <setjmp.h> |
6 | #include <setjmp.h> |
7 | |
7 | |
8 | #include <jpeglib.h> |
8 | #include <jpeglib.h> |
|
|
9 | #include <glib.h> |
|
|
10 | #include <gtk/gtk.h> |
9 | #include <gdk-pixbuf/gdk-pixbuf.h> |
11 | #include <gdk-pixbuf/gdk-pixbuf.h> |
10 | |
12 | |
11 | #include <gperl.h> |
13 | #include <gperl.h> |
12 | #include <gtk2perl.h> |
14 | #include <gtk2perl.h> |
13 | |
15 | |
… | |
… | |
186 | } |
188 | } |
187 | OUTPUT: |
189 | OUTPUT: |
188 | RETVAL |
190 | RETVAL |
189 | |
191 | |
190 | GdkPixbuf_noinc * |
192 | GdkPixbuf_noinc * |
191 | load_jpeg (char *path, int thumbnail=0) |
193 | load_jpeg (SV *path, int thumbnail=0) |
192 | CODE: |
194 | CODE: |
193 | { |
195 | { |
194 | struct jpeg_decompress_struct cinfo; |
196 | struct jpeg_decompress_struct cinfo; |
195 | struct jpg_err_mgr jerr; |
197 | struct jpg_err_mgr jerr; |
196 | guchar *data; |
198 | guchar *data; |
197 | int rs; |
199 | int rs; |
198 | FILE *fp; |
200 | FILE *fp; |
199 | volatile GdkPixbuf *pb = 0; |
201 | volatile GdkPixbuf *pb = 0; |
|
|
202 | gchar *filename; |
|
|
203 | |
200 | RETVAL = 0; |
204 | RETVAL = 0; |
201 | |
205 | |
202 | if (!(fp = fopen (path, "rb"))) |
206 | filename = g_filename_from_utf8 (SvPVutf8_nolen (path), -1, 0, 0, 0); |
|
|
207 | fp = fopen (filename, "rb"); |
|
|
208 | g_free (filename); |
|
|
209 | |
|
|
210 | if (!fp) |
203 | XSRETURN_UNDEF; |
211 | XSRETURN_UNDEF; |
204 | |
212 | |
205 | cinfo.err = jpeg_std_error (&jerr.err); |
213 | cinfo.err = jpeg_std_error (&jerr.err); |
206 | |
214 | |
207 | jerr.err.error_exit = cv_error_exit; |
215 | jerr.err.error_exit = cv_error_exit; |