Mercurial > hg > dmlib
comparison tools/gfxconv.c @ 2142:894781b7310a
Possibly fix RAW output when clipping nplanes/bpp.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 02 Jun 2019 20:12:05 +0300 |
parents | 903effcd616b |
children | 693c3e73eb34 |
comparison
equal
deleted
inserted
replaced
2141:009ee261704c | 2142:894781b7310a |
---|---|
1442 | 1442 |
1443 allocated = TRUE; | 1443 allocated = TRUE; |
1444 } | 1444 } |
1445 | 1445 |
1446 // Determine number of planes, if paletted | 1446 // Determine number of planes, if paletted |
1447 if (spec->format == DM_COLFMT_PALETTE && | 1447 if (spec->nplanes == 0) |
1448 spec->nplanes == 0 && image->pal != NULL) | 1448 { |
1449 spec->nplanes = dmGetNPlanesFromNColors(image->pal->ncolors); | 1449 if (image->format == DM_COLFMT_PALETTE && |
1450 else | 1450 image->pal != NULL) |
1451 if (image->format == DM_COLFMT_GRAYSCALE) | 1451 spec->nplanes = dmGetNPlanesFromNColors(image->pal->ncolors); |
1452 spec->nplanes = 8; | 1452 else |
1453 if (image->format == DM_COLFMT_GRAYSCALE) | |
1454 spec->nplanes = image->bpp; | |
1455 } | |
1453 | 1456 |
1454 if (spec->nplanes <= 0) | 1457 if (spec->nplanes <= 0) |
1455 spec->nplanes = 4; | 1458 spec->nplanes = 4; |
1456 | 1459 |
1457 spec->fmtid = fmt->fmtid; | 1460 spec->fmtid = fmt->fmtid; |
1512 DMResource *fp; | 1515 DMResource *fp; |
1513 | 1516 |
1514 if (info) | 1517 if (info) |
1515 { | 1518 { |
1516 char *str; | 1519 char *str; |
1517 switch (spec->format) | 1520 switch (image->format) |
1518 { | 1521 { |
1519 case DM_COLFMT_PALETTE : str = "indexed/paletted"; break; | 1522 case DM_COLFMT_PALETTE : str = "indexed/paletted"; break; |
1520 case DM_COLFMT_RGB : str = "24bit RGB"; break; | 1523 case DM_COLFMT_RGB : str = "24bit RGB"; break; |
1521 case DM_COLFMT_RGBA : str = "32bit RGBA"; break; | 1524 case DM_COLFMT_RGBA : str = "32bit RGBA"; break; |
1522 default : str = "???"; break; | 1525 case DM_COLFMT_GRAYSCALE : str = "grayscale"; break; |
1526 default : str = "???"; break; | |
1523 } | 1527 } |
1524 dmMsg(2, "Using %s output.\n", str); | 1528 dmMsg(2, "Using %s output.\n", str); |
1525 } | 1529 } |
1526 | 1530 |
1527 if ((res = dmf_open_stdio(filename, "wb", &fp)) != DMERR_OK) | 1531 if ((res = dmf_open_stdio(filename, "wb", &fp)) != DMERR_OK) |