Mercurial > hg > dmlib
comparison tools/64vw.c @ 2094:4276b8c0fef0
Revamp how the DMImage palette system and color formats work, as preparation
for future work on supporting non-indexed/paletted images. It is still messy.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 05 Mar 2019 09:56:47 +0200 |
parents | dcca36701cdd |
children | e0281dae2cb8 |
comparison
equal
deleted
inserted
replaced
2093:d17512dbb4ef | 2094:4276b8c0fef0 |
---|---|
218 bmap.size = surf->pitch * surf->h; | 218 bmap.size = surf->pitch * surf->h; |
219 bmap.data = surf->pixels; | 219 bmap.data = surf->pixels; |
220 bmap.pitch = surf->pitch; | 220 bmap.pitch = surf->pitch; |
221 bmap.width = surf->w; | 221 bmap.width = surf->w; |
222 bmap.height = surf->h; | 222 bmap.height = surf->h; |
223 bmap.ncolors = C64_NCOLORS; | 223 |
224 bmap.constpal = TRUE; | 224 if ((ret = dmSetDefaultC64Palette(&bmap)) != DMERR_OK) |
225 bmap.pal = dmDefaultC64Palette; | 225 return ret; |
226 | 226 |
227 if (fmt->format->convertFrom != NULL) | 227 if (fmt->format->convertFrom != NULL) |
228 ret = fmt->format->convertFrom(&bmap, cimage, fmt, spec); | 228 ret = fmt->format->convertFrom(&bmap, cimage, fmt, spec); |
229 else | 229 else |
230 ret = dmC64ConvertGenericBMP2Image(&bmap, cimage, fmt, spec); | 230 ret = dmC64ConvertGenericBMP2Image(&bmap, cimage, fmt, spec); |
231 | 231 |
232 SDL_SetPaletteColors(surf->format->palette, (SDL_Color *) bmap.pal, 0, bmap.ncolors); | 232 SDL_SetPaletteColors(surf->format->palette, (SDL_Color *) bmap.pal->colors, 0, bmap.pal->ncolors); |
233 | |
234 dmPaletteFree(bmap.pal); | |
233 | 235 |
234 return ret; | 236 return ret; |
235 } | 237 } |
236 | 238 |
237 | 239 |