#include "wx/imagtga.h"
#include "wx/log.h"
+#include "wx/scopeguard.h"
// ----------------------------------------------------------------------------
// constants
return wxTGA_MEMERR;
}
+ wxON_BLOCK_EXIT1(free, imageData);
+
unsigned char *dst = image->GetData();
unsigned char* alpha = NULL;
b[i] = buf[0];
}
- #if wxUSE_PALETTE
-
+#if wxUSE_PALETTE
// Set the palette of the image.
-
image->SetPalette(wxPalette(paletteLength, r, g, b));
-
- #endif // wxUSE_PALETTE
+#endif // wxUSE_PALETTE
delete[] r;
delete[] g;
switch (imageType)
{
+#if wxUSE_PALETTE
// Raw indexed.
case 1:
}
}
break;
+#endif // wxUSE_PALETTE
// Raw RGB.
}
break;
+#if wxUSE_PALETTE
// RLE indexed.
case 9:
}
}
break;
+#endif // wxUSE_PALETTE
// RLE RGB.
return wxTGA_INVFORMAT;
}
- free(imageData);
-
return wxTGA_OK;
}