Mercurial > hg > dmlib
changeset 1362:7bc67ba68904
Better handling of resolution interlaced pictures.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 22 Sep 2017 16:25:25 +0300 |
parents | 00f47a678482 |
children | 3af0057f377d |
files | tools/lib64gfx.c |
diffstat | 1 files changed, 16 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/lib64gfx.c Fri Sep 22 16:24:53 2017 +0300 +++ b/tools/lib64gfx.c Fri Sep 22 16:25:25 2017 +0300 @@ -1037,6 +1037,11 @@ dmMemset(dst->data, 0, dst->size); + // Resolution interlaced pics need to halve the source width + int rwidth = src->width; + if ((src->type & D64_FMT_ILACE) && src->laceType == D64_ILACE_RES) + rwidth /= 2; + // Perform conversion for (yc = 0; yc < src->height; yc++) { @@ -1050,7 +1055,7 @@ // Charmode conversion if ((src->type & D64_FMT_MC) == D64_FMT_HIRES) // Hi-res charmap - for (xc = 0; xc < src->width; xc++) + for (xc = 0; xc < rwidth; xc++) { const int x = xc / 8; const int scroffs = scroffsy + x; @@ -1064,7 +1069,7 @@ } else // Multicolor variants - for (xc = 0; xc < src->width; xc++) + for (xc = 0; xc < rwidth; xc++) { const int x = xc / 4; const int scroffs = scroffsy + x; @@ -1099,7 +1104,7 @@ if ((src->type & D64_FMT_MC) == D64_FMT_HIRES) // Hi-res bitmap - for (xc = 0; xc < src->width; xc++) + for (xc = 0; xc < rwidth; xc++) { const int x = xc / 8; const int scroffs = scroffsy + x; @@ -1113,7 +1118,7 @@ } else // Multicolor bitmap and variants - for (xc = 0; xc < src->width; xc++) + for (xc = 0; xc < rwidth; xc++) { const int x = xc / 4; const int scroffs = scroffsy + x; @@ -1142,8 +1147,13 @@ else if (src->type & D64_FMT_ILACE) { - *d++ = dmC64GetMCColor(src, (src->bitmap[0][bmoffs] >> v) & 3, 0, src->laceBank1, scroffs); - *d++ = dmC64GetMCColor(src, (src->bitmap[1][bmoffs] >> v) & 3, 0, src->laceBank2, scroffs); + switch (src->laceType) + { + case D64_ILACE_RES: + *d++ = dmC64GetMCColor(src, (src->bitmap[0][bmoffs] >> v) & 3, 0, src->laceBank1, scroffs); + *d++ = dmC64GetMCColor(src, (src->bitmap[1][bmoffs] >> v) & 3, 0, src->laceBank2, scroffs); + break; + } } else {