aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorPaul Eggert2011-01-11 21:57:19 -0800
committerPaul Eggert2011-01-11 21:57:19 -0800
commit7ea547574105f338c900d0c59390287c750a18c0 (patch)
treeebe2282d83447c9ecf34177320a2915e2201271d /src/image.c
parente8c53d3abf2f23dc40ed2bc748678025d5b5a5bc (diff)
parent529ee9edf2fd51f3e53f1fc4f7a9ba1859b0af99 (diff)
downloademacs-7ea547574105f338c900d0c59390287c750a18c0.tar.gz
emacs-7ea547574105f338c900d0c59390287c750a18c0.zip
Merge from mainline.
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/image.c b/src/image.c
index bff56b5f961..1125309a9f7 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7518,6 +7518,9 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7518 image. Interface :index is same as for GIF. First we "ping" the 7518 image. Interface :index is same as for GIF. First we "ping" the
7519 image to see how many sub-images it contains. Pinging is faster 7519 image to see how many sub-images it contains. Pinging is faster
7520 than loading the image to find out things about it. */ 7520 than loading the image to find out things about it. */
7521
7522 /* MagickWandGenesis() initializes the imagemagick library. */
7523 MagickWandGenesis ();
7521 image = image_spec_value (img->spec, QCindex, NULL); 7524 image = image_spec_value (img->spec, QCindex, NULL);
7522 ino = INTEGERP (image) ? XFASTINT (image) : 0; 7525 ino = INTEGERP (image) ? XFASTINT (image) : 0;
7523 ping_wand = NewMagickWand (); 7526 ping_wand = NewMagickWand ();
@@ -7546,6 +7549,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7546 img->data.lisp_val)); 7549 img->data.lisp_val));
7547 7550
7548 DestroyMagickWand (ping_wand); 7551 DestroyMagickWand (ping_wand);
7552
7549 /* Now, after pinging, we know how many images are inside the 7553 /* Now, after pinging, we know how many images are inside the
7550 file. If its not a bundle, just one. */ 7554 file. If its not a bundle, just one. */
7551 7555
@@ -7563,6 +7567,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7563 if (im_image != NULL) 7567 if (im_image != NULL)
7564 { 7568 {
7565 image_wand = NewMagickWandFromImage (im_image); 7569 image_wand = NewMagickWandFromImage (im_image);
7570 DestroyImage(im_image);
7566 status = MagickTrue; 7571 status = MagickTrue;
7567 } 7572 }
7568 else 7573 else
@@ -7573,7 +7578,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7573 image_wand = NewMagickWand (); 7578 image_wand = NewMagickWand ();
7574 status = MagickReadImageBlob (image_wand, contents, size); 7579 status = MagickReadImageBlob (image_wand, contents, size);
7575 } 7580 }
7576 image_error ("im read failed", Qnil, Qnil); 7581
7577 if (status == MagickFalse) goto imagemagick_error; 7582 if (status == MagickFalse) goto imagemagick_error;
7578 7583
7579 /* If width and/or height is set in the display spec assume we want 7584 /* If width and/or height is set in the display spec assume we want
@@ -7802,11 +7807,13 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7802 7807
7803 /* Final cleanup. image_wand should be the only resource left. */ 7808 /* Final cleanup. image_wand should be the only resource left. */
7804 DestroyMagickWand (image_wand); 7809 DestroyMagickWand (image_wand);
7810 MagickWandTerminus ();
7805 7811
7806 return 1; 7812 return 1;
7807 7813
7808 imagemagick_error: 7814 imagemagick_error:
7809 DestroyMagickWand (image_wand); 7815 DestroyMagickWand (image_wand);
7816 MagickWandTerminus ();
7810 /* TODO more cleanup. */ 7817 /* TODO more cleanup. */
7811 image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil); 7818 image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil);
7812 return 0; 7819 return 0;
@@ -8678,8 +8685,6 @@ of `dynamic-library-alist', which see). */)
8678#if defined (HAVE_IMAGEMAGICK) 8685#if defined (HAVE_IMAGEMAGICK)
8679 if (EQ (type, Qimagemagick)) 8686 if (EQ (type, Qimagemagick))
8680 { 8687 {
8681 /* MagickWandGenesis() initializes the imagemagick library. */
8682 MagickWandGenesis ();
8683 return CHECK_LIB_AVAILABLE (&imagemagick_type, init_imagemagick_functions, 8688 return CHECK_LIB_AVAILABLE (&imagemagick_type, init_imagemagick_functions,
8684 libraries); 8689 libraries);
8685 } 8690 }