Tiny optimization of screen update.

Update only once by hex instead of once by tblit. The tblit update had
incorrect size and fixing this will slow us.

Also, only the drawer can know how to efficently update (without
relying on our rectangle merging algo)
This commit is contained in:
Ali El Gariani 2010-09-14 05:37:55 +00:00
parent c375a1e32d
commit 4d18562b53
2 changed files with 5 additions and 2 deletions

View file

@ -866,8 +866,8 @@ void display::drawing_buffer_commit()
SDL_Rect *srcrectArg = (srcrect.x | srcrect.y | srcrect.w | srcrect.h)
? &srcrect : NULL;
SDL_BlitSurface(surf, srcrectArg, screen, &dstrect);
//NOTE: the screen part should already be marked as 'to update'
}
update_rect(blit.x(), blit.y(), zoom_, zoom_);
}
drawing_buffer_clear();
}
@ -2003,6 +2003,9 @@ void display::draw_invalidated() {
foreach (map_location loc, invalidated_) {
int xpos = get_location_x(loc);
int ypos = get_location_y(loc);
update_rect(xpos, ypos, zoom_, zoom_);
const bool on_map = get_map().on_board(loc);
SDL_Rect hex_rect = create_rect(xpos, ypos, zoom_, zoom_);
if(!rects_overlap(hex_rect,clip_rect)) {

View file

@ -790,7 +790,7 @@ protected:
public:
/**
* Add an item to the drawing buffer.
* Add an item to the drawing buffer. You need to update screen on affected area
*
* @param layer The layer to draw on.
* @param loc The hex the image belongs to, needed for the