aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorStefan Monnier2010-08-11 07:42:48 +0200
committerStefan Monnier2010-08-11 07:42:48 +0200
commitc566235d981eba73c88bbff00b6a1d88360b6e9f (patch)
treef8d653add3570fe750a83d1123ed35022e0bf4ef /src/image.c
parent0bfdb86f425a88fe43ebc88851c6f9a6418e1862 (diff)
parent490b89acab3e759426ede25c31c94268df55e925 (diff)
downloademacs-c566235d981eba73c88bbff00b6a1d88360b6e9f.tar.gz
emacs-c566235d981eba73c88bbff00b6a1d88360b6e9f.zip
Merge from trunk
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c95
1 files changed, 45 insertions, 50 deletions
diff --git a/src/image.c b/src/image.c
index 2ea70e221cf..916fcfe8178 100644
--- a/src/image.c
+++ b/src/image.c
@@ -126,6 +126,9 @@ typedef struct ns_bitmap_record Bitmap_Record;
126 126
127Lisp_Object Vx_bitmap_file_path; 127Lisp_Object Vx_bitmap_file_path;
128 128
129/* The symbol `postscript' identifying images of this type. */
130
131Lisp_Object Qpostscript;
129 132
130static void x_disable_image (struct frame *, struct image *); 133static void x_disable_image (struct frame *, struct image *);
131static void x_edge_detection (struct frame *, struct image *, Lisp_Object, 134static void x_edge_detection (struct frame *, struct image *, Lisp_Object,
@@ -578,9 +581,6 @@ Lisp_Object Qxbm;
578 581
579/* Keywords. */ 582/* Keywords. */
580 583
581extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile;
582extern Lisp_Object QCdata, QCtype;
583extern Lisp_Object Qcenter;
584Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data; 584Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data;
585Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask; 585Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask;
586Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask; 586Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask;
@@ -598,7 +598,7 @@ Lisp_Object Vimage_cache_eviction_delay;
598 598
599static Lisp_Object define_image_type (struct image_type *type, int loaded); 599static Lisp_Object define_image_type (struct image_type *type, int loaded);
600static struct image_type *lookup_image_type (Lisp_Object symbol); 600static struct image_type *lookup_image_type (Lisp_Object symbol);
601static void image_error (char *format, Lisp_Object, Lisp_Object); 601static void image_error (const char *format, Lisp_Object, Lisp_Object);
602static void x_laplace (struct frame *, struct image *); 602static void x_laplace (struct frame *, struct image *);
603static void x_emboss (struct frame *, struct image *); 603static void x_emboss (struct frame *, struct image *);
604static int x_build_heuristic_mask (struct frame *, struct image *, 604static int x_build_heuristic_mask (struct frame *, struct image *,
@@ -699,7 +699,7 @@ valid_image_p (Lisp_Object object)
699 therefore simply displays a message. */ 699 therefore simply displays a message. */
700 700
701static void 701static void
702image_error (char *format, Lisp_Object arg1, Lisp_Object arg2) 702image_error (const char *format, Lisp_Object arg1, Lisp_Object arg2)
703{ 703{
704 add_to_log (format, arg1, arg2); 704 add_to_log (format, arg1, arg2);
705} 705}
@@ -731,7 +731,7 @@ enum image_value_type
731struct image_keyword 731struct image_keyword
732{ 732{
733 /* Name of keyword. */ 733 /* Name of keyword. */
734 char *name; 734 const char *name;
735 735
736 /* The type of value allowed. */ 736 /* The type of value allowed. */
737 enum image_value_type type; 737 enum image_value_type type;
@@ -1759,8 +1759,6 @@ lookup_image (struct frame *f, Lisp_Object spec)
1759 /* If not found, create a new image and cache it. */ 1759 /* If not found, create a new image and cache it. */
1760 if (img == NULL) 1760 if (img == NULL)
1761 { 1761 {
1762 extern Lisp_Object Qpostscript;
1763
1764 BLOCK_INPUT; 1762 BLOCK_INPUT;
1765 img = make_image (spec, hash); 1763 img = make_image (spec, hash);
1766 cache_image (f, img); 1764 cache_image (f, img);
@@ -3661,9 +3659,10 @@ enum xpm_token
3661 length of the corresponding token, respectively. */ 3659 length of the corresponding token, respectively. */
3662 3660
3663static int 3661static int
3664xpm_scan (s, end, beg, len) 3662xpm_scan (const unsigned char **s,
3665 const unsigned char **s, *end, **beg; 3663 const unsigned char *end,
3666 int *len; 3664 const unsigned char **beg,
3665 int *len)
3667{ 3666{
3668 int c; 3667 int c;
3669 3668
@@ -3727,9 +3726,13 @@ xpm_scan (s, end, beg, len)
3727 hash table is used. */ 3726 hash table is used. */
3728 3727
3729static Lisp_Object 3728static Lisp_Object
3730xpm_make_color_table_v (put_func, get_func) 3729xpm_make_color_table_v (void (**put_func) (Lisp_Object,
3731 void (**put_func) (Lisp_Object, const unsigned char *, int, Lisp_Object); 3730 const unsigned char *,
3732 Lisp_Object (**get_func) (Lisp_Object, const unsigned char *, int); 3731 int,
3732 Lisp_Object),
3733 Lisp_Object (**get_func) (Lisp_Object,
3734 const unsigned char *,
3735 int))
3733{ 3736{
3734 *put_func = xpm_put_color_table_v; 3737 *put_func = xpm_put_color_table_v;
3735 *get_func = xpm_get_color_table_v; 3738 *get_func = xpm_get_color_table_v;
@@ -3737,28 +3740,30 @@ xpm_make_color_table_v (put_func, get_func)
3737} 3740}
3738 3741
3739static void 3742static void
3740xpm_put_color_table_v (color_table, chars_start, chars_len, color) 3743xpm_put_color_table_v (Lisp_Object color_table,
3741 Lisp_Object color_table; 3744 const unsigned char *chars_start,
3742 const unsigned char *chars_start; 3745 int chars_len,
3743 int chars_len; 3746 Lisp_Object color)
3744 Lisp_Object color;
3745{ 3747{
3746 XVECTOR (color_table)->contents[*chars_start] = color; 3748 XVECTOR (color_table)->contents[*chars_start] = color;
3747} 3749}
3748 3750
3749static Lisp_Object 3751static Lisp_Object
3750xpm_get_color_table_v (color_table, chars_start, chars_len) 3752xpm_get_color_table_v (Lisp_Object color_table,
3751 Lisp_Object color_table; 3753 const unsigned char *chars_start,
3752 const unsigned char *chars_start; 3754 int chars_len)
3753 int chars_len;
3754{ 3755{
3755 return XVECTOR (color_table)->contents[*chars_start]; 3756 return XVECTOR (color_table)->contents[*chars_start];
3756} 3757}
3757 3758
3758static Lisp_Object 3759static Lisp_Object
3759xpm_make_color_table_h (put_func, get_func) 3760xpm_make_color_table_h (void (**put_func) (Lisp_Object,
3760 void (**put_func) (Lisp_Object, const unsigned char *, int, Lisp_Object); 3761 const unsigned char *,
3761 Lisp_Object (**get_func) (Lisp_Object, const unsigned char *, int); 3762 int,
3763 Lisp_Object),
3764 Lisp_Object (**get_func) (Lisp_Object,
3765 const unsigned char *,
3766 int))
3762{ 3767{
3763 *put_func = xpm_put_color_table_h; 3768 *put_func = xpm_put_color_table_h;
3764 *get_func = xpm_get_color_table_h; 3769 *get_func = xpm_get_color_table_h;
@@ -3769,11 +3774,10 @@ xpm_make_color_table_h (put_func, get_func)
3769} 3774}
3770 3775
3771static void 3776static void
3772xpm_put_color_table_h (color_table, chars_start, chars_len, color) 3777xpm_put_color_table_h (Lisp_Object color_table,
3773 Lisp_Object color_table; 3778 const unsigned char *chars_start,
3774 const unsigned char *chars_start; 3779 int chars_len,
3775 int chars_len; 3780 Lisp_Object color)
3776 Lisp_Object color;
3777{ 3781{
3778 struct Lisp_Hash_Table *table = XHASH_TABLE (color_table); 3782 struct Lisp_Hash_Table *table = XHASH_TABLE (color_table);
3779 unsigned hash_code; 3783 unsigned hash_code;
@@ -3784,10 +3788,9 @@ xpm_put_color_table_h (color_table, chars_start, chars_len, color)
3784} 3788}
3785 3789
3786static Lisp_Object 3790static Lisp_Object
3787xpm_get_color_table_h (color_table, chars_start, chars_len) 3791xpm_get_color_table_h (Lisp_Object color_table,
3788 Lisp_Object color_table; 3792 const unsigned char *chars_start,
3789 const unsigned char *chars_start; 3793 int chars_len)
3790 int chars_len;
3791{ 3794{
3792 struct Lisp_Hash_Table *table = XHASH_TABLE (color_table); 3795 struct Lisp_Hash_Table *table = XHASH_TABLE (color_table);
3793 int i = hash_lookup (table, make_unibyte_string (chars_start, chars_len), 3796 int i = hash_lookup (table, make_unibyte_string (chars_start, chars_len),
@@ -3807,8 +3810,7 @@ enum xpm_color_key {
3807static const char xpm_color_key_strings[][4] = {"s", "m", "g4", "g", "c"}; 3810static const char xpm_color_key_strings[][4] = {"s", "m", "g4", "g", "c"};
3808 3811
3809static int 3812static int
3810xpm_str_to_color_key (s) 3813xpm_str_to_color_key (const char *s)
3811 const char *s;
3812{ 3814{
3813 int i; 3815 int i;
3814 3816
@@ -3821,10 +3823,10 @@ xpm_str_to_color_key (s)
3821} 3823}
3822 3824
3823static int 3825static int
3824xpm_load_image (f, img, contents, end) 3826xpm_load_image (struct frame *f,
3825 struct frame *f; 3827 struct image *img,
3826 struct image *img; 3828 const unsigned char *contents,
3827 const unsigned char *contents, *end; 3829 const unsigned char *end)
3828{ 3830{
3829 const unsigned char *s = contents, *beg, *str; 3831 const unsigned char *s = contents, *beg, *str;
3830 unsigned char buffer[BUFSIZ]; 3832 unsigned char buffer[BUFSIZ];
@@ -4056,9 +4058,8 @@ xpm_load_image (f, img, contents, end)
4056} 4058}
4057 4059
4058static int 4060static int
4059xpm_load (f, img) 4061xpm_load (struct frame *f,
4060 struct frame *f; 4062 struct image *img)
4061 struct image *img;
4062{ 4063{
4063 int success_p = 0; 4064 int success_p = 0;
4064 Lisp_Object file_name; 4065 Lisp_Object file_name;
@@ -7742,10 +7743,6 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. *
7742#define HAVE_GHOSTSCRIPT 1 7743#define HAVE_GHOSTSCRIPT 1
7743#endif /* HAVE_X_WINDOWS */ 7744#endif /* HAVE_X_WINDOWS */
7744 7745
7745/* The symbol `postscript' identifying images of this type. */
7746
7747Lisp_Object Qpostscript;
7748
7749#ifdef HAVE_GHOSTSCRIPT 7746#ifdef HAVE_GHOSTSCRIPT
7750 7747
7751static int gs_image_p (Lisp_Object object); 7748static int gs_image_p (Lisp_Object object);
@@ -8133,8 +8130,6 @@ of `image-library-alist', which see). */)
8133void 8130void
8134syms_of_image (void) 8131syms_of_image (void)
8135{ 8132{
8136 extern Lisp_Object Qrisky_local_variable; /* Syms_of_xdisp has already run. */
8137
8138 /* Initialize this only once, since that's what we do with Vimage_types 8133 /* Initialize this only once, since that's what we do with Vimage_types
8139 and they are supposed to be in sync. Initializing here gives correct 8134 and they are supposed to be in sync. Initializing here gives correct
8140 operation on GNU/Linux of calling dump-emacs after loading some images. */ 8135 operation on GNU/Linux of calling dump-emacs after loading some images. */