emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113928: (imagemagick_load_image): Remove the ping_w


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] trunk r113928: (imagemagick_load_image): Remove the ping_wand code
Date: Fri, 16 Aug 2013 15:31:12 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113928
revision-id: address@hidden
parent: address@hidden
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Fri 2013-08-16 17:31:04 +0200
message:
  (imagemagick_load_image): Remove the ping_wand code
  
  The apparently only saved time on invalid animated images, and slowed
  down everything else.  Optimise for the common case.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/image.c                    image.c-20091113204419-o5vbwnq5f7feedwu-2969
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-08-16 15:10:13 +0000
+++ b/src/ChangeLog     2013-08-16 15:31:04 +0000
@@ -2,6 +2,9 @@
 
        * image.c: Implement an ImageMagick per-image cache.
        (imagemagick_get_animation_cache): Fix a double-free error.
+       (imagemagick_load_image): Remove the ping_wand code, which only
+       apparently saved time on invalid animated images, and slowed down
+       everything else.  Optimise for the common case.
 
 2013-08-16  Xue Fuqiao  <address@hidden>
 

=== modified file 'src/image.c'
--- a/src/image.c       2013-08-16 15:13:42 +0000
+++ b/src/image.c       2013-08-16 15:31:04 +0000
@@ -8095,7 +8095,6 @@
   XImagePtr ximg;
   int x, y;
   MagickWand *image_wand;
-  MagickWand *ping_wand;
   PixelIterator *iterator;
   PixelWand **pixels, *bg_wand = NULL;
   MagickPixelPacket  pixel;
@@ -8118,60 +8117,38 @@
   MagickWandGenesis ();
   image = image_spec_value (img->spec, QCindex, NULL);
   ino = INTEGERP (image) ? XFASTINT (image) : 0;
-  ping_wand = NewMagickWand ();
-  /* MagickSetResolution (ping_wand, 2, 2);   (Bug#10112)  */
+  image_wand = NewMagickWand ();
 
   if (filename)
-    status = MagickPingImage (ping_wand, filename);
+    status = MagickReadImage (image_wand, filename);
   else
     {
       filename_hint = imagemagick_filename_hint (img->spec, hint_buffer);
-      MagickSetFilename (ping_wand, filename_hint);
-      status = MagickPingImageBlob (ping_wand, contents, size);
+      MagickSetFilename (image_wand, filename_hint);
+      status = MagickReadImageBlob (image_wand, contents, size);
     }
 
   if (status == MagickFalse)
     {
-      imagemagick_error (ping_wand);
-      DestroyMagickWand (ping_wand);
+      imagemagick_error (image_wand);
+      DestroyMagickWand (image_wand);
       return 0;
     }
 
-  if (ino < 0 || ino >= MagickGetNumberImages (ping_wand))
+  if (ino < 0 || ino >= MagickGetNumberImages (image_wand))
     {
       image_error ("Invalid image number `%s' in image `%s'",
                   image, img->spec);
-      DestroyMagickWand (ping_wand);
+      DestroyMagickWand (image_wand);
       return 0;
     }
 
-  if (MagickGetNumberImages (ping_wand) > 1)
+  if (MagickGetNumberImages (image_wand) > 1)
     img->lisp_data =
       Fcons (Qcount,
-             Fcons (make_number (MagickGetNumberImages (ping_wand)),
+             Fcons (make_number (MagickGetNumberImages (image_wand)),
                     img->lisp_data));
 
-  DestroyMagickWand (ping_wand);
-
-  /* Now we know how many images are inside the file.  If it's not a
-     bundle, the number is one.  Load the image data.  */
-
-  image_wand = NewMagickWand ();
-
-  if (filename)
-    status = MagickReadImage (image_wand, filename);
-  else
-    {
-      MagickSetFilename (image_wand, filename_hint);
-      status = MagickReadImageBlob (image_wand, contents, size);
-    }
-
-  if (status == MagickFalse)
-    {
-      imagemagick_error (image_wand);
-      goto imagemagick_error;
-    }
-
   /* If we have an animated image, get the new wand based on the
      "super-wand". */
   if (MagickGetNumberImages (image_wand) > 1)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]