aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorKenichi Handa2012-10-11 20:29:47 +0900
committerKenichi Handa2012-10-11 20:29:47 +0900
commitd3e4228575e9ba9e99dc4a7dae788280ffcc4566 (patch)
tree97d35f3c0766372c166a31f3c0f7aba791a38dde /src/image.c
parentcde44a7728488ca6bc6a46c18d9c5e647b160547 (diff)
parentfd2f90cf5c6a15610aa1e17e73d6d8a5f8cb1999 (diff)
downloademacs-d3e4228575e9ba9e99dc4a7dae788280ffcc4566.tar.gz
emacs-d3e4228575e9ba9e99dc4a7dae788280ffcc4566.zip
merge trunk
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c80
1 files changed, 53 insertions, 27 deletions
diff --git a/src/image.c b/src/image.c
index 91eeb91920c..9b41cf74993 100644
--- a/src/image.c
+++ b/src/image.c
@@ -75,7 +75,12 @@ typedef struct x_bitmap_record Bitmap_Record;
75#endif /* HAVE_X_WINDOWS */ 75#endif /* HAVE_X_WINDOWS */
76 76
77#ifdef HAVE_NTGUI 77#ifdef HAVE_NTGUI
78#include "w32.h" 78
79/* We need (or want) w32.h only when we're _not_ compiling for Cygwin. */
80#ifdef WINDOWSNT
81# include "w32.h"
82#endif
83
79/* W32_TODO : Color tables on W32. */ 84/* W32_TODO : Color tables on W32. */
80#undef COLOR_TABLE_SUPPORT 85#undef COLOR_TABLE_SUPPORT
81 86
@@ -560,8 +565,9 @@ static struct image_type *lookup_image_type (Lisp_Object);
560static void x_laplace (struct frame *, struct image *); 565static void x_laplace (struct frame *, struct image *);
561static void x_emboss (struct frame *, struct image *); 566static void x_emboss (struct frame *, struct image *);
562static void x_build_heuristic_mask (struct frame *, struct image *, 567static void x_build_heuristic_mask (struct frame *, struct image *,
563 Lisp_Object); 568 Lisp_Object);
564#ifdef HAVE_NTGUI 569#ifdef WINDOWSNT
570extern Lisp_Object Vlibrary_cache;
565#define CACHE_IMAGE_TYPE(type, status) \ 571#define CACHE_IMAGE_TYPE(type, status) \
566 do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0) 572 do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0)
567#else 573#else
@@ -589,7 +595,7 @@ define_image_type (struct image_type *type)
589 595
590 if (type->init) 596 if (type->init)
591 { 597 {
592#ifdef HAVE_NTGUI 598#if defined HAVE_NTGUI && defined WINDOWSNT
593 /* If we failed to load the library before, don't try again. */ 599 /* If we failed to load the library before, don't try again. */
594 Lisp_Object tested = Fassq (target_type, Vlibrary_cache); 600 Lisp_Object tested = Fassq (target_type, Vlibrary_cache);
595 if (CONSP (tested) && NILP (XCDR (tested))) 601 if (CONSP (tested) && NILP (XCDR (tested)))
@@ -1834,7 +1840,7 @@ mark_image_cache (struct image_cache *c)
1834 X / NS / W32 support code 1840 X / NS / W32 support code
1835 ***********************************************************************/ 1841 ***********************************************************************/
1836 1842
1837#ifdef HAVE_NTGUI 1843#ifdef WINDOWSNT
1838 1844
1839/* Macro for defining functions that will be loaded from image DLLs. */ 1845/* Macro for defining functions that will be loaded from image DLLs. */
1840#define DEF_IMGLIB_FN(rettype,func,args) static rettype (FAR CDECL *fn_##func)args 1846#define DEF_IMGLIB_FN(rettype,func,args) static rettype (FAR CDECL *fn_##func)args
@@ -1845,7 +1851,7 @@ mark_image_cache (struct image_cache *c)
1845 if (!fn_##func) return 0; \ 1851 if (!fn_##func) return 0; \
1846 } 1852 }
1847 1853
1848#endif /* HAVE_NTGUI */ 1854#endif /* WINDOWSNT */
1849 1855
1850/* Return true if XIMG's size WIDTH x HEIGHT doesn't break the 1856/* Return true if XIMG's size WIDTH x HEIGHT doesn't break the
1851 windowing system. 1857 windowing system.
@@ -2897,7 +2903,7 @@ xbm_load (struct frame *f, struct image *img)
2897 else 2903 else
2898 bits = (char *) XBOOL_VECTOR (data)->data; 2904 bits = (char *) XBOOL_VECTOR (data)->data;
2899 2905
2900#ifdef WINDOWSNT 2906#ifdef HAVE_NTGUI
2901 { 2907 {
2902 char *invertedBits; 2908 char *invertedBits;
2903 int nbytes, i; 2909 int nbytes, i;
@@ -3008,7 +3014,7 @@ static const struct image_keyword xpm_format[XPM_LAST] =
3008 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} 3014 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
3009}; 3015};
3010 3016
3011#ifdef HAVE_NTGUI 3017#if defined HAVE_NTGUI && defined WINDOWSNT
3012static bool init_xpm_functions (void); 3018static bool init_xpm_functions (void);
3013#else 3019#else
3014#define init_xpm_functions NULL 3020#define init_xpm_functions NULL
@@ -3207,7 +3213,7 @@ xpm_free_colors (Display *dpy, Colormap cmap, Pixel *pixels, int npixels, void *
3207#endif /* ALLOC_XPM_COLORS */ 3213#endif /* ALLOC_XPM_COLORS */
3208 3214
3209 3215
3210#ifdef HAVE_NTGUI 3216#ifdef WINDOWSNT
3211 3217
3212/* XPM library details. */ 3218/* XPM library details. */
3213 3219
@@ -3233,8 +3239,15 @@ init_xpm_functions (void)
3233 return 1; 3239 return 1;
3234} 3240}
3235 3241
3236#endif /* HAVE_NTGUI */ 3242#endif /* WINDOWSNT */
3237 3243
3244#if defined HAVE_NTGUI && !defined WINDOWSNT
3245/* Glue for code below */
3246#define fn_XpmReadFileToImage XpmReadFileToImage
3247#define fn_XpmCreateImageFromBuffer XpmCreateImageFromBuffer
3248#define fn_XImageFree XImageFree
3249#define fn_XpmFreeAttributes XpmFreeAttributes
3250#endif /* HAVE_NTGUI && !WINDOWSNT */
3238 3251
3239/* Value is true if COLOR_SYMBOLS is a valid color symbols list 3252/* Value is true if COLOR_SYMBOLS is a valid color symbols list
3240 for XPM images. Such a list must consist of conses whose car and 3253 for XPM images. Such a list must consist of conses whose car and
@@ -5340,7 +5353,7 @@ static const struct image_keyword png_format[PNG_LAST] =
5340 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} 5353 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
5341}; 5354};
5342 5355
5343#ifdef HAVE_NTGUI 5356#if defined HAVE_NTGUI && defined WINDOWSNT
5344static bool init_png_functions (void); 5357static bool init_png_functions (void);
5345#else 5358#else
5346#define init_png_functions NULL 5359#define init_png_functions NULL
@@ -5378,7 +5391,7 @@ png_image_p (Lisp_Object object)
5378 5391
5379#ifdef HAVE_PNG 5392#ifdef HAVE_PNG
5380 5393
5381#ifdef HAVE_NTGUI 5394#ifdef WINDOWSNT
5382/* PNG library details. */ 5395/* PNG library details. */
5383 5396
5384DEF_IMGLIB_FN (png_voidp, png_get_io_ptr, (png_structp)); 5397DEF_IMGLIB_FN (png_voidp, png_get_io_ptr, (png_structp));
@@ -5478,7 +5491,7 @@ init_png_functions (void)
5478#define fn_png_set_longjmp_fn png_set_longjmp_fn 5491#define fn_png_set_longjmp_fn png_set_longjmp_fn
5479#endif /* libpng version >= 1.5 */ 5492#endif /* libpng version >= 1.5 */
5480 5493
5481#endif /* HAVE_NTGUI */ 5494#endif /* WINDOWSNT */
5482 5495
5483/* Possibly inefficient/inexact substitutes for _setjmp and _longjmp. 5496/* Possibly inefficient/inexact substitutes for _setjmp and _longjmp.
5484 Do not use sys_setjmp, as PNG supports only jmp_buf. The _longjmp 5497 Do not use sys_setjmp, as PNG supports only jmp_buf. The _longjmp
@@ -5999,7 +6012,7 @@ static const struct image_keyword jpeg_format[JPEG_LAST] =
5999 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} 6012 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
6000}; 6013};
6001 6014
6002#ifdef HAVE_NTGUI 6015#if defined HAVE_NTGUI && defined WINDOWSNT
6003static bool init_jpeg_functions (void); 6016static bool init_jpeg_functions (void);
6004#else 6017#else
6005#define init_jpeg_functions NULL 6018#define init_jpeg_functions NULL
@@ -6049,14 +6062,27 @@ jpeg_image_p (Lisp_Object object)
6049#define __WIN32__ 1 6062#define __WIN32__ 1
6050#endif 6063#endif
6051 6064
6065/* rpcndr.h (via windows.h) and jpeglib.h both define boolean types.
6066 Some versions of jpeglib try to detect whether rpcndr.h is loaded,
6067 using the Windows boolean type instead of the jpeglib boolean type
6068 if so. Cygwin jpeglib, however, doesn't try to detect whether its
6069 headers are included along with windows.h, so under Cygwin, jpeglib
6070 attempts to define a conflicting boolean type. Worse, forcing
6071 Cygwin jpeglib headers to use the Windows boolean type doesn't work
6072 because it created an ABI incompatibility between the
6073 already-compiled jpeg library and the header interface definition.
6074
6075 The best we can do is to define jpeglib's boolean type to a
6076 different name. This name, jpeg_boolean, remains in effect through
6077 the rest of image.c.
6078*/
6079#if defined CYGWIN && defined HAVE_NTGUI
6080#define boolean jpeg_boolean
6081#endif
6052#include <jpeglib.h> 6082#include <jpeglib.h>
6053#include <jerror.h> 6083#include <jerror.h>
6054 6084
6055#ifdef HAVE_STLIB_H_1 6085#ifdef WINDOWSNT
6056#define HAVE_STDLIB_H 1
6057#endif
6058
6059#ifdef HAVE_NTGUI
6060 6086
6061/* JPEG library details. */ 6087/* JPEG library details. */
6062DEF_IMGLIB_FN (void, jpeg_CreateDecompress, (j_decompress_ptr, int, size_t)); 6088DEF_IMGLIB_FN (void, jpeg_CreateDecompress, (j_decompress_ptr, int, size_t));
@@ -6106,7 +6132,7 @@ jpeg_resync_to_restart_wrapper (j_decompress_ptr cinfo, int desired)
6106#define fn_jpeg_std_error jpeg_std_error 6132#define fn_jpeg_std_error jpeg_std_error
6107#define jpeg_resync_to_restart_wrapper jpeg_resync_to_restart 6133#define jpeg_resync_to_restart_wrapper jpeg_resync_to_restart
6108 6134
6109#endif /* HAVE_NTGUI */ 6135#endif /* WINDOWSNT */
6110 6136
6111struct my_jpeg_error_mgr 6137struct my_jpeg_error_mgr
6112{ 6138{
@@ -6630,7 +6656,7 @@ tiff_image_p (Lisp_Object object)
6630 6656
6631#include <tiffio.h> 6657#include <tiffio.h>
6632 6658
6633#ifdef HAVE_NTGUI 6659#ifdef WINDOWSNT
6634 6660
6635/* TIFF library details. */ 6661/* TIFF library details. */
6636DEF_IMGLIB_FN (TIFFErrorHandler, TIFFSetErrorHandler, (TIFFErrorHandler)); 6662DEF_IMGLIB_FN (TIFFErrorHandler, TIFFSetErrorHandler, (TIFFErrorHandler));
@@ -6674,7 +6700,7 @@ init_tiff_functions (void)
6674#define fn_TIFFReadRGBAImage TIFFReadRGBAImage 6700#define fn_TIFFReadRGBAImage TIFFReadRGBAImage
6675#define fn_TIFFClose TIFFClose 6701#define fn_TIFFClose TIFFClose
6676#define fn_TIFFSetDirectory TIFFSetDirectory 6702#define fn_TIFFSetDirectory TIFFSetDirectory
6677#endif /* HAVE_NTGUI */ 6703#endif /* WINDOWSNT */
6678 6704
6679 6705
6680/* Reading from a memory buffer for TIFF images Based on the PNG 6706/* Reading from a memory buffer for TIFF images Based on the PNG
@@ -7046,7 +7072,7 @@ static const struct image_keyword gif_format[GIF_LAST] =
7046 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} 7072 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
7047}; 7073};
7048 7074
7049#ifdef HAVE_NTGUI 7075#if defined HAVE_NTGUI && defined WINDOWSNT
7050static bool init_gif_functions (void); 7076static bool init_gif_functions (void);
7051#else 7077#else
7052#define init_gif_functions NULL 7078#define init_gif_functions NULL
@@ -7110,7 +7136,7 @@ gif_image_p (Lisp_Object object)
7110#endif /* HAVE_NTGUI */ 7136#endif /* HAVE_NTGUI */
7111 7137
7112 7138
7113#ifdef HAVE_NTGUI 7139#ifdef WINDOWSNT
7114 7140
7115/* GIF library details. */ 7141/* GIF library details. */
7116DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *)); 7142DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *));
@@ -7140,7 +7166,7 @@ init_gif_functions (void)
7140#define fn_DGifOpen DGifOpen 7166#define fn_DGifOpen DGifOpen
7141#define fn_DGifOpenFileName DGifOpenFileName 7167#define fn_DGifOpenFileName DGifOpenFileName
7142 7168
7143#endif /* HAVE_NTGUI */ 7169#endif /* WINDOWSNT */
7144 7170
7145/* Reading a GIF image from memory 7171/* Reading a GIF image from memory
7146 Based on the PNG memory stuff to a certain extent. */ 7172 Based on the PNG memory stuff to a certain extent. */
@@ -8137,7 +8163,7 @@ svg_image_p (Lisp_Object object)
8137 8163
8138#include <librsvg/rsvg.h> 8164#include <librsvg/rsvg.h>
8139 8165
8140#ifdef HAVE_NTGUI 8166#ifdef WINDOWSNT
8141 8167
8142/* SVG library functions. */ 8168/* SVG library functions. */
8143DEF_IMGLIB_FN (RsvgHandle *, rsvg_handle_new); 8169DEF_IMGLIB_FN (RsvgHandle *, rsvg_handle_new);
@@ -8215,7 +8241,7 @@ init_svg_functions (void)
8215#define fn_g_type_init g_type_init 8241#define fn_g_type_init g_type_init
8216#define fn_g_object_unref g_object_unref 8242#define fn_g_object_unref g_object_unref
8217#define fn_g_error_free g_error_free 8243#define fn_g_error_free g_error_free
8218#endif /* !HAVE_NTGUI */ 8244#endif /* !WINDOWSNT */
8219 8245
8220/* Load SVG image IMG for use on frame F. Value is true if 8246/* Load SVG image IMG for use on frame F. Value is true if
8221 successful. */ 8247 successful. */