New option --dump-palette. Fixed a double free in the cleanup code.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5604 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2012-03-11 11:25:38 +00:00
parent c9d65c56c2
commit ca691233e4
4 changed files with 63 additions and 1 deletions

View File

@@ -112,3 +112,29 @@ void FreePalette (Palette* P)
void DumpPalette (FILE* F, const Palette* P)
/* Dump the palette in readable form to the given file */
{
unsigned I;
fputs ("Entry R G B A Combined\n", F);
fputs ("----------------------------------------------\n", F);
for (I = 0; I < P->Count; ++I) {
/* Get the color entry */
const Color* C = P->Entries + I;
/* Output it */
fprintf (F,
" %3u %3u %3u %3u %3u #%08lX\n",
I,
C->R, C->G, C->B, C->A,
(((unsigned long) C->A) << 24) |
(((unsigned long) C->B) << 16) |
(((unsigned long) C->G) << 8) |
(((unsigned long) C->R) << 0));
}
}