Mercurial > hg > dmlib
changeset 1730:881a3fc421d8
Use the default C64 palette whenever we need it, but make it possible to override it.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 08 Jun 2018 22:03:19 +0300 |
parents | f4015f6cb173 |
children | 474055f25ab0 |
files | tools/64vw.c tools/gfxconv.c tools/lib64gfx.c tools/libgfx.c |
diffstat | 4 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/64vw.c Thu Jun 07 15:54:19 2018 +0300 +++ b/tools/64vw.c Fri Jun 08 22:03:19 2018 +0300 @@ -210,17 +210,23 @@ DMImage bmap; int ret; - bmap.size = surf->pitch * surf->h; - bmap.data = surf->pixels; - bmap.pitch = surf->pitch; - bmap.width = surf->w; - bmap.height = surf->h; + memset(&bmap, 0, sizeof(bmap)); + bmap.size = surf->pitch * surf->h; + bmap.data = surf->pixels; + bmap.pitch = surf->pitch; + bmap.width = surf->w; + bmap.height = surf->h; + bmap.ncolors = C64_NCOLORS; + bmap.constpal = TRUE; + bmap.pal = dmDefaultC64Palette; if (fmt->convertFrom != NULL) ret = fmt->convertFrom(&bmap, cimage, fmt); else ret = dmC64ConvertGenericBMP2Image(&bmap, cimage, fmt); + SDL_SetPaletteColors(surf->format->palette, (SDL_Color *) bmap.pal, 0, bmap.ncolors); + return ret; } @@ -485,7 +491,6 @@ goto exit; } - SDL_SetPaletteColors(surf->format->palette, (SDL_Color *)dmDefaultC64Palette, 0, C64_NCOLORS); if (texture != NULL) SDL_DestroyTexture(texture);
--- a/tools/gfxconv.c Thu Jun 07 15:54:19 2018 +0300 +++ b/tools/gfxconv.c Fri Jun 08 22:03:19 2018 +0300 @@ -1791,7 +1791,6 @@ goto error; } - dmSetDefaultC64Palette(outImage); res = dmWriteImage(optOutFilename, outImage, &optSpec, optOutSubFormat, TRUE); break; @@ -1814,7 +1813,6 @@ goto error; } - dmSetDefaultC64Palette(outImage); res = dmWriteSpritesAndChars(optOutFilename, outImage, optOutFormat, optInMulticolor); break;