162 |
|
if (hdr == NULL) |
163 |
|
quiterr("cannot initialize BMP header"); |
164 |
|
/* set up output direction */ |
165 |
< |
hdr->yIsDown = (rs.rt & YDECR) && |
166 |
< |
((outfile == NULL) | (hdr->compr == BI_RLE8)); |
165 |
> |
hdr->yIsDown = ((outfile == NULL) | (hdr->compr == BI_RLE8)); |
166 |
|
/* open BMP output */ |
167 |
|
if (outfile != NULL) |
168 |
|
wtr = BMPopenOutputFile(outfile, hdr); |
171 |
|
if (wtr == NULL) |
172 |
|
quiterr("cannot allocate writer structure"); |
173 |
|
/* convert file */ |
174 |
< |
rad2bmp(stdin, wtr, !hdr->yIsDown && rs.rt&YDECR, rgbp==NULL); |
174 |
> |
rad2bmp(stdin, wtr, !hdr->yIsDown, rgbp==NULL); |
175 |
|
/* flush output */ |
176 |
|
if (fflush((FILE *)wtr->c_data) < 0) |
177 |
|
quiterr("error writing BMP output"); |
348 |
|
/* write to BMP file */ |
349 |
|
while (wtr->yscan < yr) { |
350 |
|
BYTE *scn = pa + xr*((tmflags & TM_F_BW) ? 1 : 3)* |
351 |
< |
((rs.rt & YDECR) ? |
353 |
< |
(yr-1 - wtr->yscan) : |
354 |
< |
wtr->yscan); |
351 |
> |
(yr-1 - wtr->yscan); |
352 |
|
if (tmflags & TM_F_BW) |
353 |
|
memcpy((void *)wtr->scanline, (void *)scn, xr); |
354 |
|
else |