[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [E-devel] SDL Engine



On Thursday 10 August 2006 23:48, jose_ogp@juno.com wrote:
> 	I'll let raster comment better on this.. but basically, when
> it comes to the image caching.. a general caching mechanism needs
> to be done yes -- one that can be used for any number of things.
> 	I had some some thoughts and code for this some while back
> and raster and I had discussed it a bit... but it's been sleeping
> for some time.

> 	Note though that the image caching mechanism has both a hash
> of 'active' images and a fallback list of 'inactive' images..
> 	Here, that an object is 'active' means obj ref_count > 0,
> and inactive means obj ref_count = 0. If an obj's ref count reaches 0,
> it gets removed from the hash of 'active' objs and placed at the head
> of the list 'inactive' ones.
> 	When looking for an obj, first the hash of active objs is tried,
> and if not found there, then the list of inactive objs is tried.. if
> an obj is found in the inactive list, it gets ref to 1, removed from
> the inactive list and added to the active hash...

For my implementation, I have only a hash of object with ref_count.

> 	What setting the cache size does is to set a max on the memory
> used in the inactive list.
> 	Does your cache implentation follow this sort of pattern?

Well it does have a mecanism doing something for memory usage and maximum 
number of objects in the cache.
	During insertion it test if this limit are ok. If the limit are reached, it 
made some attempt to evict old object from the cache (calling a callback each 
time). If he can't insert due to the limit, it could fail, but you can force 
the insertion if you absolutely want (In that case, it will just not enforce 
the limit. But I think I need to change the test, so that it still make some 
attempt to remove old object from the cache).

> > In the same idea, what are the purpose of engine_image_border_set,
> > engine_image_border_get and engine_image_format_get ? They seem
> > empty in all engine I am looking in.

> 	The image 'border-set' is only used so far by the xrender
> engine, in order to fix some scaling issues of images with borders.

> 	This may have been a bad time to write a new engine.. ?
> There are many things that will change in the engine funcs -- this
> is needed in order to add various desirable api capabilities (eg.
> transforms and various vgfx related things).

Well I now understand better the need for some change :)

Cedric