<URL: http://bugs.freeciv.org/Ticket/Display.html?id=38197 >
> [dmarks - Do 15. Mär 2007, 14:36:42]: > > Black is masked in the city dialog garrison panel, clearly seen in > this screenshot where half the Silesian (black&yellow) shield is > transparent. Is this the intended effect?` > > ~Daniel > Patch attached.
Index: client/gui-sdl/citydlg.c =================================================================== --- client/gui-sdl/citydlg.c (Revision 12860) +++ client/gui-sdl/citydlg.c (Arbeitskopie) @@ -610,15 +610,13 @@ { int i, step; SDL_Rect dest; -/* SDL_Surface *pSurf = - SDL_DisplayFormatAlpha(get_unittype_surface(pUnit->type)); */ SDL_Surface *pSurf = create_surf_alpha(tileset_full_tile_width(tileset), tileset_full_tile_height(tileset), SDL_SWSURFACE); - struct canvas *destcanvas = canvas_create(tileset_full_tile_width(tileset), - tileset_full_tile_height(tileset)); - SDL_SetColorKey(destcanvas->surf, SDL_SRCCOLORKEY, 0); + struct canvas *destcanvas = canvas_create_with_alpha( + tileset_full_tile_width(tileset), + tileset_full_tile_height(tileset)); put_unit(pUnit, destcanvas, 0, 0); @@ -626,8 +624,8 @@ canvas_free(destcanvas); - if (pSurf->w > 59) { - float zoom = 59.0 / pSurf->w; + if (pSurf->w > adj_size(59)) { + float zoom = (float)adj_size(59) / pSurf->w; SDL_Surface *pZoomed = zoomSurface(pSurf, zoom, zoom, 1); FREESURFACE(pSurf); pSurf = pZoomed; @@ -643,7 +641,7 @@ step = pIcons->pFood->w; } - dest.y = pSurf->h - pIcons->pFood->h - 2; + dest.y = pSurf->h - pIcons->pFood->h - adj_size(2); dest.x = pSurf->w / 8; for (i = 0; i < pUnit->upkeep[O_SHIELD]; i++) { Index: client/gui-sdl/mapview.c =================================================================== --- client/gui-sdl/mapview.c (Revision 12860) +++ client/gui-sdl/mapview.c (Arbeitskopie) @@ -1323,11 +1323,9 @@ canvas_free(terrain_canvas); } - terrain_canvas = canvas_create(tileset_full_tile_width(tileset), - tileset_full_tile_height(tileset)); + terrain_canvas = canvas_create_with_alpha(tileset_full_tile_width(tileset), + tileset_full_tile_height(tileset)); - SDL_SetColorKey(terrain_canvas->surf, SDL_SRCCOLORKEY, 0); - put_terrain(ptile, terrain_canvas, 0, 0); return terrain_canvas->surf; Index: client/gui-sdl/canvas.c =================================================================== --- client/gui-sdl/canvas.c (Revision 12860) +++ client/gui-sdl/canvas.c (Arbeitskopie) @@ -49,6 +49,18 @@ } /************************************************************************** + Create a canvas of the given size (with alpha channel). +**************************************************************************/ +struct canvas *canvas_create_with_alpha(int width, int height) +{ + struct canvas *result = fc_malloc(sizeof(*result)); + + result->surf = create_surf_alpha(width, height, SDL_SWSURFACE); + + return result; +} + +/************************************************************************** Free any resources associated with this canvas and the canvas struct itself. **************************************************************************/ Index: client/gui-sdl/canvas.h =================================================================== --- client/gui-sdl/canvas.h (Revision 12860) +++ client/gui-sdl/canvas.h (Arbeitskopie) @@ -22,4 +22,6 @@ SDL_Surface *surf; }; +struct canvas *canvas_create_with_alpha(int width, int height); + #endif /* FC__CANVAS_H */
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev