diff options
author | Erik Reckase <e.reckase@gmail.com> | 2010-11-21 02:05:12 +0000 |
---|---|---|
committer | Scott Draves <spot@draves.org> | 2015-02-15 12:20:13 -0500 |
commit | b358966b64ccf5b25a8e5f92e0e2c15901454652 (patch) | |
tree | 8ac818cc3a30a64530bbc5ec17a6275cac0ae016 /src/png.c | |
parent | 26f5c53f097f58cbd11e00c30c31e1dfec3ece7b (diff) | |
download | pucket-b358966b64ccf5b25a8e5f92e0e2c15901454652.tar.gz pucket-b358966b64ccf5b25a8e5f92e0e2c15901454652.tar.bz2 pucket-b358966b64ccf5b25a8e5f92e0e2c15901454652.zip |
16 bpc PNG images were not being written properly when strips were being used. while png_set_swap() is supposed to tell the system to reverse the order of the bits when writing the file, I was unable to get this to work, so I resorted to a brute-force reversal of the bits - but then forgot to put the bits BACK. This is not a problem for single strips, but with multiple strips things get very confused. png_set_swap would make this a non-issue.
git-svn-id: https://flam3.googlecode.com/svn/trunk@88 77852712-ef1d-11de-8684-7d64432d61a3
Diffstat (limited to 'src/png.c')
-rwxr-xr-x | src/png.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -106,8 +106,6 @@ void write_png(FILE *file, void *image, int width, int height, flam3_img_comment im[i] = htons(im[i]); } } - - if (pngcom_enable==1) png_set_text(png_ptr, info_ptr, text, FLAM3_PNG_COM); @@ -117,6 +115,15 @@ void write_png(FILE *file, void *image, int width, int height, flam3_img_comment png_write_end(png_ptr, info_ptr); png_destroy_write_struct(&png_ptr, &info_ptr); free(rows); + + /* Swap back the bytes in case we're doing strips */ + if (2==bpc && testbe != htons(testbe)) { + unsigned short *im = (unsigned short *)image; + for (i=0; i<height*width*4; i++) { + im[i] = htons(im[i]); + } + } + } #define SIG_CHECK_SIZE 8 |