Mercurial > hg > dmlib
changeset 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 | b10884934aca |
children | e1e308167991 |
files | dmgfx.c dmlib.h |
diffstat | 2 files changed, 23 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/dmgfx.c Tue Oct 02 15:52:44 2012 +0300 +++ b/dmgfx.c Tue Oct 02 16:37:58 2012 +0300 @@ -126,27 +126,3 @@ dmDrawVLine(screen, y0 , y1 - 1, x0, ucol); dmDrawVLine(screen, y0 + 1, y1 , x1, dcol); } - - -void dmClearSurface(SDL_Surface *screen, const Uint32 col) -{ - SDL_FillRect(screen, NULL, col); -} - - -Uint32 dmMapRGB(SDL_Surface *screen, int r, int g, int b) -{ - return SDL_MapRGB(screen->format, r, g, b); -} - - -Uint32 dmMapRGBA(SDL_Surface *screen, int r, int g, int b, int a) -{ - return SDL_MapRGBA(screen->format, r, g, b, a); -} - - -int dmDirectBlitSurface(SDL_Surface *bmp, SDL_Surface *screen) -{ - return SDL_BlitSurface(bmp, NULL, screen, NULL); -}
--- 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