Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] Re: (PR#7934) gui_put_sprite_full can and should go
Home

[Freeciv-Dev] Re: (PR#7934) gui_put_sprite_full can and should go

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#7934) gui_put_sprite_full can and should go
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Sun, 14 Mar 2004 09:02:36 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7934 >

On Sun, Mar 14, 2004 at 08:34:41AM -0800, Jason Short wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7934 >
> 
> Raimar Falke wrote:
> > <URL: http://rt.freeciv.org/Ticket/Display.html?id=7934 >
> > 
> > 
> > With get_sprite_dimensions we have all the tools to remove
> > gui_put_sprite_full altogether or move it into common code.
> 
> But this function isn't always a wrapper for gui_put_sprite.  Under SDL 
> it is apparently much faster to draw the whole sprite.

Lets see:

void canvas_put_sprite(struct canvas *pcanvas,
                    int canvas_x, int canvas_y,
                    struct Sprite *sprite,
                    int offset_x, int offset_y, int width, int height)
{
  SDL_Rect src = {offset_x, offset_y, width, height};
  SDL_Rect dst = {canvas_x + offset_x, canvas_y + offset_y, 0, 0};
  SDL_BlitSurface(GET_SURF(sprite), &src, pcanvas->map, &dst);
}

/**************************************************************************
  Draw a full sprite onto the mapview or citydialog canvas.
**************************************************************************/
void canvas_put_sprite_full(struct canvas *pcanvas,
                         int canvas_x, int canvas_y,
                         struct Sprite *sprite)
{
  SDL_Rect dst = {canvas_x, canvas_y, 0, 0};
  SDL_BlitSurface(GET_SURF(sprite), NULL, pcanvas->map, &dst);
}

Difference is the second parameter of SDL_BlitSurface.

From http://sdldoc.csn.ul.ie/sdlblitsurface.php:

   If srcrect is NULL, the entire surface is copied. 

So why do you assume that this is faster/slower?

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  "Windows is the one true OS. MS invented the GUI. MS invented 
   the 32 bit OS. MS is open and standard. MS loves you. We have 
   always been at war with Oceana."




[Prev in Thread] Current Thread [Next in Thread]