Mercurial > hg > dmlib
diff dmlib.h @ 90:1ab3fd8b9afc
Move some very tiny gfx functions to the dmlib header as static inline ones.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 02 Oct 2012 16:37:58 +0300 |
parents | f28cd66356f6 |
children | 0430f484641b |
line wrap: on
line diff
--- a/dmlib.h Tue Oct 02 15:52:44 2012 +0300 +++ b/dmlib.h Tue Oct 02 16:37:58 2012 +0300 @@ -244,10 +244,29 @@ void dmDrawHLine(SDL_Surface *screen, int x0, int x1, int yc, const Uint32 col); void dmDrawVLine(SDL_Surface *screen, int y0, int y1, int xc, const Uint32 col); void dmDrawBox3D(SDL_Surface *screen, int x0, int y0, int x1, int y1, Uint32 bgcol, Uint32 ucol, Uint32 dcol); -void dmClearSurface(SDL_Surface *screen, const Uint32 col); -Uint32 dmMapRGB(SDL_Surface *screen, int r, int g, int b); -Uint32 dmMapRGBA(SDL_Surface *screen, int r, int g, int b, int a); -int dmDirectBlitSurface(SDL_Surface *bmp, SDL_Surface *screen); + +static inline void dmClearSurface(SDL_Surface *screen, const Uint32 col) +{ + SDL_FillRect(screen, NULL, col); +} + + +static inline Uint32 dmMapRGB(SDL_Surface *screen, int r, int g, int b) +{ + return SDL_MapRGB(screen->format, r, g, b); +} + + +static inline Uint32 dmMapRGBA(SDL_Surface *screen, int r, int g, int b, int a) +{ + return SDL_MapRGBA(screen->format, r, g, b, a); +} + + +static inline int dmDirectBlitSurface(SDL_Surface *bmp, SDL_Surface *screen) +{ + return SDL_BlitSurface(bmp, NULL, screen, NULL); +} #endif