mail[Wesnoth-commits] r25332 - /trunk/src/game_display.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by alinktomine on March 30, 2008 - 16:00:
Author: alink
Date: Sun Mar 30 15:43:44 2008
New Revision: 25332

URL: http://svn.gna.org/viewcvs/wesnoth?rev=25332&view=rev
Log:
Remove an intermediate step for drawing hp/xp bars.
(directly draw on the surface, instead of drawing on a buffer before blit it)
This is a little optimization (but probably irrelevant for this few pixels)
but also eliminate special SDL calls (per-surface alpha value), and thus maybe
fix the hp bar bug with fullscreen toggle on windows

Modified:
    trunk/src/game_display.cpp

Modified: trunk/src/game_display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_display.cpp?rev=25332&r1=25331&r2=25332&view=diff
==============================================================================
--- trunk/src/game_display.cpp (original)
+++ trunk/src/game_display.cpp Sun Mar 30 15:43:44 2008
@@ -676,11 +676,10 @@
        const size_t unfilled = static_cast<const size_t>(height*(1.0 - 
filled));
 
        if(unfilled < height && alpha >= ftofxp(0.3)) {
-               const Uint32 colour = 
SDL_MapRGB(video().getSurface()->format,col.r,col.g,col.b);
                const Uint8 r_alpha = 
minimum<unsigned>(unsigned(fxpmult(alpha,255)),255);
-               surface filled_surf(SDL_CreateRGBSurface(SDL_SWSURFACE, 
bar_loc.w, height - unfilled, 32,  /*col.r << 16, col.g << 8, col.b, 
0x44000000*/0xFF0000, 0xFF00, 0xFF, 0 ) );
+               surface filled_surf = create_compatible_surface(bar_surf, 
bar_loc.w, height - unfilled);
                SDL_Rect filled_area = {0, 0, bar_loc.w, height-unfilled};
-               fill_rect_alpha(filled_area, colour, r_alpha, filled_surf);
+               
SDL_FillRect(filled_surf,&filled_area,SDL_MapRGBA(bar_surf->format,col.r,col.g,col.b,
 r_alpha));
                drawing_buffer_add(LAYER_UNIT_BAR, drawing_order, tblit(xpos 
+ bar_loc.x, ypos + bar_loc.y + unfilled, filled_surf));
        } 
 }




Related Messages


Powered by MHonArc, Updated Sun Mar 30 16:42:05 2008