Mercurial > hg > dmlib
comparison tools/lib64gfx.c @ 2224:a36c81c3df85
Make color interlace type generate a mixed palette instead of using special
decode functions for it.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 14 Jun 2019 12:13:23 +0300 |
parents | 5477e792def3 |
children | 5db6e0b63b35 |
comparison
equal
deleted
inserted
replaced
2223:5477e792def3 | 2224:a36c81c3df85 |
---|---|
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 switch (op->type) | 1047 switch (op->type) |
1047 { | 1048 { |
1048 case DO_COPY: | 1049 case DO_COPY: |
1049 case DO_SET_MEM: | 1050 case DO_SET_MEM: |
1050 value = *src; | 1051 value = *src; |
1074 case DS_BGCOL: | 1075 case DS_BGCOL: |
1075 case DS_D021: img->bgcolor = value; break; | 1076 case DS_D021: img->bgcolor = value; break; |
1076 case DS_D022: img->d022 = value; break; | 1077 case DS_D022: img->d022 = value; break; |
1077 case DS_D023: img->d023 = value; break; | 1078 case DS_D023: img->d023 = value; break; |
1078 case DS_D024: img->d024 = value; break; | 1079 case DS_D024: img->d024 = value; break; |
1080 case DS_ILACE_TYPE: img->laceType = value; break; | |
1079 } | 1081 } |
1080 break; | 1082 break; |
1081 | 1083 |
1082 default: | 1084 default: |
1083 return dmError(DMERR_INTERNAL, | 1085 return dmError(DMERR_INTERNAL, |
1247 case DS_BGCOL: | 1249 case DS_BGCOL: |
1248 case DS_D021: | 1250 case DS_D021: |
1249 case DS_D022: | 1251 case DS_D022: |
1250 case DS_D023: | 1252 case DS_D023: |
1251 case DS_D024: | 1253 case DS_D024: |
1254 case DS_ILACE_TYPE: | |
1252 switch (op->subject) | 1255 switch (op->subject) |
1253 { | 1256 { |
1254 case DS_D020: value = img->d020; break; | 1257 case DS_D020: value = img->d020; break; |
1255 case DS_BGCOL: | 1258 case DS_BGCOL: |
1256 case DS_D021: value = img->bgcolor; break; | 1259 case DS_D021: value = img->bgcolor; break; |
1257 case DS_D022: value = img->d022; break; | 1260 case DS_D022: value = img->d022; break; |
1258 case DS_D023: value = img->d023; break; | 1261 case DS_D023: value = img->d023; break; |
1259 case DS_D024: value = img->d024; break; | 1262 case DS_D024: value = img->d024; break; |
1263 case DS_ILACE_TYPE: value = img->laceType; break; | |
1260 } | 1264 } |
1261 switch (op->type) | 1265 switch (op->type) |
1262 { | 1266 { |
1263 case DO_COPY: | 1267 case DO_COPY: |
1264 case DO_SET_MEM: | 1268 case DO_SET_MEM: |
1432 } | 1436 } |
1433 | 1437 |
1434 | 1438 |
1435 int dmC64ConvertBMP2Image(DMImage **pdst, const DMC64Image *src, const DMC64ImageConvSpec *spec) | 1439 int dmC64ConvertBMP2Image(DMImage **pdst, const DMC64Image *src, const DMC64ImageConvSpec *spec) |
1436 { | 1440 { |
1441 DMImage *dst; | |
1442 BOOL mixed; | |
1437 int res; | 1443 int res; |
1438 DMImage *dst; | |
1439 | 1444 |
1440 if (pdst == NULL || src == NULL || spec == NULL) | 1445 if (pdst == NULL || src == NULL || spec == NULL) |
1441 return DMERR_NULLPTR; | 1446 return DMERR_NULLPTR; |
1442 | 1447 |
1443 // Allocate image structure | 1448 // Allocate image structure |
1444 if ((*pdst = dst = dmImageAlloc( | 1449 if ((*pdst = dst = dmImageAlloc( |
1445 src->fmt->width, src->fmt->height, DM_PIXFMT_PALETTE, -1)) == NULL) | 1450 src->fmt->width, src->fmt->height, DM_PIXFMT_PALETTE, -1)) == NULL) |
1446 return DMERR_MALLOC; | 1451 return DMERR_MALLOC; |
1447 | 1452 |
1448 // Set palette information | 1453 // Set palette information |
1449 if ((res = dmC64SetImagePalette(dst, spec, FALSE)) != DMERR_OK) | 1454 mixed = (src->fmt->type & D64_FMT_ILACE) && src->laceType == D64_ILACE_COLOR; |
1455 if ((res = dmC64SetImagePalette(dst, spec, mixed)) != DMERR_OK) | |
1450 return res; | 1456 return res; |
1451 | 1457 |
1452 // Convert | 1458 // Convert |
1453 if (src->fmt->convertFrom != NULL) | 1459 if (src->fmt->convertFrom != NULL) |
1454 res = src->fmt->convertFrom(dst, src, spec); | 1460 res = src->fmt->convertFrom(dst, src, spec); |