diff options
| author | Stefan Monnier | 2008-02-22 17:42:09 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-02-22 17:42:09 +0000 |
| commit | 354884c46ee708a22b0372d2092256408b485c8d (patch) | |
| tree | 03802c0c4e44d3ecd4b096cada74b8abf811ce29 /src | |
| parent | c2e426903cfd93202e302471a6e1b265a08e8368 (diff) | |
| download | emacs-354884c46ee708a22b0372d2092256408b485c8d.tar.gz emacs-354884c46ee708a22b0372d2092256408b485c8d.zip | |
Consolidate the image_cache to the terminal struct.
* termhooks.h (P_): Remove redundant def.
(struct terminal): New field `image_cache'.
* frame.h (FRAME_IMAGE_CACHE): New macro. Use it everywhere in place
of FRAME_X_IMAGE_CACHE.
* xterm.h (struct x_display_info): Remove image_cache field.
(FRAME_X_IMAGE_CACHE): Remove. Use FRAME_IMAGE_CACHE instead.
* w32term.h (struct w32_display_info): Remove image_cache field.
(FRAME_X_IMAGE_CACHE): Remove. Use FRAME_IMAGE_CACHE instead.
* macterm.h (struct mac_display_info): Remove image_cache field.
(FRAME_X_IMAGE_CACHE): Remove. Use FRAME_IMAGE_CACHE instead.
* xterm.c (x_term_init):
* w32term.c (w32_term_init):
* macterm.c (mac_term_init): Set the image_cache in the terminal.
* dispextern.h (clear_image_cache, forall_images_in_image_cache):
Remove declarations.
(clear_image_caches, mark_image_cache): New declarations.
* xfaces.c (clear_face_cache):
* xdisp.c (redisplay_internal): Use clear_image_caches.
* image.c (clear_image_cache): Don't check that a frame is on
a window-system before checking if it shares the same cache.
(clear_image_caches): New function.
(Fclear_image_cache): Use it.
(mark_image): Move from allo.c.
(mark_image_cache): Move from alloc.c and forall_images_in_image_cache.
* alloc.c (mark_image, mark_image_cache): Move to image.c.
(mark_object): Don't call mark_image_cache for frames.
(mark_terminals): Call mark_image_cache.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 29 | ||||
| -rw-r--r-- | src/alloc.c | 40 | ||||
| -rw-r--r-- | src/dispextern.h | 9 | ||||
| -rw-r--r-- | src/frame.h | 3 | ||||
| -rw-r--r-- | src/image.c | 70 | ||||
| -rw-r--r-- | src/macfns.c | 4 | ||||
| -rw-r--r-- | src/macterm.c | 2 | ||||
| -rw-r--r-- | src/macterm.h | 8 | ||||
| -rw-r--r-- | src/termhooks.h | 10 | ||||
| -rw-r--r-- | src/w32fns.c | 2 | ||||
| -rw-r--r-- | src/w32term.c | 2 | ||||
| -rw-r--r-- | src/w32term.h | 8 | ||||
| -rw-r--r-- | src/xdisp.c | 8 | ||||
| -rw-r--r-- | src/xfaces.c | 13 | ||||
| -rw-r--r-- | src/xfns.c | 4 | ||||
| -rw-r--r-- | src/xterm.c | 2 | ||||
| -rw-r--r-- | src/xterm.h | 8 |
17 files changed, 101 insertions, 121 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c71b748a018..2f70d3be552 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,34 @@ | |||
| 1 | 2008-02-22 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2008-02-22 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | Consolidate the image_cache to the terminal struct. | ||
| 4 | * termhooks.h (P_): Remove redundant def. | ||
| 5 | (struct terminal): New field `image_cache'. | ||
| 6 | * frame.h (FRAME_IMAGE_CACHE): New macro. Use it everywhere in place | ||
| 7 | of FRAME_X_IMAGE_CACHE. | ||
| 8 | * xterm.h (struct x_display_info): Remove image_cache field. | ||
| 9 | (FRAME_X_IMAGE_CACHE): Remove. Use FRAME_IMAGE_CACHE instead. | ||
| 10 | * w32term.h (struct w32_display_info): Remove image_cache field. | ||
| 11 | (FRAME_X_IMAGE_CACHE): Remove. Use FRAME_IMAGE_CACHE instead. | ||
| 12 | * macterm.h (struct mac_display_info): Remove image_cache field. | ||
| 13 | (FRAME_X_IMAGE_CACHE): Remove. Use FRAME_IMAGE_CACHE instead. | ||
| 14 | * xterm.c (x_term_init): | ||
| 15 | * w32term.c (w32_term_init): | ||
| 16 | * macterm.c (mac_term_init): Set the image_cache in the terminal. | ||
| 17 | * dispextern.h (clear_image_cache, forall_images_in_image_cache): | ||
| 18 | Remove declarations. | ||
| 19 | (clear_image_caches, mark_image_cache): New declarations. | ||
| 20 | * xfaces.c (clear_face_cache): | ||
| 21 | * xdisp.c (redisplay_internal): Use clear_image_caches. | ||
| 22 | * image.c (clear_image_cache): Don't check that a frame is on | ||
| 23 | a window-system before checking if it shares the same cache. | ||
| 24 | (clear_image_caches): New function. | ||
| 25 | (Fclear_image_cache): Use it. | ||
| 26 | (mark_image): Move from allo.c. | ||
| 27 | (mark_image_cache): Move from alloc.c and forall_images_in_image_cache. | ||
| 28 | * alloc.c (mark_image, mark_image_cache): Move to image.c. | ||
| 29 | (mark_object): Don't call mark_image_cache for frames. | ||
| 30 | (mark_terminals): Call mark_image_cache. | ||
| 31 | |||
| 3 | * lisp.h (Fdelete_terminal): Declare. | 32 | * lisp.h (Fdelete_terminal): Declare. |
| 4 | 33 | ||
| 5 | * charset.h (CHECK_CHARSET, CHECK_CHARSET_GET_ID) | 34 | * charset.h (CHECK_CHARSET, CHECK_CHARSET_GET_ID) |
diff --git a/src/alloc.c b/src/alloc.c index 68fc5d9d2a7..fe37eec9379 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -353,8 +353,6 @@ static void mark_face_cache P_ ((struct face_cache *)); | |||
| 353 | 353 | ||
| 354 | #ifdef HAVE_WINDOW_SYSTEM | 354 | #ifdef HAVE_WINDOW_SYSTEM |
| 355 | extern void mark_fringe_data P_ ((void)); | 355 | extern void mark_fringe_data P_ ((void)); |
| 356 | static void mark_image P_ ((struct image *)); | ||
| 357 | static void mark_image_cache P_ ((struct frame *)); | ||
| 358 | #endif /* HAVE_WINDOW_SYSTEM */ | 356 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 359 | 357 | ||
| 360 | static struct Lisp_String *allocate_string P_ ((void)); | 358 | static struct Lisp_String *allocate_string P_ ((void)); |
| @@ -5324,34 +5322,6 @@ mark_face_cache (c) | |||
| 5324 | } | 5322 | } |
| 5325 | 5323 | ||
| 5326 | 5324 | ||
| 5327 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 5328 | |||
| 5329 | /* Mark Lisp objects in image IMG. */ | ||
| 5330 | |||
| 5331 | static void | ||
| 5332 | mark_image (img) | ||
| 5333 | struct image *img; | ||
| 5334 | { | ||
| 5335 | mark_object (img->spec); | ||
| 5336 | |||
| 5337 | if (!NILP (img->data.lisp_val)) | ||
| 5338 | mark_object (img->data.lisp_val); | ||
| 5339 | } | ||
| 5340 | |||
| 5341 | |||
| 5342 | /* Mark Lisp objects in image cache of frame F. It's done this way so | ||
| 5343 | that we don't have to include xterm.h here. */ | ||
| 5344 | |||
| 5345 | static void | ||
| 5346 | mark_image_cache (f) | ||
| 5347 | struct frame *f; | ||
| 5348 | { | ||
| 5349 | forall_images_in_image_cache (f, mark_image); | ||
| 5350 | } | ||
| 5351 | |||
| 5352 | #endif /* HAVE_X_WINDOWS */ | ||
| 5353 | |||
| 5354 | |||
| 5355 | 5325 | ||
| 5356 | /* Mark reference to a Lisp_Object. | 5326 | /* Mark reference to a Lisp_Object. |
| 5357 | If the object referred to has not been seen yet, recursively mark | 5327 | If the object referred to has not been seen yet, recursively mark |
| @@ -5520,12 +5490,7 @@ mark_object (arg) | |||
| 5520 | { | 5490 | { |
| 5521 | register struct frame *ptr = XFRAME (obj); | 5491 | register struct frame *ptr = XFRAME (obj); |
| 5522 | if (mark_vectorlike (XVECTOR (obj))) | 5492 | if (mark_vectorlike (XVECTOR (obj))) |
| 5523 | { | 5493 | mark_face_cache (ptr->face_cache); |
| 5524 | mark_face_cache (ptr->face_cache); | ||
| 5525 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 5526 | mark_image_cache (ptr); | ||
| 5527 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 5528 | } | ||
| 5529 | } | 5494 | } |
| 5530 | else if (WINDOWP (obj)) | 5495 | else if (WINDOWP (obj)) |
| 5531 | { | 5496 | { |
| @@ -5760,6 +5725,9 @@ mark_terminals (void) | |||
| 5760 | for (t = terminal_list; t; t = t->next_terminal) | 5725 | for (t = terminal_list; t; t = t->next_terminal) |
| 5761 | { | 5726 | { |
| 5762 | eassert (t->name != NULL); | 5727 | eassert (t->name != NULL); |
| 5728 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 5729 | mark_image_cache (t->image_cache); | ||
| 5730 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 5763 | mark_vectorlike ((struct Lisp_Vector *)t); | 5731 | mark_vectorlike ((struct Lisp_Vector *)t); |
| 5764 | } | 5732 | } |
| 5765 | } | 5733 | } |
diff --git a/src/dispextern.h b/src/dispextern.h index daca52590b0..9e0e160c5bb 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2547,8 +2547,8 @@ struct image_cache | |||
| 2547 | no image with that id exists. */ | 2547 | no image with that id exists. */ |
| 2548 | 2548 | ||
| 2549 | #define IMAGE_FROM_ID(F, ID) \ | 2549 | #define IMAGE_FROM_ID(F, ID) \ |
| 2550 | (((ID) >= 0 && (ID) < (FRAME_X_IMAGE_CACHE (F)->used)) \ | 2550 | (((ID) >= 0 && (ID) < (FRAME_IMAGE_CACHE (F)->used)) \ |
| 2551 | ? FRAME_X_IMAGE_CACHE (F)->images[ID] \ | 2551 | ? FRAME_IMAGE_CACHE (F)->images[ID] \ |
| 2552 | : NULL) | 2552 | : NULL) |
| 2553 | 2553 | ||
| 2554 | /* Size of bucket vector of image caches. Should be prime. */ | 2554 | /* Size of bucket vector of image caches. Should be prime. */ |
| @@ -2818,9 +2818,8 @@ extern Lisp_Object x_find_image_file P_ ((Lisp_Object)); | |||
| 2818 | void x_kill_gs_process P_ ((Pixmap, struct frame *)); | 2818 | void x_kill_gs_process P_ ((Pixmap, struct frame *)); |
| 2819 | struct image_cache *make_image_cache P_ ((void)); | 2819 | struct image_cache *make_image_cache P_ ((void)); |
| 2820 | void free_image_cache P_ ((struct frame *)); | 2820 | void free_image_cache P_ ((struct frame *)); |
| 2821 | void clear_image_cache P_ ((struct frame *, int)); | 2821 | void clear_image_caches P_ ((int)); |
| 2822 | void forall_images_in_image_cache P_ ((struct frame *, | 2822 | void mark_image_cache P_ ((struct image_cache *)); |
| 2823 | void (*) P_ ((struct image *)))); | ||
| 2824 | int valid_image_p P_ ((Lisp_Object)); | 2823 | int valid_image_p P_ ((Lisp_Object)); |
| 2825 | void prepare_image_for_display P_ ((struct frame *, struct image *)); | 2824 | void prepare_image_for_display P_ ((struct frame *, struct image *)); |
| 2826 | int lookup_image P_ ((struct frame *, Lisp_Object)); | 2825 | int lookup_image P_ ((struct frame *, Lisp_Object)); |
diff --git a/src/frame.h b/src/frame.h index b0b7cc383d3..3b5a27f78a8 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -484,6 +484,9 @@ struct frame | |||
| 484 | #define FRAME_KBOARD(f) (&the_only_kboard) | 484 | #define FRAME_KBOARD(f) (&the_only_kboard) |
| 485 | #endif | 485 | #endif |
| 486 | 486 | ||
| 487 | /* Return a pointer to the image cache of frame F. */ | ||
| 488 | #define FRAME_IMAGE_CACHE(F) ((F)->terminal->image_cache) | ||
| 489 | |||
| 487 | typedef struct frame *FRAME_PTR; | 490 | typedef struct frame *FRAME_PTR; |
| 488 | 491 | ||
| 489 | #define XFRAME(p) (eassert (FRAMEP(p)),(struct frame *) XPNTR (p)) | 492 | #define XFRAME(p) (eassert (FRAMEP(p)),(struct frame *) XPNTR (p)) |
diff --git a/src/image.c b/src/image.c index 04fda4f88a8..7833b8473d6 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1207,7 +1207,7 @@ free_image (f, img) | |||
| 1207 | { | 1207 | { |
| 1208 | if (img) | 1208 | if (img) |
| 1209 | { | 1209 | { |
| 1210 | struct image_cache *c = FRAME_X_IMAGE_CACHE (f); | 1210 | struct image_cache *c = FRAME_IMAGE_CACHE (f); |
| 1211 | 1211 | ||
| 1212 | /* Remove IMG from the hash table of its cache. */ | 1212 | /* Remove IMG from the hash table of its cache. */ |
| 1213 | if (img->prev) | 1213 | if (img->prev) |
| @@ -1642,7 +1642,7 @@ search_image_cache (f, spec, hash) | |||
| 1642 | unsigned hash; | 1642 | unsigned hash; |
| 1643 | { | 1643 | { |
| 1644 | struct image *img; | 1644 | struct image *img; |
| 1645 | struct image_cache *c = FRAME_X_IMAGE_CACHE (f); | 1645 | struct image_cache *c = FRAME_IMAGE_CACHE (f); |
| 1646 | int i = hash % IMAGE_CACHE_BUCKETS_SIZE; | 1646 | int i = hash % IMAGE_CACHE_BUCKETS_SIZE; |
| 1647 | 1647 | ||
| 1648 | if (!c) return NULL; | 1648 | if (!c) return NULL; |
| @@ -1689,7 +1689,7 @@ void | |||
| 1689 | free_image_cache (f) | 1689 | free_image_cache (f) |
| 1690 | struct frame *f; | 1690 | struct frame *f; |
| 1691 | { | 1691 | { |
| 1692 | struct image_cache *c = FRAME_X_IMAGE_CACHE (f); | 1692 | struct image_cache *c = FRAME_IMAGE_CACHE (f); |
| 1693 | if (c) | 1693 | if (c) |
| 1694 | { | 1694 | { |
| 1695 | int i; | 1695 | int i; |
| @@ -1702,7 +1702,7 @@ free_image_cache (f) | |||
| 1702 | xfree (c->images); | 1702 | xfree (c->images); |
| 1703 | xfree (c->buckets); | 1703 | xfree (c->buckets); |
| 1704 | xfree (c); | 1704 | xfree (c); |
| 1705 | FRAME_X_IMAGE_CACHE (f) = NULL; | 1705 | FRAME_IMAGE_CACHE (f) = NULL; |
| 1706 | } | 1706 | } |
| 1707 | } | 1707 | } |
| 1708 | 1708 | ||
| @@ -1719,7 +1719,7 @@ clear_image_cache (f, force_p) | |||
| 1719 | struct frame *f; | 1719 | struct frame *f; |
| 1720 | int force_p; | 1720 | int force_p; |
| 1721 | { | 1721 | { |
| 1722 | struct image_cache *c = FRAME_X_IMAGE_CACHE (f); | 1722 | struct image_cache *c = FRAME_IMAGE_CACHE (f); |
| 1723 | 1723 | ||
| 1724 | if (c && INTEGERP (Vimage_cache_eviction_delay)) | 1724 | if (c && INTEGERP (Vimage_cache_eviction_delay)) |
| 1725 | { | 1725 | { |
| @@ -1756,8 +1756,7 @@ clear_image_cache (f, force_p) | |||
| 1756 | FOR_EACH_FRAME (tail, frame) | 1756 | FOR_EACH_FRAME (tail, frame) |
| 1757 | { | 1757 | { |
| 1758 | struct frame *f = XFRAME (frame); | 1758 | struct frame *f = XFRAME (frame); |
| 1759 | if (FRAME_WINDOW_P (f) | 1759 | if (FRAME_IMAGE_CACHE (f) == c) |
| 1760 | && FRAME_X_IMAGE_CACHE (f) == c) | ||
| 1761 | clear_current_matrices (f); | 1760 | clear_current_matrices (f); |
| 1762 | } | 1761 | } |
| 1763 | 1762 | ||
| @@ -1768,6 +1767,18 @@ clear_image_cache (f, force_p) | |||
| 1768 | } | 1767 | } |
| 1769 | } | 1768 | } |
| 1770 | 1769 | ||
| 1770 | void | ||
| 1771 | clear_image_caches (int force_p) | ||
| 1772 | { | ||
| 1773 | /* FIXME: We want to do | ||
| 1774 | * struct terminal *t; | ||
| 1775 | * for (t = terminal_list; t; t = t->next_terminal) | ||
| 1776 | * clear_image_cache (t, filter); */ | ||
| 1777 | Lisp_Object tail, frame; | ||
| 1778 | FOR_EACH_FRAME (tail, frame) | ||
| 1779 | if (FRAME_WINDOW_P (XFRAME (frame))) | ||
| 1780 | clear_image_cache (XFRAME (frame), force_p); | ||
| 1781 | } | ||
| 1771 | 1782 | ||
| 1772 | DEFUN ("clear-image-cache", Fclear_image_cache, Sclear_image_cache, | 1783 | DEFUN ("clear-image-cache", Fclear_image_cache, Sclear_image_cache, |
| 1773 | 0, 1, 0, | 1784 | 0, 1, 0, |
| @@ -1778,13 +1789,7 @@ FRAME t means clear the image caches of all frames. */) | |||
| 1778 | Lisp_Object frame; | 1789 | Lisp_Object frame; |
| 1779 | { | 1790 | { |
| 1780 | if (EQ (frame, Qt)) | 1791 | if (EQ (frame, Qt)) |
| 1781 | { | 1792 | clear_image_caches (1); |
| 1782 | Lisp_Object tail; | ||
| 1783 | |||
| 1784 | FOR_EACH_FRAME (tail, frame) | ||
| 1785 | if (FRAME_WINDOW_P (XFRAME (frame))) | ||
| 1786 | clear_image_cache (XFRAME (frame), 1); | ||
| 1787 | } | ||
| 1788 | else | 1793 | else |
| 1789 | clear_image_cache (check_x_frame (frame), 1); | 1794 | clear_image_cache (check_x_frame (frame), 1); |
| 1790 | 1795 | ||
| @@ -1916,7 +1921,7 @@ lookup_image (f, spec) | |||
| 1916 | xassert (FRAME_WINDOW_P (f)); | 1921 | xassert (FRAME_WINDOW_P (f)); |
| 1917 | xassert (valid_image_p (spec)); | 1922 | xassert (valid_image_p (spec)); |
| 1918 | 1923 | ||
| 1919 | c = FRAME_X_IMAGE_CACHE (f); | 1924 | c = FRAME_IMAGE_CACHE (f); |
| 1920 | 1925 | ||
| 1921 | GCPRO1 (spec); | 1926 | GCPRO1 (spec); |
| 1922 | 1927 | ||
| @@ -2027,7 +2032,7 @@ cache_image (f, img) | |||
| 2027 | struct frame *f; | 2032 | struct frame *f; |
| 2028 | struct image *img; | 2033 | struct image *img; |
| 2029 | { | 2034 | { |
| 2030 | struct image_cache *c = FRAME_X_IMAGE_CACHE (f); | 2035 | struct image_cache *c = FRAME_IMAGE_CACHE (f); |
| 2031 | int i; | 2036 | int i; |
| 2032 | 2037 | ||
| 2033 | /* Find a free slot in c->images. */ | 2038 | /* Find a free slot in c->images. */ |
| @@ -2062,21 +2067,28 @@ cache_image (f, img) | |||
| 2062 | /* Call FN on every image in the image cache of frame F. Used to mark | 2067 | /* Call FN on every image in the image cache of frame F. Used to mark |
| 2063 | Lisp Objects in the image cache. */ | 2068 | Lisp Objects in the image cache. */ |
| 2064 | 2069 | ||
| 2070 | /* Mark Lisp objects in image IMG. */ | ||
| 2071 | |||
| 2072 | static void | ||
| 2073 | mark_image (img) | ||
| 2074 | struct image *img; | ||
| 2075 | { | ||
| 2076 | mark_object (img->spec); | ||
| 2077 | |||
| 2078 | if (!NILP (img->data.lisp_val)) | ||
| 2079 | mark_object (img->data.lisp_val); | ||
| 2080 | } | ||
| 2081 | |||
| 2082 | |||
| 2065 | void | 2083 | void |
| 2066 | forall_images_in_image_cache (f, fn) | 2084 | mark_image_cache (struct image_cache *c) |
| 2067 | struct frame *f; | ||
| 2068 | void (*fn) P_ ((struct image *img)); | ||
| 2069 | { | 2085 | { |
| 2070 | if (FRAME_LIVE_P (f) && FRAME_WINDOW_P (f)) | 2086 | if (c) |
| 2071 | { | 2087 | { |
| 2072 | struct image_cache *c = FRAME_X_IMAGE_CACHE (f); | 2088 | int i; |
| 2073 | if (c) | 2089 | for (i = 0; i < c->used; ++i) |
| 2074 | { | 2090 | if (c->images[i]) |
| 2075 | int i; | 2091 | mark_image (c->images[i]); |
| 2076 | for (i = 0; i < c->used; ++i) | ||
| 2077 | if (c->images[i]) | ||
| 2078 | fn (c->images[i]); | ||
| 2079 | } | ||
| 2080 | } | 2092 | } |
| 2081 | } | 2093 | } |
| 2082 | 2094 | ||
| @@ -8856,7 +8868,7 @@ x_kill_gs_process (pixmap, f) | |||
| 8856 | Pixmap pixmap; | 8868 | Pixmap pixmap; |
| 8857 | struct frame *f; | 8869 | struct frame *f; |
| 8858 | { | 8870 | { |
| 8859 | struct image_cache *c = FRAME_X_IMAGE_CACHE (f); | 8871 | struct image_cache *c = FRAME_IMAGE_CACHE (f); |
| 8860 | int class, i; | 8872 | int class, i; |
| 8861 | struct image *img; | 8873 | struct image *img; |
| 8862 | 8874 | ||
diff --git a/src/macfns.c b/src/macfns.c index aab91cf41f4..9e471c6c588 100644 --- a/src/macfns.c +++ b/src/macfns.c | |||
| @@ -2608,7 +2608,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 2608 | 2608 | ||
| 2609 | /* With FRAME_MAC_DISPLAY_INFO set up, this unwind-protect is safe. */ | 2609 | /* With FRAME_MAC_DISPLAY_INFO set up, this unwind-protect is safe. */ |
| 2610 | #if GLYPH_DEBUG | 2610 | #if GLYPH_DEBUG |
| 2611 | image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; | 2611 | image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount; |
| 2612 | dpyinfo_refcount = dpyinfo->reference_count; | 2612 | dpyinfo_refcount = dpyinfo->reference_count; |
| 2613 | #endif /* GLYPH_DEBUG */ | 2613 | #endif /* GLYPH_DEBUG */ |
| 2614 | FRAME_KBOARD (f) = kb; | 2614 | FRAME_KBOARD (f) = kb; |
| @@ -3846,7 +3846,7 @@ x_create_tip_frame (dpyinfo, parms, text) | |||
| 3846 | f->icon_name = Qnil; | 3846 | f->icon_name = Qnil; |
| 3847 | /* FRAME_X_DISPLAY_INFO (f) = dpyinfo; */ | 3847 | /* FRAME_X_DISPLAY_INFO (f) = dpyinfo; */ |
| 3848 | #if GLYPH_DEBUG | 3848 | #if GLYPH_DEBUG |
| 3849 | image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; | 3849 | image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount; |
| 3850 | dpyinfo_refcount = dpyinfo->reference_count; | 3850 | dpyinfo_refcount = dpyinfo->reference_count; |
| 3851 | #endif /* GLYPH_DEBUG */ | 3851 | #endif /* GLYPH_DEBUG */ |
| 3852 | FRAME_KBOARD (f) = kb; | 3852 | FRAME_KBOARD (f) = kb; |
diff --git a/src/macterm.c b/src/macterm.c index 2d03c8918c5..842e1844f50 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -12624,7 +12624,7 @@ mac_term_init (display_name, xrm_option, resource_name) | |||
| 12624 | 12624 | ||
| 12625 | dpyinfo->grabbed = 0; | 12625 | dpyinfo->grabbed = 0; |
| 12626 | dpyinfo->root_window = NULL; | 12626 | dpyinfo->root_window = NULL; |
| 12627 | dpyinfo->image_cache = make_image_cache (); | 12627 | dpyinfo->terminal->image_cache = make_image_cache (); |
| 12628 | 12628 | ||
| 12629 | dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; | 12629 | dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; |
| 12630 | dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; | 12630 | dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; |
diff --git a/src/macterm.h b/src/macterm.h index 11d7e05a38f..ddbf0f04182 100644 --- a/src/macterm.h +++ b/src/macterm.h | |||
| @@ -185,9 +185,6 @@ struct mac_display_info | |||
| 185 | frame. It differs from x_focus_frame when we're using a global | 185 | frame. It differs from x_focus_frame when we're using a global |
| 186 | minibuffer. */ | 186 | minibuffer. */ |
| 187 | struct frame *x_highlight_frame; | 187 | struct frame *x_highlight_frame; |
| 188 | |||
| 189 | /* Cache of images. */ | ||
| 190 | struct image_cache *image_cache; | ||
| 191 | }; | 188 | }; |
| 192 | 189 | ||
| 193 | /* This checks to make sure we have a display. */ | 190 | /* This checks to make sure we have a display. */ |
| @@ -394,11 +391,6 @@ typedef struct mac_output mac_output; | |||
| 394 | 391 | ||
| 395 | #define FRAME_SMALLEST_FONT_HEIGHT(F) \ | 392 | #define FRAME_SMALLEST_FONT_HEIGHT(F) \ |
| 396 | FRAME_MAC_DISPLAY_INFO(F)->smallest_font_height | 393 | FRAME_MAC_DISPLAY_INFO(F)->smallest_font_height |
| 397 | |||
| 398 | /* Return a pointer to the image cache of frame F. */ | ||
| 399 | |||
| 400 | #define FRAME_X_IMAGE_CACHE(F) FRAME_MAC_DISPLAY_INFO ((F))->image_cache | ||
| 401 | |||
| 402 | 394 | ||
| 403 | /* Mac-specific scroll bar stuff. */ | 395 | /* Mac-specific scroll bar stuff. */ |
| 404 | 396 | ||
diff --git a/src/termhooks.h b/src/termhooks.h index 7ff1a2ca111..2acd20bbb3f 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -24,11 +24,6 @@ Boston, MA 02110-1301, USA. */ | |||
| 24 | 24 | ||
| 25 | struct glyph; | 25 | struct glyph; |
| 26 | struct frame; | 26 | struct frame; |
| 27 | |||
| 28 | /* Only use prototypes when lisp.h has been included. */ | ||
| 29 | #ifndef P_ | ||
| 30 | #define P_(X) () | ||
| 31 | #endif | ||
| 32 | 27 | ||
| 33 | 28 | ||
| 34 | enum scroll_bar_part { | 29 | enum scroll_bar_part { |
| @@ -363,6 +358,11 @@ struct terminal | |||
| 363 | struct kboard *kboard; | 358 | struct kboard *kboard; |
| 364 | #endif | 359 | #endif |
| 365 | 360 | ||
| 361 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 362 | /* Cache of images. */ | ||
| 363 | struct image_cache *image_cache; | ||
| 364 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 365 | |||
| 366 | /* Device-type dependent data shared amongst all frames on this terminal. */ | 366 | /* Device-type dependent data shared amongst all frames on this terminal. */ |
| 367 | union display_info | 367 | union display_info |
| 368 | { | 368 | { |
diff --git a/src/w32fns.c b/src/w32fns.c index d61dba18e35..062d36dc10f 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -7476,7 +7476,7 @@ x_create_tip_frame (dpyinfo, parms, text) | |||
| 7476 | f->icon_name = Qnil; | 7476 | f->icon_name = Qnil; |
| 7477 | 7477 | ||
| 7478 | #if 0 /* GLYPH_DEBUG TODO: image support. */ | 7478 | #if 0 /* GLYPH_DEBUG TODO: image support. */ |
| 7479 | image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; | 7479 | image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount; |
| 7480 | dpyinfo_refcount = dpyinfo->reference_count; | 7480 | dpyinfo_refcount = dpyinfo->reference_count; |
| 7481 | #endif /* GLYPH_DEBUG */ | 7481 | #endif /* GLYPH_DEBUG */ |
| 7482 | #ifdef MULTI_KBOARD | 7482 | #ifdef MULTI_KBOARD |
diff --git a/src/w32term.c b/src/w32term.c index cbe8e1f6776..57455303ed5 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -7033,7 +7033,7 @@ w32_term_init (display_name, xrm_option, resource_name) | |||
| 7033 | dpyinfo->resx = GetDeviceCaps (hdc, LOGPIXELSX); | 7033 | dpyinfo->resx = GetDeviceCaps (hdc, LOGPIXELSX); |
| 7034 | dpyinfo->resy = GetDeviceCaps (hdc, LOGPIXELSY); | 7034 | dpyinfo->resy = GetDeviceCaps (hdc, LOGPIXELSY); |
| 7035 | dpyinfo->has_palette = GetDeviceCaps (hdc, RASTERCAPS) & RC_PALETTE; | 7035 | dpyinfo->has_palette = GetDeviceCaps (hdc, RASTERCAPS) & RC_PALETTE; |
| 7036 | dpyinfo->image_cache = make_image_cache (); | 7036 | dpyinfo->terminal->image_cache = make_image_cache (); |
| 7037 | dpyinfo->height_in = dpyinfo->height / dpyinfo->resx; | 7037 | dpyinfo->height_in = dpyinfo->height / dpyinfo->resx; |
| 7038 | dpyinfo->width_in = dpyinfo->width / dpyinfo->resy; | 7038 | dpyinfo->width_in = dpyinfo->width / dpyinfo->resy; |
| 7039 | ReleaseDC (GetDesktopWindow (), hdc); | 7039 | ReleaseDC (GetDesktopWindow (), hdc); |
diff --git a/src/w32term.h b/src/w32term.h index 0f2efad51cf..d6b20bce910 100644 --- a/src/w32term.h +++ b/src/w32term.h | |||
| @@ -233,9 +233,6 @@ struct w32_display_info | |||
| 233 | frame. It differs from w32_focus_frame when we're using a global | 233 | frame. It differs from w32_focus_frame when we're using a global |
| 234 | minibuffer. */ | 234 | minibuffer. */ |
| 235 | struct frame *x_highlight_frame; | 235 | struct frame *x_highlight_frame; |
| 236 | |||
| 237 | /* Cache of images. */ | ||
| 238 | struct image_cache *image_cache; | ||
| 239 | }; | 236 | }; |
| 240 | 237 | ||
| 241 | /* This is a chain of structures for all the displays currently in use. */ | 238 | /* This is a chain of structures for all the displays currently in use. */ |
| @@ -443,11 +440,6 @@ extern struct w32_output w32term_display; | |||
| 443 | 440 | ||
| 444 | #define FRAME_SMALLEST_FONT_HEIGHT(F) \ | 441 | #define FRAME_SMALLEST_FONT_HEIGHT(F) \ |
| 445 | FRAME_W32_DISPLAY_INFO(F)->smallest_font_height | 442 | FRAME_W32_DISPLAY_INFO(F)->smallest_font_height |
| 446 | |||
| 447 | /* Return a pointer to the image cache of frame F. */ | ||
| 448 | |||
| 449 | #define FRAME_X_IMAGE_CACHE(F) FRAME_W32_DISPLAY_INFO ((F))->image_cache | ||
| 450 | |||
| 451 | 443 | ||
| 452 | /* W32-specific scroll bar stuff. */ | 444 | /* W32-specific scroll bar stuff. */ |
| 453 | 445 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index f9333b4282f..2006274489c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -11797,13 +11797,7 @@ redisplay_internal (preserve_echo_area) | |||
| 11797 | #ifdef HAVE_WINDOW_SYSTEM | 11797 | #ifdef HAVE_WINDOW_SYSTEM |
| 11798 | if (clear_image_cache_count > CLEAR_IMAGE_CACHE_COUNT) | 11798 | if (clear_image_cache_count > CLEAR_IMAGE_CACHE_COUNT) |
| 11799 | { | 11799 | { |
| 11800 | Lisp_Object tail, frame; | 11800 | clear_image_caches (0); |
| 11801 | FOR_EACH_FRAME (tail, frame) | ||
| 11802 | { | ||
| 11803 | struct frame *f = XFRAME (frame); | ||
| 11804 | if (FRAME_WINDOW_P (f)) | ||
| 11805 | clear_image_cache (f, 0); | ||
| 11806 | } | ||
| 11807 | clear_image_cache_count = 0; | 11801 | clear_image_cache_count = 0; |
| 11808 | } | 11802 | } |
| 11809 | #endif /* HAVE_WINDOW_SYSTEM */ | 11803 | #endif /* HAVE_WINDOW_SYSTEM */ |
diff --git a/src/xfaces.c b/src/xfaces.c index 8497f53ffb6..d160d9e8c29 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -894,9 +894,10 @@ init_frame_faces (f) | |||
| 894 | /* Make the image cache. */ | 894 | /* Make the image cache. */ |
| 895 | if (FRAME_WINDOW_P (f)) | 895 | if (FRAME_WINDOW_P (f)) |
| 896 | { | 896 | { |
| 897 | if (FRAME_X_IMAGE_CACHE (f) == NULL) | 897 | if (FRAME_IMAGE_CACHE (f) == NULL) |
| 898 | FRAME_X_IMAGE_CACHE (f) = make_image_cache (); | 898 | /* Is that ever possible?? --Stef */ |
| 899 | ++FRAME_X_IMAGE_CACHE (f)->refcount; | 899 | FRAME_IMAGE_CACHE (f) = make_image_cache (); |
| 900 | ++FRAME_IMAGE_CACHE (f)->refcount; | ||
| 900 | } | 901 | } |
| 901 | #endif /* HAVE_WINDOW_SYSTEM */ | 902 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 902 | 903 | ||
| @@ -933,7 +934,7 @@ free_frame_faces (f) | |||
| 933 | #ifdef HAVE_WINDOW_SYSTEM | 934 | #ifdef HAVE_WINDOW_SYSTEM |
| 934 | if (FRAME_WINDOW_P (f)) | 935 | if (FRAME_WINDOW_P (f)) |
| 935 | { | 936 | { |
| 936 | struct image_cache *image_cache = FRAME_X_IMAGE_CACHE (f); | 937 | struct image_cache *image_cache = FRAME_IMAGE_CACHE (f); |
| 937 | if (image_cache) | 938 | if (image_cache) |
| 938 | { | 939 | { |
| 939 | --image_cache->refcount; | 940 | --image_cache->refcount; |
| @@ -1008,11 +1009,9 @@ clear_face_cache (clear_fonts_p) | |||
| 1008 | { | 1009 | { |
| 1009 | f = XFRAME (frame); | 1010 | f = XFRAME (frame); |
| 1010 | if (FRAME_WINDOW_P (f)) | 1011 | if (FRAME_WINDOW_P (f)) |
| 1011 | { | ||
| 1012 | clear_face_gcs (FRAME_FACE_CACHE (f)); | 1012 | clear_face_gcs (FRAME_FACE_CACHE (f)); |
| 1013 | clear_image_cache (f, 0); | ||
| 1014 | } | ||
| 1015 | } | 1013 | } |
| 1014 | clear_image_caches (0); | ||
| 1016 | } | 1015 | } |
| 1017 | #endif /* HAVE_WINDOW_SYSTEM */ | 1016 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 1018 | } | 1017 | } |
diff --git a/src/xfns.c b/src/xfns.c index 9c2afbf6736..bfbc6ac02e9 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -3326,7 +3326,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3326 | /* With FRAME_X_DISPLAY_INFO set up, this unwind-protect is safe. */ | 3326 | /* With FRAME_X_DISPLAY_INFO set up, this unwind-protect is safe. */ |
| 3327 | record_unwind_protect (unwind_create_frame, frame); | 3327 | record_unwind_protect (unwind_create_frame, frame); |
| 3328 | #if GLYPH_DEBUG | 3328 | #if GLYPH_DEBUG |
| 3329 | image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; | 3329 | image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount; |
| 3330 | dpyinfo_refcount = dpyinfo->reference_count; | 3330 | dpyinfo_refcount = dpyinfo->reference_count; |
| 3331 | #endif /* GLYPH_DEBUG */ | 3331 | #endif /* GLYPH_DEBUG */ |
| 3332 | 3332 | ||
| @@ -4930,7 +4930,7 @@ x_create_tip_frame (dpyinfo, parms, text) | |||
| 4930 | f->icon_name = Qnil; | 4930 | f->icon_name = Qnil; |
| 4931 | FRAME_X_DISPLAY_INFO (f) = dpyinfo; | 4931 | FRAME_X_DISPLAY_INFO (f) = dpyinfo; |
| 4932 | #if GLYPH_DEBUG | 4932 | #if GLYPH_DEBUG |
| 4933 | image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; | 4933 | image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount; |
| 4934 | dpyinfo_refcount = dpyinfo->reference_count; | 4934 | dpyinfo_refcount = dpyinfo->reference_count; |
| 4935 | #endif /* GLYPH_DEBUG */ | 4935 | #endif /* GLYPH_DEBUG */ |
| 4936 | f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; | 4936 | f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; |
diff --git a/src/xterm.c b/src/xterm.c index 709be459b20..5dd1585eda1 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -11395,7 +11395,7 @@ x_term_init (display_name, xrm_option, resource_name) | |||
| 11395 | dpyinfo->x_focus_frame = 0; | 11395 | dpyinfo->x_focus_frame = 0; |
| 11396 | dpyinfo->x_focus_event_frame = 0; | 11396 | dpyinfo->x_focus_event_frame = 0; |
| 11397 | dpyinfo->x_highlight_frame = 0; | 11397 | dpyinfo->x_highlight_frame = 0; |
| 11398 | dpyinfo->image_cache = make_image_cache (); | 11398 | dpyinfo->terminal->image_cache = make_image_cache (); |
| 11399 | dpyinfo->wm_type = X_WMTYPE_UNKNOWN; | 11399 | dpyinfo->wm_type = X_WMTYPE_UNKNOWN; |
| 11400 | 11400 | ||
| 11401 | /* See if we can construct pixel values from RGB values. */ | 11401 | /* See if we can construct pixel values from RGB values. */ |
diff --git a/src/xterm.h b/src/xterm.h index a563fb9701f..6bb68cf9153 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -330,9 +330,6 @@ struct x_display_info | |||
| 330 | /* The gray pixmap. */ | 330 | /* The gray pixmap. */ |
| 331 | Pixmap gray; | 331 | Pixmap gray; |
| 332 | 332 | ||
| 333 | /* Cache of images. */ | ||
| 334 | struct image_cache *image_cache; | ||
| 335 | |||
| 336 | #ifdef HAVE_X_I18N | 333 | #ifdef HAVE_X_I18N |
| 337 | /* XIM (X Input method). */ | 334 | /* XIM (X Input method). */ |
| 338 | XIM xim; | 335 | XIM xim; |
| @@ -737,11 +734,6 @@ enum | |||
| 737 | 734 | ||
| 738 | #define FRAME_SMALLEST_FONT_HEIGHT(F) \ | 735 | #define FRAME_SMALLEST_FONT_HEIGHT(F) \ |
| 739 | FRAME_X_DISPLAY_INFO(F)->smallest_font_height | 736 | FRAME_X_DISPLAY_INFO(F)->smallest_font_height |
| 740 | |||
| 741 | /* Return a pointer to the image cache of frame F. */ | ||
| 742 | |||
| 743 | #define FRAME_X_IMAGE_CACHE(F) FRAME_X_DISPLAY_INFO ((F))->image_cache | ||
| 744 | |||
| 745 | 737 | ||
| 746 | /* X-specific scroll bar stuff. */ | 738 | /* X-specific scroll bar stuff. */ |
| 747 | 739 | ||