Summary: | problem writing CMYK pdf with -sDEVICE=bmpsep8 on amd64 | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Michael Glauche <mg> |
Component: | Other Driver | Assignee: | Stefan Kemper <stefan.kemper> |
Status: | NOTIFIED FIXED | ||
Severity: | normal | CC: | dan.coby |
Priority: | P3 | ||
Version: | 8.51 | ||
Hardware: | PC | ||
OS: | Linux | ||
Customer: | Word Size: | --- | |
Attachments: |
dna.tar.bz2 -- local copy of the sample files
patch improved path |
Description
Michael Glauche
2005-07-28 08:45:45 UTC
Not surprsing since the problem appears on a 64 bit machine and not on 32 bit machines, the problem is related to the size of an integer. The problem appears to be in bmp_cmyk_print_page in gdevbmp.c and write_bmp_separated_header in gdevbmpc.c. According to the comments in gdevbmp.c, BMP files have each pixel rounded up to 32 bits. For the bmpsep8 device, pixels are 8 bits and the line width is 513 pixels. So each line in the bmp file should be 516 bytes. However in the bmp file from the problem report, raster lines appear to be 520 bytes. This is consistent with rounding up to 64 bits instead of 32 bits. The problem area seems to be the assumption that the bitmap_raster macro is only rounding the size of a raster line up to a byte boundary. Instead this macro is rounding up to either 32 or 64 bits (based upon the machine). The routines bmp_cmyk_print_page and write_bmp_separated_header then do their own rounding of the raster line size up to a 32 bit boundary. I do not have a 64 bit machine so I cannot verify a fix. It is probably simple. Created attachment 1584 [details]
dna.tar.bz2 -- local copy of the sample files
Created attachment 1587 [details]
patch
Fix calculation of the row width on 64-bit platforms. Remove bitmap_raster()
macro, because Windows bitmap is not affected by the source platform alignment
constrains.
that patch worked flawlessly, my test-pictures come out correctly now, thank you very much ! Alex, Looking at your patch, you only changed bmp_cmyk_print. I would assume that a similar change also needs to be made to write_bmp_separated_header. Otherwise I think that the header data will be inconsistent. Created attachment 1592 [details]
improved path
Fix calculation of the row width on 64-bit platforms. Remove bitmap_raster()
macro, because Windows bitmap is not affected by the source platform alignment
constrains. Initialize padding bytes to 0.
The files generated on Alpha and x86 are now identical.
The patch is committed to Head branch. |