aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2011-06-11 19:03:16 -0400
committerChong Yidong2011-06-11 19:03:16 -0400
commit1100a63ce53c2445fe7f3064b5a0812eb8bcc269 (patch)
tree6706af1c2d033116e27eb74354ac66365b733532 /src
parentdef722bf0990b94cebf4c0761cd99dc3c0de6471 (diff)
downloademacs-1100a63ce53c2445fe7f3064b5a0812eb8bcc269.tar.gz
emacs-1100a63ce53c2445fe7f3064b5a0812eb8bcc269.zip
Handle gif subimage animation delay correctly.
* lisp/image.el (image-animated-p): Return animation delay in seconds. Avoid bit manipulation in Lisp; use `delay' entry in the metadata. (image-animate-timeout): Remove DELAY argument. Use image-animated-p to get animation delay for each frame. (image-animate): Caller changed. * src/image.c (gif_load): Add animation frame delay to the metadata. (syms_of_image): Use DEFSYM. New symbol `delay'.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/image.c145
2 files changed, 67 insertions, 83 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e638728a655..9f7302432e4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12011-06-11 Chong Yidong <cyd@stupidchicken.com>
2
3 * image.c (gif_load): Add animation frame delay to the metadata.
4 (syms_of_image): Use DEFSYM. New symbol `delay'.
5
12011-06-11 Martin Rudalics <rudalics@gmx.at> 62011-06-11 Martin Rudalics <rudalics@gmx.at>
2 7
3 * window.c (delete_deletable_window): Re-add. 8 * window.c (delete_deletable_window): Re-add.
diff --git a/src/image.c b/src/image.c
index b381e990dab..495bfdc0eef 100644
--- a/src/image.c
+++ b/src/image.c
@@ -564,7 +564,6 @@ static Lisp_Object Qxbm;
564/* Keywords. */ 564/* Keywords. */
565 565
566Lisp_Object QCascent, QCmargin, QCrelief; 566Lisp_Object QCascent, QCmargin, QCrelief;
567static Lisp_Object Qcount, Qextension_data;
568Lisp_Object QCconversion; 567Lisp_Object QCconversion;
569static Lisp_Object QCheuristic_mask; 568static Lisp_Object QCheuristic_mask;
570static Lisp_Object QCcolor_symbols; 569static Lisp_Object QCcolor_symbols;
@@ -573,6 +572,7 @@ static Lisp_Object QCcrop, QCrotation;
573 572
574/* Other symbols. */ 573/* Other symbols. */
575 574
575static Lisp_Object Qcount, Qextension_data, Qdelay;
576static Lisp_Object Qlaplace, Qemboss, Qedge_detection, Qheuristic; 576static Lisp_Object Qlaplace, Qemboss, Qedge_detection, Qheuristic;
577 577
578/* Function prototypes. */ 578/* Function prototypes. */
@@ -7315,16 +7315,31 @@ gif_load (struct frame *f, struct image *img)
7315 img->lisp_data = Qnil; 7315 img->lisp_data = Qnil;
7316 if (gif->SavedImages[idx].ExtensionBlockCount > 0) 7316 if (gif->SavedImages[idx].ExtensionBlockCount > 0)
7317 { 7317 {
7318 unsigned int delay = 0;
7318 ExtensionBlock *ext = gif->SavedImages[idx].ExtensionBlocks; 7319 ExtensionBlock *ext = gif->SavedImages[idx].ExtensionBlocks;
7319 for (i = 0; i < gif->SavedImages[idx].ExtensionBlockCount; i++, ext++) 7320 for (i = 0; i < gif->SavedImages[idx].ExtensionBlockCount; i++, ext++)
7320 /* Append (... FUNCTION "BYTES") */ 7321 /* Append (... FUNCTION "BYTES") */
7321 img->lisp_data = Fcons (make_unibyte_string (ext->Bytes, ext->ByteCount), 7322 {
7322 Fcons (make_number (ext->Function), 7323 img->lisp_data
7323 img->lisp_data)); 7324 = Fcons (make_number (ext->Function),
7325 Fcons (make_unibyte_string (ext->Bytes, ext->ByteCount),
7326 img->lisp_data));
7327 if (ext->Function == GIF_LOCAL_DESCRIPTOR_EXTENSION
7328 && ext->ByteCount == 4)
7329 {
7330 delay = ext->Bytes[2] << CHAR_BIT;
7331 delay |= ext->Bytes[1];
7332 }
7333 }
7324 img->lisp_data = Fcons (Qextension_data, 7334 img->lisp_data = Fcons (Qextension_data,
7325 Fcons (Fnreverse (img->lisp_data), 7335 Fcons (img->lisp_data, Qnil));
7326 Qnil)); 7336 if (delay)
7337 img->lisp_data
7338 = Fcons (Qdelay,
7339 Fcons (make_float (((double) delay) * 0.01),
7340 img->lisp_data));
7327 } 7341 }
7342
7328 if (gif->ImageCount > 1) 7343 if (gif->ImageCount > 1)
7329 img->lisp_data = Fcons (Qcount, 7344 img->lisp_data = Fcons (Qcount,
7330 Fcons (make_number (gif->ImageCount), 7345 Fcons (make_number (gif->ImageCount),
@@ -8688,75 +8703,49 @@ as a ratio to the frame height and width. If the value is
8688non-numeric, there is no explicit limit on the size of images. */); 8703non-numeric, there is no explicit limit on the size of images. */);
8689 Vmax_image_size = make_float (MAX_IMAGE_SIZE); 8704 Vmax_image_size = make_float (MAX_IMAGE_SIZE);
8690 8705
8691 Qpbm = intern_c_string ("pbm"); 8706 DEFSYM (Qpbm, "pbm");
8692 staticpro (&Qpbm);
8693 ADD_IMAGE_TYPE (Qpbm); 8707 ADD_IMAGE_TYPE (Qpbm);
8694 8708
8695 Qxbm = intern_c_string ("xbm"); 8709 DEFSYM (Qxbm, "xbm");
8696 staticpro (&Qxbm);
8697 ADD_IMAGE_TYPE (Qxbm); 8710 ADD_IMAGE_TYPE (Qxbm);
8698 8711
8699 define_image_type (&xbm_type, 1); 8712 define_image_type (&xbm_type, 1);
8700 define_image_type (&pbm_type, 1); 8713 define_image_type (&pbm_type, 1);
8701 8714
8702 Qcount = intern_c_string ("count"); 8715 DEFSYM (Qcount, "count");
8703 staticpro (&Qcount); 8716 DEFSYM (Qextension_data, "extension-data");
8704 Qextension_data = intern_c_string ("extension-data"); 8717 DEFSYM (Qdelay, "delay");
8705 staticpro (&Qextension_data); 8718
8706 8719 DEFSYM (QCascent, ":ascent");
8707 QCascent = intern_c_string (":ascent"); 8720 DEFSYM (QCmargin, ":margin");
8708 staticpro (&QCascent); 8721 DEFSYM (QCrelief, ":relief");
8709 QCmargin = intern_c_string (":margin"); 8722 DEFSYM (QCconversion, ":conversion");
8710 staticpro (&QCmargin); 8723 DEFSYM (QCcolor_symbols, ":color-symbols");
8711 QCrelief = intern_c_string (":relief"); 8724 DEFSYM (QCheuristic_mask, ":heuristic-mask");
8712 staticpro (&QCrelief); 8725 DEFSYM (QCindex, ":index");
8713 QCconversion = intern_c_string (":conversion"); 8726 DEFSYM (QCgeometry, ":geometry");
8714 staticpro (&QCconversion); 8727 DEFSYM (QCcrop, ":crop");
8715 QCcolor_symbols = intern_c_string (":color-symbols"); 8728 DEFSYM (QCrotation, ":rotation");
8716 staticpro (&QCcolor_symbols); 8729 DEFSYM (QCmatrix, ":matrix");
8717 QCheuristic_mask = intern_c_string (":heuristic-mask"); 8730 DEFSYM (QCcolor_adjustment, ":color-adjustment");
8718 staticpro (&QCheuristic_mask); 8731 DEFSYM (QCmask, ":mask");
8719 QCindex = intern_c_string (":index"); 8732
8720 staticpro (&QCindex); 8733 DEFSYM (Qlaplace, "laplace");
8721 QCgeometry = intern_c_string (":geometry"); 8734 DEFSYM (Qemboss, "emboss");
8722 staticpro (&QCgeometry); 8735 DEFSYM (Qedge_detection, "edge-detection");
8723 QCcrop = intern_c_string (":crop"); 8736 DEFSYM (Qheuristic, "heuristic");
8724 staticpro (&QCcrop); 8737
8725 QCrotation = intern_c_string (":rotation"); 8738 DEFSYM (Qpostscript, "postscript");
8726 staticpro (&QCrotation);
8727 QCmatrix = intern_c_string (":matrix");
8728 staticpro (&QCmatrix);
8729 QCcolor_adjustment = intern_c_string (":color-adjustment");
8730 staticpro (&QCcolor_adjustment);
8731 QCmask = intern_c_string (":mask");
8732 staticpro (&QCmask);
8733
8734 Qlaplace = intern_c_string ("laplace");
8735 staticpro (&Qlaplace);
8736 Qemboss = intern_c_string ("emboss");
8737 staticpro (&Qemboss);
8738 Qedge_detection = intern_c_string ("edge-detection");
8739 staticpro (&Qedge_detection);
8740 Qheuristic = intern_c_string ("heuristic");
8741 staticpro (&Qheuristic);
8742
8743 Qpostscript = intern_c_string ("postscript");
8744 staticpro (&Qpostscript);
8745#ifdef HAVE_GHOSTSCRIPT 8739#ifdef HAVE_GHOSTSCRIPT
8746 ADD_IMAGE_TYPE (Qpostscript); 8740 ADD_IMAGE_TYPE (Qpostscript);
8747 QCloader = intern_c_string (":loader"); 8741 DEFSYM (QCloader, ":loader");
8748 staticpro (&QCloader); 8742 DEFSYM (QCbounding_box, ":bounding-box");
8749 QCbounding_box = intern_c_string (":bounding-box"); 8743 DEFSYM (QCpt_width, ":pt-width");
8750 staticpro (&QCbounding_box); 8744 DEFSYM (QCpt_height, ":pt-height");
8751 QCpt_width = intern_c_string (":pt-width");
8752 staticpro (&QCpt_width);
8753 QCpt_height = intern_c_string (":pt-height");
8754 staticpro (&QCpt_height);
8755#endif /* HAVE_GHOSTSCRIPT */ 8745#endif /* HAVE_GHOSTSCRIPT */
8756 8746
8757#ifdef HAVE_NTGUI 8747#ifdef HAVE_NTGUI
8758 Qlibpng_version = intern_c_string ("libpng-version"); 8748 DEFSYM (Qlibpng_version, "libpng-version");
8759 staticpro (&Qlibpng_version);
8760 Fset (Qlibpng_version, 8749 Fset (Qlibpng_version,
8761#if HAVE_PNG 8750#if HAVE_PNG
8762 make_number (PNG_LIBPNG_VER) 8751 make_number (PNG_LIBPNG_VER)
@@ -8767,53 +8756,43 @@ non-numeric, there is no explicit limit on the size of images. */);
8767#endif 8756#endif
8768 8757
8769#if defined (HAVE_XPM) || defined (HAVE_NS) 8758#if defined (HAVE_XPM) || defined (HAVE_NS)
8770 Qxpm = intern_c_string ("xpm"); 8759 DEFSYM (Qxpm, "xpm");
8771 staticpro (&Qxpm);
8772 ADD_IMAGE_TYPE (Qxpm); 8760 ADD_IMAGE_TYPE (Qxpm);
8773#endif 8761#endif
8774 8762
8775#if defined (HAVE_JPEG) || defined (HAVE_NS) 8763#if defined (HAVE_JPEG) || defined (HAVE_NS)
8776 Qjpeg = intern_c_string ("jpeg"); 8764 DEFSYM (Qjpeg, "jpeg");
8777 staticpro (&Qjpeg);
8778 ADD_IMAGE_TYPE (Qjpeg); 8765 ADD_IMAGE_TYPE (Qjpeg);
8779#endif 8766#endif
8780 8767
8781#if defined (HAVE_TIFF) || defined (HAVE_NS) 8768#if defined (HAVE_TIFF) || defined (HAVE_NS)
8782 Qtiff = intern_c_string ("tiff"); 8769 DEFSYM (Qtiff, "tiff");
8783 staticpro (&Qtiff);
8784 ADD_IMAGE_TYPE (Qtiff); 8770 ADD_IMAGE_TYPE (Qtiff);
8785#endif 8771#endif
8786 8772
8787#if defined (HAVE_GIF) || defined (HAVE_NS) 8773#if defined (HAVE_GIF) || defined (HAVE_NS)
8788 Qgif = intern_c_string ("gif"); 8774 DEFSYM (Qgif, "gif");
8789 staticpro (&Qgif);
8790 ADD_IMAGE_TYPE (Qgif); 8775 ADD_IMAGE_TYPE (Qgif);
8791#endif 8776#endif
8792 8777
8793#if defined (HAVE_PNG) || defined (HAVE_NS) 8778#if defined (HAVE_PNG) || defined (HAVE_NS)
8794 Qpng = intern_c_string ("png"); 8779 DEFSYM (Qpng, "png");
8795 staticpro (&Qpng);
8796 ADD_IMAGE_TYPE (Qpng); 8780 ADD_IMAGE_TYPE (Qpng);
8797#endif 8781#endif
8798 8782
8799#if defined (HAVE_IMAGEMAGICK) 8783#if defined (HAVE_IMAGEMAGICK)
8800 Qimagemagick = intern_c_string ("imagemagick"); 8784 DEFSYM (Qimagemagick, "imagemagick");
8801 staticpro (&Qimagemagick);
8802 ADD_IMAGE_TYPE (Qimagemagick); 8785 ADD_IMAGE_TYPE (Qimagemagick);
8803#endif 8786#endif
8804 8787
8805#if defined (HAVE_RSVG) 8788#if defined (HAVE_RSVG)
8806 Qsvg = intern_c_string ("svg"); 8789 DEFSYM (Qsvg, "svg");
8807 staticpro (&Qsvg);
8808 ADD_IMAGE_TYPE (Qsvg); 8790 ADD_IMAGE_TYPE (Qsvg);
8809#ifdef HAVE_NTGUI 8791#ifdef HAVE_NTGUI
8810 /* Other libraries used directly by svg code. */ 8792 /* Other libraries used directly by svg code. */
8811 Qgdk_pixbuf = intern_c_string ("gdk-pixbuf"); 8793 DEFSYM (Qgdk_pixbuf, "gdk-pixbuf");
8812 staticpro (&Qgdk_pixbuf); 8794 DEFSYM (Qglib, "glib");
8813 Qglib = intern_c_string ("glib"); 8795 DEFSYM (Qgobject, "gobject");
8814 staticpro (&Qglib);
8815 Qgobject = intern_c_string ("gobject");
8816 staticpro (&Qgobject);
8817#endif /* HAVE_NTGUI */ 8796#endif /* HAVE_NTGUI */
8818#endif /* HAVE_RSVG */ 8797#endif /* HAVE_RSVG */
8819 8798