comparison tools/lib64gfx.c @ 2238:5db6e0b63b35

Change again how the interlace type information is stored. Now store it in DMC64Image::extraInfo[] where it actually makes sense. Also add index for FLI type.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 15 Jun 2019 06:43:36 +0300
parents a36c81c3df85
children 48b48251610a
comparison
equal deleted inserted replaced
2237:26f1bae40fb6 2238:5db6e0b63b35
1041 case DS_BGCOL: 1041 case DS_BGCOL:
1042 case DS_D021: 1042 case DS_D021:
1043 case DS_D022: 1043 case DS_D022:
1044 case DS_D023: 1044 case DS_D023:
1045 case DS_D024: 1045 case DS_D024:
1046 case DS_ILACE_TYPE: 1046 case DS_EXTRA_INFO:
1047 switch (op->type) 1047 switch (op->type)
1048 { 1048 {
1049 case DO_COPY: 1049 case DO_COPY:
1050 case DO_SET_MEM: 1050 case DO_SET_MEM:
1051 value = *src; 1051 value = *src;
1075 case DS_BGCOL: 1075 case DS_BGCOL:
1076 case DS_D021: img->bgcolor = value; break; 1076 case DS_D021: img->bgcolor = value; break;
1077 case DS_D022: img->d022 = value; break; 1077 case DS_D022: img->d022 = value; break;
1078 case DS_D023: img->d023 = value; break; 1078 case DS_D023: img->d023 = value; break;
1079 case DS_D024: img->d024 = value; break; 1079 case DS_D024: img->d024 = value; break;
1080 case DS_ILACE_TYPE: img->laceType = value; break; 1080 case DS_EXTRA_INFO: img->extraInfo[op->offs2] = value; break;
1081 } 1081 }
1082 break; 1082 break;
1083 1083
1084 default: 1084 default:
1085 return dmError(DMERR_INTERNAL, 1085 return dmError(DMERR_INTERNAL,
1123 break; 1123 break;
1124 } 1124 }
1125 } 1125 }
1126 1126
1127 // Sanity check certain things .. 1127 // Sanity check certain things ..
1128 if ((fmt->format->type & D64_FMT_ILACE) && img->laceType == D64_ILACE_NONE) 1128 if ((fmt->format->type & D64_FMT_ILACE) &&
1129 { 1129 img->extraInfo[D64_EI_ILACE_TYPE] == D64_ILACE_NONE) {
1130 return dmError(DMERR_INTERNAL, 1130 return dmError(DMERR_INTERNAL,
1131 "Format '%s' (%s) has interlace flag set, but interlace type is not set.\n", 1131 "Format '%s' (%s) has interlace flag set, but interlace type is not set.\n",
1132 fmt->name, fmt->fext); 1132 fmt->name, fmt->fext);
1133 } 1133 }
1134 1134
1249 case DS_BGCOL: 1249 case DS_BGCOL:
1250 case DS_D021: 1250 case DS_D021:
1251 case DS_D022: 1251 case DS_D022:
1252 case DS_D023: 1252 case DS_D023:
1253 case DS_D024: 1253 case DS_D024:
1254 case DS_ILACE_TYPE: 1254 case DS_EXTRA_INFO:
1255 switch (op->subject) 1255 switch (op->subject)
1256 { 1256 {
1257 case DS_D020: value = img->d020; break; 1257 case DS_D020: value = img->d020; break;
1258 case DS_BGCOL: 1258 case DS_BGCOL:
1259 case DS_D021: value = img->bgcolor; break; 1259 case DS_D021: value = img->bgcolor; break;
1260 case DS_D022: value = img->d022; break; 1260 case DS_D022: value = img->d022; break;
1261 case DS_D023: value = img->d023; break; 1261 case DS_D023: value = img->d023; break;
1262 case DS_D024: value = img->d024; break; 1262 case DS_D024: value = img->d024; break;
1263 case DS_ILACE_TYPE: value = img->laceType; break; 1263 case DS_EXTRA_INFO: value = img->extraInfo[op->offs2]; break;
1264 } 1264 }
1265 switch (op->type) 1265 switch (op->type)
1266 { 1266 {
1267 case DO_COPY: 1267 case DO_COPY:
1268 case DO_SET_MEM: 1268 case DO_SET_MEM:
1277 *dst |= value & 0x0f; 1277 *dst |= value & 0x0f;
1278 break; 1278 break;
1279 1279
1280 case DO_SET_OP: 1280 case DO_SET_OP:
1281 // Do nothing in this case 1281 // Do nothing in this case
1282 // XXX TODO: what about DS_EXTRA_INFO?
1282 break; 1283 break;
1283 1284
1284 default: 1285 default:
1285 return dmError(DMERR_INTERNAL, 1286 return dmError(DMERR_INTERNAL,
1286 "Unhandled op type %s in " 1287 "Unhandled op type %s in "
1449 if ((*pdst = dst = dmImageAlloc( 1450 if ((*pdst = dst = dmImageAlloc(
1450 src->fmt->width, src->fmt->height, DM_PIXFMT_PALETTE, -1)) == NULL) 1451 src->fmt->width, src->fmt->height, DM_PIXFMT_PALETTE, -1)) == NULL)
1451 return DMERR_MALLOC; 1452 return DMERR_MALLOC;
1452 1453
1453 // Set palette information 1454 // Set palette information
1454 mixed = (src->fmt->type & D64_FMT_ILACE) && src->laceType == D64_ILACE_COLOR; 1455 mixed = (src->fmt->type & D64_FMT_ILACE) &&
1456 src->extraInfo[D64_EI_ILACE_TYPE] == D64_ILACE_COLOR;
1457
1455 if ((res = dmC64SetImagePalette(dst, spec, mixed)) != DMERR_OK) 1458 if ((res = dmC64SetImagePalette(dst, spec, mixed)) != DMERR_OK)
1456 return res; 1459 return res;
1457 1460
1458 // Convert 1461 // Convert
1459 if (src->fmt->convertFrom != NULL) 1462 if (src->fmt->convertFrom != NULL)