Mercurial > hg > dmlib
changeset 22:997e26f17946
Initial fixes for getting the line drawing functions "working".
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 28 Sep 2012 15:15:33 +0300 |
parents | 49cc9a173427 |
children | f2f6963080bd |
files | dmdrawline.h dmline.c dmlinefunc.h |
diffstat | 3 files changed, 10 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/dmdrawline.h Fri Sep 28 14:52:40 2012 +0300 +++ b/dmdrawline.h Fri Sep 28 15:15:33 2012 +0300 @@ -1,10 +1,5 @@ -#ifdef DM_USE_SIMD -static int DM_DRAWLINE_NAME_ASM (SDL_Surface *screen, int x0, int y0, int x1, int y1, const Uint32 col); -#endif - -#ifdef DM_USE_C -static int DM_DRAWLINE_NAME_C (SDL_Surface *screen, int x0, int y0, int x1, int y1, const Uint32 col) +static int DM_DRAWLINE_NAME (SDL_Surface *screen, int x0, int y0, int x1, int y1, const Uint32 col) { int dx, dy, xstep, ystep; const int qpitch = screen->pitch / DM_DRAWLINE_DST_BYTES; @@ -77,10 +72,7 @@ return 0; } -#endif #undef DM_DRAWLINE_NAME -#undef DM_DRAWLINE_NAME_ASM -#undef DM_DRAWLINE_NAME_C #undef DM_DRAWLINE_DST_BYTES #undef DM_DRAWLINE_DST_TYPE
--- a/dmline.c Fri Sep 28 14:52:40 2012 +0300 +++ b/dmline.c Fri Sep 28 15:15:33 2012 +0300 @@ -47,25 +47,29 @@ static const DMDrawLineFunc dmDrawLineTable[DMD_NMODES][DMD_NBITDEPTHS] = { /* DMD_NONE */ { dmDrawLine8 , dmDrawLine32 }, +#if 0 /* DMD_TRANSPARENT */ { dmDrawLine8Transparent , dmDrawLine32Transparent }, /* DMD_SATURATE */ { dmDrawLine8Saturate , dmDrawLine32Saturate }, + /* DMD_NONE + AA */ { NULL, NULL }, /* DMD_TRANSP + AA */ { NULL, NULL }, /* DMD_SATURATE + AA */ { dmDrawLine8AASaturate , dmDrawLine32AASaturate }, +#endif }; +static const int ndmDrawLineTable = sizeof(dmDrawLineTable) / sizeof(dmDrawLineTable[0]); + DMDrawLineFunc dmGetDrawLineFunc(SDL_PixelFormat *dst, int mode) { int index; - if (dst == NULL || mode < 0 || - mode >= sizeof(dmDrawLineTable) / sizeof(dmDrawLineTable[0])) + if (dst == NULL || mode < 0 || mode >= ndmDrawLineTable) return NULL; - if ((index = dmBitsPerPixel2Index(src->BitsPerPixel)) < 0) + if ((index = dmBitsPerPixel2Index(dst->BitsPerPixel)) < 0) return NULL; - return dmDrawLineTable[mode] + return dmDrawLineTable[mode][index]; } @@ -78,4 +82,3 @@ return bfunc(screen, x0, y0, x1, y1, col); } -
--- a/dmlinefunc.h Fri Sep 28 14:52:40 2012 +0300 +++ b/dmlinefunc.h Fri Sep 28 15:15:33 2012 +0300 @@ -8,23 +8,12 @@ #include "dmdrawline.h" -#define DM_DRAWLINE_NAME dmDrawLine15 -#define DM_DRAWLINE_DST_BYTES 2 -#define DM_DRAWLINE_DST_TYPE Uint16 -#include "dmdrawline.h" - - -#define DM_DRAWLINE_NAME dmDrawLine16 -#define DM_DRAWLINE_DST_BYTES 2 -#define DM_DRAWLINE_DST_TYPE Uint16 -#include "dmdrawline.h" - - #define DM_DRAWLINE_NAME dmDrawLine32 #define DM_DRAWLINE_DST_BYTES 4 #define DM_DRAWLINE_DST_TYPE Uint32 #include "dmdrawline.h" + /* #undef DM_DRAWLINE_INNER #define DM_DRAWLINE_INNER \