Commit 469dc738 authored by Olaf Meeuwissen's avatar Olaf Meeuwissen

Only swap 16-bit PNG bytes on machines that are not big-endian

The SANE API specifies that image bytes are in machine native order.
parent 28eb09ee
......@@ -1529,7 +1529,8 @@ scan_it (FILE *ofp)
for(j = 0; j < parm.bytes_per_line; j++)
pngbuf[j] = ~pngbuf[j];
}
/* PNG is big-endian, */
#ifndef WORDS_BIGENDIAN
/* SANE is endian-native, PNG is big-endian, */
/* see: https://www.w3.org/TR/2003/REC-PNG-20031110/#7Integers-and-byte-order */
if (parm.depth == 16)
{
......@@ -1542,6 +1543,7 @@ scan_it (FILE *ofp)
pngbuf[j + 1] = LSB;
}
}
#endif
png_write_row(png_ptr, pngbuf);
i += parm.bytes_per_line - pngrow;
left -= parm.bytes_per_line - pngrow;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment