diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/image.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/image.c b/src/image.c index 36e8a2ecb80..2dd578afc39 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1642,21 +1642,26 @@ 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 | Likewise for the foreground color of the cached monochrome image. | 1649 | The foreground color must also match, for the sake of monochrome |
| 1651 | The following code be improved. For example, jpeg does not | 1650 | images. |
| 1652 | support transparency, but currently a jpeg image spec won't match | 1651 | |
| 1653 | a cached spec created with a different frame background. The | 1652 | In fact, we could ignore the foreground color matching condition |
| 1654 | extra memory usage is probably negligible in practice. */ | 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. */ | ||
| 1655 | if (!c) return NULL; | 1658 | if (!c) return NULL; |
| 1656 | 1659 | ||
| 1657 | for (img = c->buckets[i]; img; img = img->next) | 1660 | for (img = c->buckets[i]; img; img = img->next) |
| 1658 | if (img->hash == hash | 1661 | if (img->hash == hash |
| 1659 | && !NILP (Fequal (img->spec, spec)) | 1662 | && !NILP (Fequal (img->spec, spec)) |
| 1663 | /* If the image spec specifies a background, it doesn't matter | ||
| 1664 | what the frame background is. */ | ||
| 1660 | && img->frame_foreground == FRAME_FOREGROUND_PIXEL (f) | 1665 | && img->frame_foreground == FRAME_FOREGROUND_PIXEL (f) |
| 1661 | && img->frame_background == FRAME_BACKGROUND_PIXEL (f)) | 1666 | && img->frame_background == FRAME_BACKGROUND_PIXEL (f)) |
| 1662 | break; | 1667 | break; |