[cairo] Image loading and caching

Bryce Harrington bryce at osg.samsung.com
Tue Jul 5 20:31:19 UTC 2016


On Mon, Jul 04, 2016 at 07:15:44PM +0200, Enrico Weigelt, metux IT consult wrote:
> Hi folks,
> 
> 
> in my widget toolkit (*1), I've got a lot of images to draw
> (eg. window decorations and buttons, etc). For now, I'm loading
> the images again for each button, which of course is a waste of
> resources.
> 
> So, I'm looking for a proper way for caching. The quickest approach
> would be just having some global pointers to the image surfaces and
> loading them only once - just within the button widget.
> 
> OTOH, it might be worth implementing that in a generic way, maybe
> even in cairo or some cairo-extension library.
> 
> What's your opponion on that ?

Caching buffers is a classic cat skinning problem.  :-)

If the code can sit atop Cairo (i.e. exclusively use Cairo's public
API), then having it be a separate library would be best.  But I'd like
to hear more about what you have in mind precisely.  Also, would be good
to know if it could apply to use cases beyond widget toolkits.

Bryce


More information about the cairo mailing list