From 47253f0d3a3ea253122ac176a7d94d6a793274ab Mon Sep 17 00:00:00 2001 From: stpohle Date: Thu, 24 Jul 2003 13:04:50 +0000 Subject: [PATCH] scaling routine speeded up a little bit by using less switch case and using inline.. static inline is now used --- ChangeLog | 5 ++++- src/gfx.h | 12 +++--------- src/gfxpixelimage.c | 16 ++++++++-------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5f4aabc..ac667d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,11 @@ -$Id: ChangeLog,v 1.30 2003/07/24 01:47:48 stpohle Exp $ +$Id: ChangeLog,v 1.31 2003/07/24 13:04:50 stpohle Exp $ Version 0.9.10 ============== +- scaling routine speeded up a little. Using inline functions + and much less "switch case". + - TekKRat made two new players, the first two tilesets with the pseudo 3D effect (64x96 pixel tileset) and another tileset. diff --git a/src/gfx.h b/src/gfx.h index 19c602e..01004e6 100644 --- a/src/gfx.h +++ b/src/gfx.h @@ -1,4 +1,4 @@ -/* $Id: gfx.h,v 1.16 2003/07/24 12:41:27 stpohle Exp $ */ +/* $Id: gfx.h,v 1.17 2003/07/24 13:04:50 stpohle Exp $ */ #ifndef _GFX_H_ #define _GFX_H_ @@ -82,14 +82,8 @@ extern void gfx_free_players (); // gfxpixelimage.c extern void getRGBpixel (SDL_Surface *surface, int x, int y, int *R, int *G, int *B); -inline Uint32 getpixel(SDL_Surface *surface, int x, int y); -inline void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel); -inline Uint32 getpixel16(SDL_Surface *surface, int x, int y); -inline void putpixel16(SDL_Surface *surface, int x, int y, Uint32 pixel); -inline Uint32 getpixel24(SDL_Surface *surface, int x, int y); -inline void putpixel24(SDL_Surface *surface, int x, int y, Uint32 pixel); -inline Uint32 getpixel32(SDL_Surface *surface, int x, int y); -inline void putpixel32(SDL_Surface *surface, int x, int y, Uint32 pixel); +extern Uint32 getpixel(SDL_Surface *surface, int x, int y); +extern void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel); extern void scale (short int *dpattern, short int x, short int y); extern SDL_Surface *scale_image (SDL_Surface * orginal, int newx, int newy); extern void shade_pixel(SDL_Surface *s, int x, int y, int c); diff --git a/src/gfxpixelimage.c b/src/gfxpixelimage.c index 9e909b2..bc63033 100644 --- a/src/gfxpixelimage.c +++ b/src/gfxpixelimage.c @@ -1,4 +1,4 @@ -/* $Id: gfxpixelimage.c,v 1.2 2003/07/24 12:41:27 stpohle Exp $ */ +/* $Id: gfxpixelimage.c,v 1.3 2003/07/24 13:04:50 stpohle Exp $ */ /* gfx pixel manipulation and image manipulation */ #include "bomberclone.h" @@ -54,7 +54,7 @@ getpixel (SDL_Surface * surface, int x, int y) }; -inline Uint32 +static inline Uint32 getpixel32 (SDL_Surface * surface, int x, int y) { /* Here p is the address to the pixel we want to retrieve */ @@ -63,7 +63,7 @@ getpixel32 (SDL_Surface * surface, int x, int y) }; -inline Uint32 +static inline Uint32 getpixel24 (SDL_Surface * surface, int x, int y) { /* Here p is the address to the pixel we want to retrieve */ @@ -76,7 +76,7 @@ getpixel24 (SDL_Surface * surface, int x, int y) }; -inline Uint32 +static inline Uint32 getpixel16 (SDL_Surface * surface, int x, int y) { /* Here p is the address to the pixel we want to retrieve */ @@ -86,7 +86,7 @@ getpixel16 (SDL_Surface * surface, int x, int y) /* putpixel seperated for every BPP version */ -void +inline void putpixel (SDL_Surface * surface, int x, int y, Uint32 pixel) { /* Here p is the address to the pixel we want to set */ @@ -119,7 +119,7 @@ putpixel (SDL_Surface * surface, int x, int y, Uint32 pixel) }; -inline void +static inline void putpixel32 (SDL_Surface * surface, int x, int y, Uint32 pixel) { /* Here p is the address to the pixel we want to set */ @@ -128,7 +128,7 @@ putpixel32 (SDL_Surface * surface, int x, int y, Uint32 pixel) }; -inline void +static inline void putpixel24 (SDL_Surface * surface, int x, int y, Uint32 pixel) { /* Here p is the address to the pixel we want to set */ @@ -145,7 +145,7 @@ putpixel24 (SDL_Surface * surface, int x, int y, Uint32 pixel) }; -inline void +static inline void putpixel16 (SDL_Surface * surface, int x, int y, Uint32 pixel) { /* Here p is the address to the pixel we want to set */