From c6794f9492fad46042473b8c6e0c19c16d1c8dd8 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Wed, 24 Jul 2013 13:04:49 +0200 Subject: Correction des problèmes avec la couleur de fond qui n'apparaissait pas (evil alpha) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphic.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/graphic.c b/src/graphic.c index c0b1d24..89f418a 100644 --- a/src/graphic.c +++ b/src/graphic.c @@ -91,12 +91,9 @@ int paintTerrain(gameIni_t *gIni, gameRess_t *gRess, gameState_t *gState) { int i, modifier; int x,y,xmin,xmax,ymin,ymax,y2,xdst,ydst; Uint32 srcPixel, dstPixel, dstStencil; - Uint32 cc_nothing, cc_terrain, rmask, gmask, bmask, amask; + Uint32 cc_nothing, cc_terrain, cc_background, rmask, gmask, bmask, amask; SDL_Surface *tile; - cc_nothing=0xFF000000; /* Make it portable (big endian) */ - cc_terrain=0xFFFFAAAA; /* Make it portable (big endian) */ - res=SDL_PixelFormatEnumToMasks(SDL_PIXELFORMAT_ARGB8888, &bpp, &rmask, &gmask, &bmask, &amask); MPL_CHECK( res==SDL_TRUE, @@ -114,9 +111,12 @@ int paintTerrain(gameIni_t *gIni, gameRess_t *gRess, gameState_t *gState) { "paintTerrain(), SDL_CreateRGBSurface() failed" ); + cc_nothing=0xFF000000; /* Make it portable (big endian) */ + cc_terrain=0xFFFFAAAA; /* Make it portable (big endian) */ + cc_background = gIni->style.bgColor | amask; /* Fill the entire surfaces with default color */ - res =SDL_FillRect(gState->terrain, NULL, gIni->style.bgColor); + res =SDL_FillRect(gState->terrain, NULL, cc_background); res2=SDL_FillRect(gState->stencil, NULL, cc_nothing); MPL_CHECK( res==0 && res2==0, @@ -186,9 +186,9 @@ int paintTerrain(gameIni_t *gIni, gameRess_t *gRess, gameState_t *gState) { // If we are in NO_OVERRIDE mode and there is already a terrain on the current (source) pixel if ( !( (modifier & 8) == 8 && PIXEL32(gState->stencil, xdst, ydst) == cc_terrain ) ) { - // If we have REMOVE modifier, dstPixel will be rolled back to bgColor, else, it will be identical to the source pixel. We have to update stencil consistenly. + // If we have REMOVE modifier, dstPixel will be rolled back to cc_background, else, it will be identical to the source pixel. We have to update stencil consistenly. if ( (modifier & 2) == 2 ) { - dstPixel=gIni->style.bgColor; + dstPixel=cc_background; dstStencil=cc_nothing; } else { dstPixel=srcPixel; -- cgit v1.2.3