Mercurial > emacs
comparison src/image.c @ 82318:7bec7031afab
Minor cleanup.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Tue, 07 Aug 2007 16:25:26 +0000 |
parents | 51a0886252f1 |
children | b6db95f12a9d 5b644ae74c91 424b655804ca |
comparison
equal
deleted
inserted
replaced
82317:c668fe19825b | 82318:7bec7031afab |
---|---|
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 int i = hash % IMAGE_CACHE_BUCKETS_SIZE; | 1645 int i = hash % IMAGE_CACHE_BUCKETS_SIZE; |
1646 | 1646 |
1647 if (!c) return NULL; | |
1648 | |
1647 /* If the image spec does not specify a background color, the cached | 1649 /* If the image spec does not specify a background color, the cached |
1648 image must have the same background color as the current frame. | 1650 image must have the same background color as the current frame. |
1649 The foreground color must also match, for the sake of monochrome | 1651 The foreground color must also match, for the sake of monochrome |
1650 images. | 1652 images. |
1651 | 1653 |
1653 for color images, or if the image spec specifies :foreground; | 1655 for color images, or if the image spec specifies :foreground; |
1654 similarly we could ignore the background color matching condition | 1656 similarly we could ignore the background color matching condition |
1655 for formats that don't use transparency (such as jpeg), or if the | 1657 for formats that don't use transparency (such as jpeg), or if the |
1656 image spec specifies :background. However, the extra memory | 1658 image spec specifies :background. However, the extra memory |
1657 usage is probably negligible in practice, so we don't bother. */ | 1659 usage is probably negligible in practice, so we don't bother. */ |
1658 if (!c) return NULL; | |
1659 | 1660 |
1660 for (img = c->buckets[i]; img; img = img->next) | 1661 for (img = c->buckets[i]; img; img = img->next) |
1661 if (img->hash == hash | 1662 if (img->hash == hash |
1662 && !NILP (Fequal (img->spec, spec)) | 1663 && !NILP (Fequal (img->spec, spec)) |
1663 /* If the image spec specifies a background, it doesn't matter | |
1664 what the frame background is. */ | |
1665 && img->frame_foreground == FRAME_FOREGROUND_PIXEL (f) | 1664 && img->frame_foreground == FRAME_FOREGROUND_PIXEL (f) |
1666 && img->frame_background == FRAME_BACKGROUND_PIXEL (f)) | 1665 && img->frame_background == FRAME_BACKGROUND_PIXEL (f)) |
1667 break; | 1666 break; |
1668 return img; | 1667 return img; |
1669 } | 1668 } |
6358 fn_png_set_background (png_ptr, &user_bg, | 6357 fn_png_set_background (png_ptr, &user_bg, |
6359 PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); | 6358 PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); |
6360 } | 6359 } |
6361 } | 6360 } |
6362 /* The commented-out code checked if the png specifies a default | 6361 /* The commented-out code checked if the png specifies a default |
6363 background color, and uses that. Since we rely on the | 6362 background color, and uses that. Since we use the current |
6364 current frame background, it is actually OK for us to ignore | 6363 frame background, it is OK for us to ignore this. |
6365 this part. | |
6366 | 6364 |
6367 else if (fn_png_get_bKGD (png_ptr, info_ptr, &image_bg)) | 6365 else if (fn_png_get_bKGD (png_ptr, info_ptr, &image_bg)) |
6368 fn_png_set_background (png_ptr, image_bg, | 6366 fn_png_set_background (png_ptr, image_bg, |
6369 PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); | 6367 PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); |
6370 */ | 6368 */ |