GraphicsMagick: coders/bmp.c Do not throttle on native low endia...

GraphicsMagick Commits <[email protected]> Thu, 17 Aug 2023 18:03:05 -0500
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.10249.1692313397.8047.graphicsmagick-commit@lists.sourceforge.net>
changeset 53359673ab0b in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=53359673ab0b
summary: coders/bmp.c Do not throttle on native low endian systems.

diffstat:

 ChangeLog    |   4 ++++
 coders/bmp.c |  10 ++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diffs (44 lines):

diff -r 324f3d32cc24 -r 53359673ab0b ChangeLog
--- a/ChangeLog	Thu Aug 17 08:17:38 2023 -0500
+++ b/ChangeLog	Fri Aug 18 01:02:42 2023 +0200
@@ -1,3 +1,7 @@
+2023-08-17  Fojtik Jaroslav  <[email protected]>
+
+	* coders/bmp.c Do not throttle on native low endian systems.
+
 2023-08-16  Fojtik Jaroslav  <[email protected]>
 
 	* coders/bmp.c  Populate upper byte to lower byte even for lower
diff -r 324f3d32cc24 -r 53359673ab0b coders/bmp.c
--- a/coders/bmp.c	Thu Aug 17 08:17:38 2023 -0500
+++ b/coders/bmp.c	Fri Aug 18 01:02:42 2023 +0200
@@ -1441,8 +1441,13 @@
                   break;
                 for (x=0; x < (long) image->columns; x++)
                   {
+#ifdef WORDS_BIGENDIAN
                     pixel=(*p++);
                     pixel|=(*p++) << 8;
+#else
+                    pixel = *(magick_uint16_t*)p;
+                    p += 2;
+#endif
                     red=((pixel & bmp_info.red_mask) << shift.red) >> 16;
                     if (quantum_bits.red <= 8)          /* TODO: this is ugly, but better than nothing. Should be reworked. */
                       red|=(red >> 8);
@@ -1534,10 +1539,15 @@
                   break;
                 for (x=0; x < (long) image->columns; x++)
                   {
+#ifdef WORDS_BIGENDIAN
                     pixel =((magick_uint32_t) *p++);
                     pixel|=((magick_uint32_t) *p++ << 8);
                     pixel|=((magick_uint32_t) *p++ << 16);
                     pixel|=((magick_uint32_t) *p++ << 24);
+#else
+                    pixel = *(magick_uint32_t*)p;
+                    p += 4;
+#endif
                     red=((pixel & bmp_info.red_mask) << shift.red) >> 16;
                     if (quantum_bits.red <= 8)
                       red|=(red >> 8);