From f31d963a643a0541ccbe47e119567aa3692c2f9d Mon Sep 17 00:00:00 2001 From: Freeimage Date: Sat, 4 Feb 2006 18:39:46 +0000 Subject: [PATCH] fixed a bug in codec/convert.c::imagetobmp --- ChangeLog | 3 +++ codec/convert.c | 30 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0aadb670..e3bb7d4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ What's New for OpenJPEG ! : changed + : added +February 04, 2006 +* [galt] fixed a bug in codec/convert.c::imagetobmp + February 01, 2006 ! [Herve Drolon] changed function definitions of INT and FIX modules to 'inline' + [Herve Drolon] added a VERSION resource to the DLL version of OpenJPEG diff --git a/codec/convert.c b/codec/convert.c index 5e4d9bf1..8be7c220 100644 --- a/codec/convert.c +++ b/codec/convert.c @@ -596,24 +596,24 @@ int imagetobmp(opj_image_t * image, char *outfile) { fprintf(fdest, "%c%c%c%c", (7834) & 0xff, ((7834) >> 8) & 0xff, ((7834) >> 16) & 0xff, ((7834) >> 24) & 0xff); fprintf(fdest, "%c%c%c%c", (256) & 0xff, ((256) >> 8) & 0xff, ((256) >> 16) & 0xff, ((256) >> 24) & 0xff); fprintf(fdest, "%c%c%c%c", (256) & 0xff, ((256) >> 8) & 0xff, ((256) >> 16) & 0xff, ((256) >> 24) & 0xff); - } - for (i = 0; i < 256; i++) { - fprintf(fdest, "%c%c%c%c", i, i, i, 0); - } - - for (i = 0; i < wr * hr; i++) { - /* a modifier !! */ - /* fprintf(fdest, "%c", image->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)]); */ - fprintf(fdest, "%c", image->comps[0].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)]); - /*if (((i + 1) % w == 0 && w % 2)) - fprintf(fdest, "%c", 0); */ - if ((i + 1) % wr == 0) { - for (pad = wr % 4 ? 4 - wr % 4 : 0; pad > 0; pad--) /* ADD */ - fprintf(fdest, "%c", 0); + for (i = 0; i < 256; i++) { + fprintf(fdest, "%c%c%c%c", i, i, i, 0); } + + for (i = 0; i < wr * hr; i++) { + /* a modifier !! */ + /* fprintf(fdest, "%c", image->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)]); */ + fprintf(fdest, "%c", image->comps[0].data[w * hr - ((i) / (wr) + 1) * w + (i) % (wr)]); + /*if (((i + 1) % w == 0 && w % 2)) + fprintf(fdest, "%c", 0); */ + if ((i + 1) % wr == 0) { + for (pad = wr % 4 ? 4 - wr % 4 : 0; pad > 0; pad--) /* ADD */ + fprintf(fdest, "%c", 0); + } + } + fclose(fdest); } - fclose(fdest); return 0; }