diff options
| author | Miles Bader | 2007-06-16 22:33:42 +0000 |
|---|---|---|
| committer | Miles Bader | 2007-06-16 22:33:42 +0000 |
| commit | 262d5ce7c21d6c1136fd2b8df67736e41e8e8953 (patch) | |
| tree | 853a5d30babd0abd585ccbe7f4e228bf43a42d5c /src/image.c | |
| parent | 5534694247d2b5259325ff43af0624aa2f8abb3e (diff) | |
| parent | af41f8a8d6660ad1fefad5bda69d1acb8e40b4d1 (diff) | |
| download | emacs-262d5ce7c21d6c1136fd2b8df67736e41e8e8953.tar.gz emacs-262d5ce7c21d6c1136fd2b8df67736e41e8e8953.zip | |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 793-802)
- Update from CVS
- Remove RCS keywords
- Merge from emacs--rel--22
* emacs--rel--22 (patch 42-50)
- Update from CVS
- Merge from gnus--rel--5.10
- Gnus ChangeLog tweaks
* gnus--rel--5.10 (patch 229-232)
- Merge from emacs--devo--0, emacs--rel--22
- ChangeLog tweak
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--multi-tty--0--patch-23
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/image.c b/src/image.c index b53fe01d7f9..322689c8d0f 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1642,22 +1642,28 @@ search_image_cache (f, spec, hash) | |||
| 1642 | { | 1642 | { |
| 1643 | struct image *img; | 1643 | struct image *img; |
| 1644 | struct image_cache *c = FRAME_X_IMAGE_CACHE (f); | 1644 | struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
| 1645 | Lisp_Object specified_bg = image_spec_value (spec, QCbackground, NULL); | ||
| 1646 | int i = hash % IMAGE_CACHE_BUCKETS_SIZE; | 1645 | int i = hash % IMAGE_CACHE_BUCKETS_SIZE; |
| 1647 | 1646 | ||
| 1648 | /* If the image spec does not specify a background color, the cached | 1647 | /* If the image spec does not specify a background color, the cached |
| 1649 | image must have the same background color as the current frame. | 1648 | image must have the same background color as the current frame. |
| 1650 | The following code be improved. For example, jpeg does not | 1649 | The foreground color must also match, for the sake of monochrome |
| 1651 | support transparency, but currently a jpeg image spec won't match | 1650 | images. |
| 1652 | a cached spec created with a different frame background. The | 1651 | |
| 1653 | extra memory usage is probably negligible in practice. */ | 1652 | In fact, we could ignore the foreground color matching condition |
| 1653 | for color images, or if the image spec specifies :foreground; | ||
| 1654 | similarly we could ignore the background color matching condition | ||
| 1655 | for formats that don't use transparency (such as jpeg), or if the | ||
| 1656 | image spec specifies :background. However, the extra memory | ||
| 1657 | usage is probably negligible in practice, so we don't bother. */ | ||
| 1654 | if (!c) return NULL; | 1658 | if (!c) return NULL; |
| 1655 | 1659 | ||
| 1656 | for (img = c->buckets[i]; img; img = img->next) | 1660 | for (img = c->buckets[i]; img; img = img->next) |
| 1657 | if (img->hash == hash | 1661 | if (img->hash == hash |
| 1658 | && !NILP (Fequal (img->spec, spec)) | 1662 | && !NILP (Fequal (img->spec, spec)) |
| 1659 | && (STRINGP (specified_bg) | 1663 | /* If the image spec specifies a background, it doesn't matter |
| 1660 | || img->background == FRAME_BACKGROUND_PIXEL (f))) | 1664 | what the frame background is. */ |
| 1665 | && img->frame_foreground == FRAME_FOREGROUND_PIXEL (f) | ||
| 1666 | && img->frame_background == FRAME_BACKGROUND_PIXEL (f)) | ||
| 1661 | break; | 1667 | break; |
| 1662 | return img; | 1668 | return img; |
| 1663 | } | 1669 | } |
| @@ -1932,6 +1938,8 @@ lookup_image (f, spec) | |||
| 1932 | img = make_image (spec, hash); | 1938 | img = make_image (spec, hash); |
| 1933 | cache_image (f, img); | 1939 | cache_image (f, img); |
| 1934 | img->load_failed_p = img->type->load (f, img) == 0; | 1940 | img->load_failed_p = img->type->load (f, img) == 0; |
| 1941 | img->frame_foreground = FRAME_FOREGROUND_PIXEL (f); | ||
| 1942 | img->frame_background = FRAME_BACKGROUND_PIXEL (f); | ||
| 1935 | 1943 | ||
| 1936 | /* If we can't load the image, and we don't have a width and | 1944 | /* If we can't load the image, and we don't have a width and |
| 1937 | height, use some arbitrary width and height so that we can | 1945 | height, use some arbitrary width and height so that we can |