Mercurial > emacs
diff src/image.c @ 83635:9c01792a3ce8
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
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sat, 16 Jun 2007 22:33:42 +0000 |
parents | cc587bfd19ca f9305411500d |
children | 0ece58f6e0aa |
line wrap: on
line diff
--- a/src/image.c Tue Jun 12 08:21:39 2007 +0000 +++ b/src/image.c Sat Jun 16 22:33:42 2007 +0000 @@ -1642,22 +1642,28 @@ { struct image *img; struct image_cache *c = FRAME_X_IMAGE_CACHE (f); - Lisp_Object specified_bg = image_spec_value (spec, QCbackground, NULL); int i = hash % IMAGE_CACHE_BUCKETS_SIZE; /* If the image spec does not specify a background color, the cached image must have the same background color as the current frame. - The following code be improved. For example, jpeg does not - support transparency, but currently a jpeg image spec won't match - a cached spec created with a different frame background. The - extra memory usage is probably negligible in practice. */ + The foreground color must also match, for the sake of monochrome + images. + + In fact, we could ignore the foreground color matching condition + for color images, or if the image spec specifies :foreground; + similarly we could ignore the background color matching condition + for formats that don't use transparency (such as jpeg), or if the + image spec specifies :background. However, the extra memory + usage is probably negligible in practice, so we don't bother. */ if (!c) return NULL; for (img = c->buckets[i]; img; img = img->next) if (img->hash == hash && !NILP (Fequal (img->spec, spec)) - && (STRINGP (specified_bg) - || img->background == FRAME_BACKGROUND_PIXEL (f))) + /* If the image spec specifies a background, it doesn't matter + what the frame background is. */ + && img->frame_foreground == FRAME_FOREGROUND_PIXEL (f) + && img->frame_background == FRAME_BACKGROUND_PIXEL (f)) break; return img; } @@ -1932,6 +1938,8 @@ img = make_image (spec, hash); cache_image (f, img); img->load_failed_p = img->type->load (f, img) == 0; + img->frame_foreground = FRAME_FOREGROUND_PIXEL (f); + img->frame_background = FRAME_BACKGROUND_PIXEL (f); /* If we can't load the image, and we don't have a width and height, use some arbitrary width and height so that we can