Mercurial > hg > dmlib
changeset 410:e4b2f689aff6
Stdint -> SDL types conversion.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 03 Nov 2012 02:41:15 +0200 |
parents | b529b7e8ff83 |
children | 4e52354e5c25 |
files | lib64gfx.c lib64gfx.h |
diffstat | 2 files changed, 49 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/lib64gfx.c Sat Nov 03 02:40:07 2012 +0200 +++ b/lib64gfx.c Sat Nov 03 02:41:15 2012 +0200 @@ -61,7 +61,7 @@ img->width = img->pitch = width; img->height = height; - img->data = dmMalloc(width * height * sizeof(uint8_t)); + img->data = dmMalloc(width * height * sizeof(Uint8)); if (img->data == NULL) { dmFree(img); @@ -100,11 +100,11 @@ int dmC64ConvertCSData(DMImage *img, - int xoffs, int yoffs, const uint8_t *buf, + int xoffs, int yoffs, const Uint8 *buf, int width, int height, BOOL multicolor, int *colors) { int yc, widthpx = width * 8; - uint8_t *dp; + Uint8 *dp; if (img == NULL) return -1; @@ -122,13 +122,13 @@ { const int offs = yc * width; int xc; - uint8_t *d = dp; + Uint8 *d = dp; for (xc = 0; xc < widthpx / 2; xc++) { const int b = buf[offs + (xc / 4)]; const int v = 6 - ((xc * 2) & 6); - const uint8_t c = colors[(b >> v) & 3]; + const Uint8 c = colors[(b >> v) & 3]; *d++ = c; *d++ = c; @@ -143,13 +143,13 @@ { const int offs = yc * width; int xc; - uint8_t *d = dp; + Uint8 *d = dp; for (xc = 0; xc < widthpx; xc++) { const int b = buf[offs + (xc / 8)]; const int v = 7 - (xc & 7); - const uint8_t c = colors[(b >> v) & 1]; + const Uint8 c = colors[(b >> v) & 1]; *d++ = c; } @@ -162,7 +162,7 @@ } -static int fmtProbeDrazPaint(const uint8_t *buf, const size_t len) +static int fmtProbeDrazPaint(const Uint8 *buf, const size_t len) { if (len == 10051 && buf[0] == 0x00 && buf[1] == 0x58) return DM_PROBE_SCORE_GOOD; @@ -171,7 +171,7 @@ } -static int fmtProbeDrazPaint20Packed(const uint8_t *buf, const size_t len) +static int fmtProbeDrazPaint20Packed(const Uint8 *buf, const size_t len) { const char *ident = (const char *) buf + 2; if (len > 22 && buf[0] == 0x00 && buf[1] == 0x58 && @@ -186,12 +186,12 @@ } -static int fmtDecodeDrazPaintPacked(DMC64Image *img, const uint8_t *buf, const size_t len, const DMC64ImageFormat *fmt) +static int fmtDecodeDrazPaintPacked(DMC64Image *img, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) { int res; - uint8_t rleMarker; - uint8_t *mem, *dst, *dstEnd; - const uint8_t *src, *srcEnd; + Uint8 rleMarker; + Uint8 *mem, *dst, *dstEnd; + const Uint8 *src, *srcEnd; if ((mem = dmMalloc(C64_RAM_SIZE)) == NULL) return -1; @@ -224,7 +224,7 @@ } -static int fmtProbeDrazLace10(const uint8_t *buf, const size_t len) +static int fmtProbeDrazLace10(const Uint8 *buf, const size_t len) { if (len == 18242 && buf[0] == 0x00 && buf[1] == 0x58) return DM_PROBE_SCORE_GOOD; @@ -232,7 +232,7 @@ } -static int fmtProbeDrazLace10Packed(const uint8_t *buf, const size_t len) +static int fmtProbeDrazLace10Packed(const Uint8 *buf, const size_t len) { const char *ident = (const char *) buf + 2; if (len > 22 && buf[0] == 0x00 && buf[1] == 0x58 && @@ -243,7 +243,7 @@ } -static BOOL fmtDrazLaceSetLaceType(DMC64Image *img, const struct _DMDecodeOp *op, const uint8_t *buf, const size_t len) +static BOOL fmtDrazLaceSetLaceType(DMC64Image *img, const struct _DMDecodeOp *op, const Uint8 *buf, const size_t len) { img->laceType = buf[op->offs] ? DM_C64ILACE_RES : DM_C64ILACE_COLOR; img->laceBank2 = 0; @@ -252,7 +252,7 @@ #define AMICA_DM_PROBE_SIZE 1024 -static int fmtProbeAmicaPaintPacked(const uint8_t *buf, const size_t len) +static int fmtProbeAmicaPaintPacked(const Uint8 *buf, const size_t len) { int i, n; if (len < AMICA_DM_PROBE_SIZE || buf[0] != 0x00 || buf[1] != 0x40) @@ -270,11 +270,11 @@ } -static int fmtDecodeAmicaPaintPacked(DMC64Image *img, const uint8_t *buf, const size_t len, const DMC64ImageFormat *fmt) +static int fmtDecodeAmicaPaintPacked(DMC64Image *img, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) { int res; - uint8_t *mem, *dst, *dstEnd; - const uint8_t *src, *srcEnd; + Uint8 *mem, *dst, *dstEnd; + const Uint8 *src, *srcEnd; if ((mem = dmMalloc(C64_RAM_SIZE)) == NULL) return -1; @@ -306,7 +306,7 @@ } -static int fmtProbeKoalaPaint(const uint8_t *buf, const size_t len) +static int fmtProbeKoalaPaint(const Uint8 *buf, const size_t len) { if (len == 10003 && buf[0] == 0x00 && buf[1] == 0x60) return DM_PROBE_SCORE_AVG; @@ -314,7 +314,7 @@ } -static int fmtProbeTruePaint(const uint8_t *buf, const size_t len) +static int fmtProbeTruePaint(const Uint8 *buf, const size_t len) { if (len == 19434 && buf[0] == 0x00 && buf[1] == 0x9c) return DM_PROBE_SCORE_GOOD; @@ -322,7 +322,7 @@ } -static BOOL fmtTruePaintSetLaceType(DMC64Image *img, const struct _DMDecodeOp *op, const uint8_t *buf, const size_t len) +static BOOL fmtTruePaintSetLaceType(DMC64Image *img, const struct _DMDecodeOp *op, const Uint8 *buf, const size_t len) { img->laceType = DM_C64ILACE_RES; img->laceBank2 = 1; @@ -428,7 +428,7 @@ const int ndmC64ImageFormats = sizeof(dmC64ImageFormats) / sizeof(dmC64ImageFormats[0]); -int dmC64ProbeGeneric(const uint8_t *buf, const size_t len, +int dmC64ProbeGeneric(const Uint8 *buf, const size_t len, DMC64ImageFormat **pfmt) { int i, scoreMax = 0, scoreIndex = -1; @@ -454,7 +454,7 @@ } -int dmC64DecodeGenericBMP(DMC64Image *img, const uint8_t *buf, +int dmC64DecodeGenericBMP(DMC64Image *img, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) { int i; @@ -465,7 +465,7 @@ for (i = 0; i < fmt->ndecodeOps; i++) { const DMDecodeOp *op = &fmt->decodeOps[i]; - const uint8_t *src; + const Uint8 *src; size_t size; if (op->bank < 0 || op->bank >= C64_SCR_MAX_BANK) @@ -524,11 +524,11 @@ static int dmC64ConvertHiResBMP(DMImage *screen, const DMC64Image *img) { int yc; - uint8_t *dp = screen->data; + Uint8 *dp = screen->data; for (yc = 0; yc < C64_SCR_HEIGHT; yc++) { - uint8_t *d = dp; + Uint8 *d = dp; const int y = yc / 8, yb = yc & 7; const int scroffsy = y * C64_SCR_CH_WIDTH; const int bmoffsy = y * C64_SCR_WIDTH; @@ -540,7 +540,7 @@ const int scroffs = scroffsy + x; const int b = img->bitmap[0][bmoffsy + (x * 8) + yb]; const int v = 7 - (xc & 7); - uint8_t c; + Uint8 c; if ((b >> v) & 1) c = img->screen[0][scroffs] & 15; @@ -560,11 +560,11 @@ static int dmC64ConvertMultiColorBMP(DMImage *screen, const DMC64Image *img) { int yc; - uint8_t *dp = screen->data; + Uint8 *dp = screen->data; for (yc = 0; yc < C64_SCR_HEIGHT; yc++) { - uint8_t *d = dp; + Uint8 *d = dp; const int y = yc / 8, yb = yc & 7; const int scroffsy = y * C64_SCR_CH_WIDTH; const int bmoffsy = y * C64_SCR_WIDTH; @@ -576,7 +576,7 @@ const int scroffs = scroffsy + x; const int b = img->bitmap[0][bmoffsy + (x * 8) + yb]; const int v = 6 - ((xc * 2) & 6); - uint8_t c; + Uint8 c; switch ((b >> v) & 3) { @@ -600,11 +600,11 @@ static int dmC64ConvertLaceMultiColorBMP(DMImage *screen, const DMC64Image *img) { int yc; - uint8_t *dp = screen->data; + Uint8 *dp = screen->data; for (yc = 0; yc < C64_SCR_HEIGHT; yc++) { - uint8_t *d = dp; + Uint8 *d = dp; const int y = yc / 8, yb = yc & 7; const int scroffsy = y * C64_SCR_CH_WIDTH; const int bmoffsy = y * C64_SCR_WIDTH; @@ -618,7 +618,7 @@ const int v = 6 - ((xc * 2) & 6); const int b1 = (img->bitmap[0][bmoffs] >> v) & 3; const int b2 = (img->bitmap[1][bmoffs] >> v) & 3; - uint8_t c1, c2; + Uint8 c1, c2; switch (b1) { @@ -669,10 +669,10 @@ #define BUF_SIZE_INITIAL (16*1024) #define BUF_SIZE_GROW (2*1024) -int dmReadDataFile(const char *filename, uint8_t **pbuf, size_t *pbufSize) +int dmReadDataFile(const char *filename, Uint8 **pbuf, size_t *pbufSize) { FILE *f; - uint8_t *dataBuf = NULL, *dataPtr; + Uint8 *dataBuf = NULL, *dataPtr; size_t bufSize, readSize, dataSize; if (filename == NULL)
--- a/lib64gfx.h Sat Nov 03 02:40:07 2012 +0200 +++ b/lib64gfx.h Sat Nov 03 02:41:15 2012 +0200 @@ -63,7 +63,7 @@ // RGBx color struct typedef struct { - uint8_t r, g, b, x; + Uint8 r, g, b, x; } DMColor; @@ -74,7 +74,7 @@ BOOL constpal; int ncolors, ctrans; DMColor *pal; - uint8_t *data; + Uint8 *data; } DMImage; @@ -102,7 +102,7 @@ { BOOL multicolor, xexpand, yexpand; int color, xc, yc; - uint8_t data[C64_SPR_HEIGHT][C64_SPR_WIDTH]; + Uint8 data[C64_SPR_HEIGHT][C64_SPR_WIDTH]; } DMC64Sprite; @@ -114,13 +114,13 @@ fliLines, // FLI on every # line laceBank2; - uint8_t color[C64_SCR_MAX_BANK][C64_SCR_COLOR_SIZE], + Uint8 color[C64_SCR_MAX_BANK][C64_SCR_COLOR_SIZE], bitmap[C64_SCR_MAX_BANK][C64_SCR_BITMAP_SIZE], screen[C64_SCR_MAX_BANK][C64_SCR_SCREEN_SIZE], extradata[C64_SCR_EXTRADATA], d020, bgcolor, d022, d023, d024; - uint8_t charset[C64_MAX_CHARS][C64_CHR_HEIGHT * C64_CHR_WIDTH]; + Uint8 charset[C64_MAX_CHARS][C64_CHR_HEIGHT * C64_CHR_WIDTH]; DMC64Sprite sprites[C64_MAX_SPRITES]; } DMC64Image; @@ -145,7 +145,7 @@ size_t offs; int bank; size_t size; - BOOL (*function)(DMC64Image *img, const struct _DMDecodeOp *op, const uint8_t *buf, const size_t len); + BOOL (*function)(DMC64Image *img, const struct _DMDecodeOp *op, const Uint8 *buf, const size_t len); } DMDecodeOp; @@ -154,8 +154,8 @@ int type; char *extension; char *name; - int (*probe)(const uint8_t *buf, const size_t len); - int (*decode)(DMC64Image *img, const uint8_t *buf, const size_t len, const struct _DMC64ImageFormat *fmt); + int (*probe)(const Uint8 *buf, const size_t len); + int (*decode)(DMC64Image *img, const Uint8 *buf, const size_t len, const struct _DMC64ImageFormat *fmt); int (*convert)(DMImage *, DMC64Image *); int ndecodeOps; @@ -175,10 +175,10 @@ int dmImageGetBytesPerPixel(int format); -int dmC64ConvertCSData(DMImage *img, int xoffs, int yoffs, const uint8_t *inBuf, int width, int height, BOOL multicolor, int *colors); -int dmC64ProbeGeneric(const uint8_t *buf, const size_t len, DMC64ImageFormat **fmt); -int dmC64DecodeGenericBMP(DMC64Image *img, const uint8_t *buf, const size_t len, const DMC64ImageFormat *fmt); +int dmC64ConvertCSData(DMImage *img, int xoffs, int yoffs, const Uint8 *inBuf, int width, int height, BOOL multicolor, int *colors); +int dmC64ProbeGeneric(const Uint8 *buf, const size_t len, DMC64ImageFormat **fmt); +int dmC64DecodeGenericBMP(DMC64Image *img, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt); int dmC64ConvertGenericBMP2Image(DMImage *screen, const DMC64Image *img); -int dmReadDataFile(const char *filename, uint8_t **buf, size_t *size); +int dmReadDataFile(const char *filename, Uint8 **buf, size_t *size); #endif // LIB64GFX_H