comparison src/libgfx.c @ 1283:642a0dd98c6e

Oops, forgot to adjust the writing and reading when adding two members to the PCX header struct.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 18 Aug 2017 02:52:35 +0300
parents 767b6ad59599
children 28be63226b05
comparison
equal deleted inserted replaced
1282:086f49d616ac 1283:642a0dd98c6e
834 hdr.xmin = hdr.ymin = 0; 834 hdr.xmin = hdr.ymin = 0;
835 hdr.xmax = hdr.hres - 1; 835 hdr.xmax = hdr.hres - 1;
836 hdr.ymax = hdr.vres - 1; 836 hdr.ymax = hdr.vres - 1;
837 hdr.nplanes = dmImageGetBytesPerPixel(pcx.format); 837 hdr.nplanes = dmImageGetBytesPerPixel(pcx.format);
838 hdr.palInfo = 1; 838 hdr.palInfo = 1;
839 hdr.hScreenSize = hdr.hres;
840 hdr.vScreenSize = hdr.vres;
839 841
840 res = (img->width * spec->scaleX); 842 res = (img->width * spec->scaleX);
841 hdr.bpl = res / 2; 843 hdr.bpl = res / 2;
842 if (res % 2) hdr.bpl++; 844 if (res % 2) hdr.bpl++;
843 hdr.bpl *= 2; 845 hdr.bpl *= 2;
886 888
887 if (!dm_fwrite_byte(pcx.fp, hdr.reserved) || 889 if (!dm_fwrite_byte(pcx.fp, hdr.reserved) ||
888 !dm_fwrite_byte(pcx.fp, hdr.nplanes) || 890 !dm_fwrite_byte(pcx.fp, hdr.nplanes) ||
889 !dm_fwrite_le16(pcx.fp, hdr.bpl) || 891 !dm_fwrite_le16(pcx.fp, hdr.bpl) ||
890 !dm_fwrite_le16(pcx.fp, hdr.palInfo) || 892 !dm_fwrite_le16(pcx.fp, hdr.palInfo) ||
893 !dm_fwrite_le16(pcx.fp, hdr.hScreenSize) ||
894 !dm_fwrite_le16(pcx.fp, hdr.vScreenSize) ||
891 !dm_fwrite_str(pcx.fp, (Uint8 *) &hdr.filler, sizeof(hdr.filler))) 895 !dm_fwrite_str(pcx.fp, (Uint8 *) &hdr.filler, sizeof(hdr.filler)))
892 { 896 {
893 res = dmError(DMERR_FWRITE, 897 res = dmError(DMERR_FWRITE,
894 "PCX: Could not write header remainder.\n"); 898 "PCX: Could not write header remainder.\n");
895 goto error; 899 goto error;
1025 1029
1026 if (!dm_fread_byte(fp, &hdr.reserved) || 1030 if (!dm_fread_byte(fp, &hdr.reserved) ||
1027 !dm_fread_byte(fp, &hdr.nplanes) || 1031 !dm_fread_byte(fp, &hdr.nplanes) ||
1028 !dm_fread_le16(fp, &hdr.bpl) || 1032 !dm_fread_le16(fp, &hdr.bpl) ||
1029 !dm_fread_le16(fp, &hdr.palInfo) || 1033 !dm_fread_le16(fp, &hdr.palInfo) ||
1034 !dm_fread_le16(fp, &hdr.hScreenSize) ||
1035 !dm_fread_le16(fp, &hdr.vScreenSize) ||
1030 !dm_fread_str(fp, (Uint8 *) &hdr.filler, sizeof(hdr.filler))) 1036 !dm_fread_str(fp, (Uint8 *) &hdr.filler, sizeof(hdr.filler)))
1031 { 1037 {
1032 res = dmError(DMERR_FREAD, 1038 res = dmError(DMERR_FREAD,
1033 "PCX: Could not read header remainder.\n"); 1039 "PCX: Could not read header remainder.\n");
1034 goto error; 1040 goto error;