emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117134: Don't assume that ImageMagick uses a 16-bit


From: Paul Eggert
Subject: [Emacs-diffs] trunk r117134: Don't assume that ImageMagick uses a 16-bit quantum.
Date: Wed, 21 May 2014 19:52:03 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117134
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/17519
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Wed 2014-05-21 12:51:58 -0700
message:
  Don't assume that ImageMagick uses a 16-bit quantum.
  
  * image.c (imagemagick_load_image): Port to hosts that do not use
  a 16-bit quantum, i.e., QuantumRange does not equal 65535.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/image.c                    image.c-20091113204419-o5vbwnq5f7feedwu-2969
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-05-21 03:49:58 +0000
+++ b/src/ChangeLog     2014-05-21 19:51:58 +0000
@@ -1,3 +1,9 @@
+2014-05-21  Paul Eggert  <address@hidden>
+
+       Don't assume that ImageMagick uses a 16-bit quantum (Bug#17519).
+       * image.c (imagemagick_load_image): Port to hosts that do not use
+       a 16-bit quantum, i.e., QuantumRange does not equal 65535.
+
 2014-05-21  Leo Liu  <address@hidden>
 
        * fns.c (Fnreverse): Accept strings for SEQ and update doc-string.

=== modified file 'src/image.c'
--- a/src/image.c       2014-05-07 18:20:18 +0000
+++ b/src/image.c       2014-05-21 19:51:58 +0000
@@ -8368,6 +8368,7 @@
 #endif /* HAVE_MAGICKEXPORTIMAGEPIXELS */
     {
       size_t image_height;
+      double color_scale = 65535.0 / QuantumRange;
 
       /* Try to create a x pixmap to hold the imagemagick pixmap.  */
       if (!image_create_x_image_and_pixmap (f, img, width, height, 0,
@@ -8408,9 +8409,9 @@
               PixelGetMagickColor (pixels[x], &pixel);
               XPutPixel (ximg, x, y,
                          lookup_rgb_color (f,
-                                           pixel.red,
-                                           pixel.green,
-                                           pixel.blue));
+                                          color_scale * pixel.red,
+                                          color_scale * pixel.green,
+                                          color_scale * pixel.blue));
             }
         }
       DestroyPixelIterator (iterator);


reply via email to

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