summaryrefslogtreecommitdiff
path: root/src/graphic.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphic.c')
-rw-r--r--src/graphic.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/graphic.c b/src/graphic.c
index a0587bc..b9990f6 100644
--- a/src/graphic.c
+++ b/src/graphic.c
@@ -6,16 +6,17 @@
#define ccc_nooverride 0x00cc0000
#define ccc_terrain 0x0000cc00
#define ccc_nothing 0x00000000
-#define SDLSURF_OPTS SDL_HWSURFACE|SDL_HWACCEL|/*SDL_ASYNCBLIT|*/SDL_RLEACCEL
Uint32 getPixel(SDL_Surface *s, int x, int y) {
+/* 24 bits retournés
Uint32 res=0;
//FIXME : Big Endian
res |= ((Uint8 *)s->pixels)[y*s->pitch + x*s->format->BytesPerPixel+0] << 0;
res |= ((Uint8 *)s->pixels)[y*s->pitch + x*s->format->BytesPerPixel+1] << 8;
res |= ((Uint8 *)s->pixels)[y*s->pitch + x*s->format->BytesPerPixel+2] << 16;
-
return res;
+*/
+ return ((Uint32 *)s->pixels)[y*s->w + x];
}
Uint32 getPixel8BitPalette(SDL_Surface *s, int x, int y) {
@@ -41,11 +42,7 @@ int isTransparent(SDL_Surface *s, int x, int y) {
}
void putPixel(SDL_Surface *s, int x, int y, Uint32 p) {
- //printf("putPixel(s, %i, %i, 0x%x)\n", x, y, p);
- //FIXME : Big Endian
- ((Uint8 *)s->pixels)[y*s->pitch + x*s->format->BytesPerPixel+0] = (p & 0x000000ff) >> 0;
- ((Uint8 *)s->pixels)[y*s->pitch + x*s->format->BytesPerPixel+1] = (p & 0x0000ff00) >> 8;
- ((Uint8 *)s->pixels)[y*s->pitch + x*s->format->BytesPerPixel+2] = (p & 0x00ff0000) >> 16;
+ ((Uint32 *)s->pixels)[y*s->w + x]=p;
}
SDL_Surface * createSurface(int width, int height) {
@@ -65,7 +62,7 @@ SDL_Surface * createSurface(int width, int height) {
amask = 0x00000000;
#endif
- return SDL_CreateRGBSurface(SDL_HWSURFACE|SDL_HWACCEL|/*SDL_ASYNCBLIT|*/SDL_RLEACCEL, width, height, 24, rmask, gmask, bmask, amask);
+ return SDL_CreateRGBSurface(MY_SDLSURFACE_OPTS, width, height, SCREEN_BPP, rmask, gmask, bmask, amask);
}