comparison src/glyphs-x.c @ 267:966663fcf606 r20-5b32

Import from CVS: tag r20-5b32
author cvs
date Mon, 13 Aug 2007 10:26:29 +0200
parents 8efd647ea9ca
children b2472a1930f2
comparison
equal deleted inserted replaced
266:18d185df8c54 267:966663fcf606
96 96
97 #ifdef HAVE_XPM 97 #ifdef HAVE_XPM
98 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xpm); 98 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xpm);
99 Lisp_Object Qxpm; 99 Lisp_Object Qxpm;
100 Lisp_Object Q_color_symbols; 100 Lisp_Object Q_color_symbols;
101 void mswindows_xpm_instantiate (Lisp_Object image_instance,
102 Lisp_Object instantiator,
103 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
104 int dest_mask, Lisp_Object domain);
101 #endif 105 #endif
102 106
103 #ifdef HAVE_XFACE 107 #ifdef HAVE_XFACE
104 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xface); 108 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xface);
105 Lisp_Object Qxface; 109 Lisp_Object Qxface;
1616 Lisp_Object color_symbol_alist = find_keyword_in_vector (instantiator, 1620 Lisp_Object color_symbol_alist = find_keyword_in_vector (instantiator,
1617 Q_color_symbols); 1621 Q_color_symbols);
1618 enum image_instance_type type; 1622 enum image_instance_type type;
1619 int force_mono; 1623 int force_mono;
1620 unsigned int w, h; 1624 unsigned int w, h;
1625 #ifdef HAVE_MS_WINDOWS
1626 if (DEVICE_MSWINDOWS_P (XDEVICE (device)))
1627 return mswindows_xpm_instantiate(image_instance, instantiator,
1628 pointer_fg, pointer_bg,
1629 dest_mask, domain);
1630 #endif
1621 1631
1622 if (!DEVICE_X_P (XDEVICE (device))) 1632 if (!DEVICE_X_P (XDEVICE (device)))
1623 signal_simple_error ("Not an X device", device); 1633 signal_simple_error ("Not an X device", device);
1624 1634
1625 dpy = DEVICE_X_DISPLAY (XDEVICE (device)); 1635 dpy = DEVICE_X_DISPLAY (XDEVICE (device));
2152 2162
2153 /* Return control to the setjmp point */ 2163 /* Return control to the setjmp point */
2154 longjmp (myerr->setjmp_buffer, 1); 2164 longjmp (myerr->setjmp_buffer, 1);
2155 } 2165 }
2156 2166
2167 #if defined(JPEG_LIB_VERSION) && (JPEG_LIB_VERSION >= 61)
2168 METHODDEF(void)
2169 #else
2170 METHODDEF void
2171 #endif
2172 my_jpeg_output_message (j_common_ptr cinfo)
2173 {
2174 char buffer[JMSG_LENGTH_MAX];
2175
2176 /* Create the message */
2177 (*cinfo->err->format_message) (cinfo, buffer);
2178 warn_when_safe (Qjpeg, Qinfo, "%s", buffer);
2179 }
2180
2157 /* The code in this routine is based on example.c from the JPEG library 2181 /* The code in this routine is based on example.c from the JPEG library
2158 source code and from gif_instantiate() */ 2182 source code and from gif_instantiate() */
2159 static void 2183 static void
2160 jpeg_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, 2184 jpeg_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
2161 Lisp_Object pointer_fg, Lisp_Object pointer_bg, 2185 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
2224 /* Step 1: allocate and initialize JPEG decompression object */ 2248 /* Step 1: allocate and initialize JPEG decompression object */
2225 2249
2226 /* We set up the normal JPEG error routines, then override error_exit. */ 2250 /* We set up the normal JPEG error routines, then override error_exit. */
2227 cinfo.err = jpeg_std_error (&jerr.pub); 2251 cinfo.err = jpeg_std_error (&jerr.pub);
2228 jerr.pub.error_exit = my_jpeg_error_exit; 2252 jerr.pub.error_exit = my_jpeg_error_exit;
2253 jerr.pub.output_message = my_jpeg_output_message;
2229 2254
2230 /* Establish the setjmp return context for my_error_exit to use. */ 2255 /* Establish the setjmp return context for my_error_exit to use. */
2231 if (setjmp (jerr.setjmp_buffer)) 2256 if (setjmp (jerr.setjmp_buffer))
2232 { 2257 {
2233 /* If we get here, the JPEG code has signaled an error. 2258 /* If we get here, the JPEG code has signaled an error.
2256 #ifdef USE_TEMP_FILES_FOR_JPEG_IMAGES 2281 #ifdef USE_TEMP_FILES_FOR_JPEG_IMAGES
2257 jpeg_stdio_src (&cinfo, unwind.instream); 2282 jpeg_stdio_src (&cinfo, unwind.instream);
2258 #else 2283 #else
2259 { 2284 {
2260 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); 2285 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
2261 Extbyte *bytes; 2286 CONST Extbyte *bytes;
2262 Extcount len; 2287 Extcount len;
2263 2288
2264 /* #### This is a definite problem under Mule due to the amount of 2289 /* #### This is a definite problem under Mule due to the amount of
2265 stack data it might allocate. Need to be able to convert and 2290 stack data it might allocate. Need to be able to convert and
2266 write out to a file. */ 2291 write out to a file. */
3585 unwind.cmap = cmap; 3610 unwind.cmap = cmap;
3586 record_unwind_protect (tiff_instantiate_unwind, make_opaque_ptr (&unwind)); 3611 record_unwind_protect (tiff_instantiate_unwind, make_opaque_ptr (&unwind));
3587 3612
3588 /* set up error facilities */ 3613 /* set up error facilities */
3589 if (setjmp(tiff_err_data.setjmp_buffer)) { 3614 if (setjmp(tiff_err_data.setjmp_buffer)) {
3590 /* An error was signaled. No clean up is needed, as unwind handles that 3615 /* An error was signaled. No clean up is needed, as unwind handles that
3591 for us. Just pass the error along. */ 3616 for us. Just pass the error along. */
3592 Lisp_Object errstring; 3617 signal_simple_error_2 ("TIFF decoding error",
3593 errstring = build_string (tiff_err_data.err_str); 3618 build_string(tiff_err_data.err_str),
3594 signal_simple_error_2 ("TIFF decoding error", errstring, instantiator); 3619 instantiator);
3595 } 3620 }
3596 TIFFSetErrorHandler((TIFFErrorHandler)tiff_error_func); 3621 TIFFSetErrorHandler((TIFFErrorHandler)tiff_error_func);
3597 TIFFSetWarningHandler((TIFFErrorHandler)tiff_warning_func); 3622 TIFFSetWarningHandler((TIFFErrorHandler)tiff_warning_func);
3598 { 3623 {
3599 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); 3624 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);