comparison src/image.c @ 90851:31beec9ee600

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 751-770) - Update from CVS - Merge from emacs--rel--22 - Update from CVS: lisp/textmodes/sgml-mode.el: Revert last change. - Merge from gnus--rel--5.10 * emacs--rel--22 (patch 18-25) * gnus--rel--5.10 (patch 222-223) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-208
author Miles Bader <miles@gnu.org>
date Thu, 24 May 2007 21:31:10 +0000
parents d7172f202ab8 e2ef7cb33308
children d1039e83b4a7
comparison
equal deleted inserted replaced
90850:7d184cd91770 90851:31beec9ee600
1629 bzero (c->buckets, size); 1629 bzero (c->buckets, size);
1630 return c; 1630 return c;
1631 } 1631 }
1632 1632
1633 1633
1634 /* Search frame F for an images with spec SPEC, and free it. */
1635
1636 static void
1637 uncache_image (f, spec)
1638 struct frame *f;
1639 Lisp_Object spec;
1640 {
1641 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
1642 struct image *img = IMAGE_FROM_ID (f, lookup_image (f, spec));
1643 unsigned hash = sxhash (spec, 0);
1644 int i = hash % IMAGE_CACHE_BUCKETS_SIZE;
1645
1646 for (img = c->buckets[i]; img; img = img->next)
1647 if (img->hash == hash && !NILP (Fequal (img->spec, spec)))
1648 {
1649 free_image (f, img);
1650 break;
1651 }
1652 }
1653
1654
1634 /* Free image cache of frame F. Be aware that X frames share images 1655 /* Free image cache of frame F. Be aware that X frames share images
1635 caches. */ 1656 caches. */
1636 1657
1637 void 1658 void
1638 free_image_cache (f) 1659 free_image_cache (f)
1734 if (FRAME_WINDOW_P (XFRAME (frame))) 1755 if (FRAME_WINDOW_P (XFRAME (frame)))
1735 clear_image_cache (XFRAME (frame), 1); 1756 clear_image_cache (XFRAME (frame), 1);
1736 } 1757 }
1737 else 1758 else
1738 clear_image_cache (check_x_frame (frame), 1); 1759 clear_image_cache (check_x_frame (frame), 1);
1760
1761 return Qnil;
1762 }
1763
1764
1765 DEFUN ("image-refresh", Fimage_refresh, Simage_refresh,
1766 1, 2, 0,
1767 doc: /* Refresh the image with specification SPEC on frame FRAME.
1768 If SPEC specifies an image file, the displayed image is updated with
1769 the current contents of that file.
1770 FRAME nil or omitted means use the selected frame.
1771 FRAME t means refresh the image on all frames. */)
1772 (spec, frame)
1773 Lisp_Object spec, frame;
1774 {
1775 if (!valid_image_p (spec))
1776 error ("Invalid image specification");
1777
1778 if (EQ (frame, Qt))
1779 {
1780 Lisp_Object tail;
1781 FOR_EACH_FRAME (tail, frame)
1782 {
1783 struct frame *f = XFRAME (frame);
1784 if (FRAME_WINDOW_P (f))
1785 uncache_image (f, spec);
1786 }
1787 }
1788 else
1789 uncache_image (check_x_frame (frame), spec);
1739 1790
1740 return Qnil; 1791 return Qnil;
1741 } 1792 }
1742 1793
1743 1794
8658 ADD_IMAGE_TYPE(Qpng); 8709 ADD_IMAGE_TYPE(Qpng);
8659 #endif 8710 #endif
8660 8711
8661 defsubr (&Sinit_image_library); 8712 defsubr (&Sinit_image_library);
8662 defsubr (&Sclear_image_cache); 8713 defsubr (&Sclear_image_cache);
8714 defsubr (&Simage_refresh);
8663 defsubr (&Simage_size); 8715 defsubr (&Simage_size);
8664 defsubr (&Simage_mask_p); 8716 defsubr (&Simage_mask_p);
8665 defsubr (&Simage_extension_data); 8717 defsubr (&Simage_extension_data);
8666 8718
8667 #if GLYPH_DEBUG 8719 #if GLYPH_DEBUG