Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] Re: (PR#12689) gui-win32: new bitmap cache
Home

[Freeciv-Dev] Re: (PR#12689) gui-win32: new bitmap cache

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: use_less@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#12689) gui-win32: new bitmap cache
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Tue, 29 Mar 2005 08:07:32 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12689 >

On Tue, 29 Mar 2005, James Canete wrote:

> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=12689 >
>
> This patch implements a new bitmap cache, replacing the old bitmap cache
> code in gui-win32.
>
> This new code caches each bitmap as a portion of a larger hbitmap,
> keeping track of clear areas on each hbitmap to place new bitmaps.
> There are no longer any cache misses; if we run out of cache space the
> program simply bombs. :)  I've never seen it happen, though, and I
> should be able to fix that by simply flushing the cache when full.

Oops! :) Yes, a cache flush seems fine. Alternative you can use LRU. But
that is probably too much work, because you need to free something big
enough for the new sprite to fit in.

> The packing is quite efficient; in testing, I was able to load a
> late-game save file and the cache only used three HBITMAPs of size
> 512x512.  I haven't tried playing a game from the start, though, which
> would use more, different sprites, and probably require more HBITMAPs.

Nice.

> This code is quite steeped in GDI calls right now, but should be
> adaptable to any API which requires cacheing sprites, such as OpenGL and
> textures.

Indeed. OpenGL is especially troublesome in this regard. Good work.

---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa







[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#12689) gui-win32: new bitmap cache, Vasco Alexandre da Silva Costa <=