aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorPaul Eggert2012-01-09 09:36:10 -0800
committerPaul Eggert2012-01-09 09:36:10 -0800
commit35cf62d95cdcd5323dcea4a5385942c342ff1d9c (patch)
tree90358cbb033a126c4d48793a80fd804b7baaca24 /src/image.c
parent59815c02506eb39b61e672528ed03885749ba529 (diff)
parent7655cb66d86564e792b825f1a0e1a4de7d6e6db5 (diff)
downloademacs-35cf62d95cdcd5323dcea4a5385942c342ff1d9c.tar.gz
emacs-35cf62d95cdcd5323dcea4a5385942c342ff1d9c.zip
Merge from trunk.
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/image.c b/src/image.c
index 736c1b3472f..92cd75f99f4 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1,5 +1,5 @@
1/* Functions for image support on window system. 1/* Functions for image support on window system.
2 Copyright (C) 1989, 1992-2011 Free Software Foundation, Inc. 2 Copyright (C) 1989, 1992-2012 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -7565,6 +7565,22 @@ extern WandExport void PixelGetMagickColor (const PixelWand *,
7565 MagickPixelPacket *); 7565 MagickPixelPacket *);
7566#endif 7566#endif
7567 7567
7568/* Log ImageMagick error message.
7569 Useful when a ImageMagick function returns the status `MagickFalse'. */
7570
7571static void
7572imagemagick_error (MagickWand *wand)
7573{
7574 char *description;
7575 ExceptionType severity;
7576
7577 description = MagickGetException (wand, &severity);
7578 image_error ("ImageMagick error: %s",
7579 make_string (description, strlen (description)),
7580 Qnil);
7581 description = (char *) MagickRelinquishMemory (description);
7582}
7583
7568/* Helper function for imagemagick_load, which does the actual loading 7584/* Helper function for imagemagick_load, which does the actual loading
7569 given contents and size, apart from frame and image structures, 7585 given contents and size, apart from frame and image structures,
7570 passed from imagemagick_load. Uses librimagemagick to do most of 7586 passed from imagemagick_load. Uses librimagemagick to do most of
@@ -7619,6 +7635,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
7619 image = image_spec_value (img->spec, QCindex, NULL); 7635 image = image_spec_value (img->spec, QCindex, NULL);
7620 ino = INTEGERP (image) ? XFASTINT (image) : 0; 7636 ino = INTEGERP (image) ? XFASTINT (image) : 0;
7621 ping_wand = NewMagickWand (); 7637 ping_wand = NewMagickWand ();
7638 /* MagickSetResolution (ping_wand, 2, 2); (Bug#10112) */
7622 7639
7623 if (filename != NULL) 7640 if (filename != NULL)
7624 { 7641 {
@@ -7629,7 +7646,12 @@ imagemagick_load_image (struct frame *f, struct image *img,
7629 status = MagickPingImageBlob (ping_wand, contents, size); 7646 status = MagickPingImageBlob (ping_wand, contents, size);
7630 } 7647 }
7631 7648
7632 MagickSetResolution (ping_wand, 2, 2); 7649 if (status == MagickFalse)
7650 {
7651 imagemagick_error (ping_wand);
7652 DestroyMagickWand (ping_wand);
7653 return 0;
7654 }
7633 7655
7634 if (! (0 <= ino && ino < MagickGetNumberImages (ping_wand))) 7656 if (! (0 <= ino && ino < MagickGetNumberImages (ping_wand)))
7635 { 7657 {
@@ -7670,7 +7692,10 @@ imagemagick_load_image (struct frame *f, struct image *img,
7670 { 7692 {
7671 image_wand = NewMagickWand (); 7693 image_wand = NewMagickWand ();
7672 if (MagickReadImageBlob (image_wand, contents, size) == MagickFalse) 7694 if (MagickReadImageBlob (image_wand, contents, size) == MagickFalse)
7673 goto imagemagick_error; 7695 {
7696 imagemagick_error (image_wand);
7697 goto imagemagick_error;
7698 }
7674 } 7699 }
7675 7700
7676 /* If width and/or height is set in the display spec assume we want 7701 /* If width and/or height is set in the display spec assume we want
@@ -7698,6 +7723,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
7698 if (status == MagickFalse) 7723 if (status == MagickFalse)
7699 { 7724 {
7700 image_error ("Imagemagick scale failed", Qnil, Qnil); 7725 image_error ("Imagemagick scale failed", Qnil, Qnil);
7726 imagemagick_error (image_wand);
7701 goto imagemagick_error; 7727 goto imagemagick_error;
7702 } 7728 }
7703 } 7729 }
@@ -7752,6 +7778,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
7752 if (status == MagickFalse) 7778 if (status == MagickFalse)
7753 { 7779 {
7754 image_error ("Imagemagick image rotate failed", Qnil, Qnil); 7780 image_error ("Imagemagick image rotate failed", Qnil, Qnil);
7781 imagemagick_error (image_wand);
7755 goto imagemagick_error; 7782 goto imagemagick_error;
7756 } 7783 }
7757 } 7784 }
@@ -7976,7 +8003,7 @@ recognize as images, such as C. See `imagemagick-types-inhibit'. */)
7976 Qimagemagicktype = intern (imtypes[i]); 8003 Qimagemagicktype = intern (imtypes[i]);
7977 typelist = Fcons (Qimagemagicktype, typelist); 8004 typelist = Fcons (Qimagemagicktype, typelist);
7978 } 8005 }
7979 return typelist; 8006 return Fnreverse (typelist);
7980} 8007}
7981 8008
7982#endif /* defined (HAVE_IMAGEMAGICK) */ 8009#endif /* defined (HAVE_IMAGEMAGICK) */