Geometries – or how to do common svg card cacheFebruary 4, 2008 at 11:46 pm | Posted in KDE | 1 Comment
I’ve been working on this since christmas IIRC. A cache for all card games in kdegames (thats mostly two right now, but who knows what future will bring us). The idea is simply to unify some of the code that both lskat and kpat used to cache svg rendered card decks. Both simply put the resulting image as png into your $HOME to load from there. Both also had code to load png themes which need a mapping of “new style” element names – which are used as id’s in the svg’s – and the old style numbering scheme used in png decks.
I had hoped that moving the caching to KPixmapCache, which uses 1 large file for the caching instead of multiple files , would’ve speed up the rendering on size changes. But as far as I could measure with my stop watch it didn’t help much – if at all. However the new card cache did help to move common code into a central place in libkdegames, which reduces maintainence “cost” (in terms of time spent) and also allows to write new card games more easily.
I’ve more plans for such unifications, specially for handling the deck selection and finding out some information about cards.
The cache-code hasn’t yet been comitted, I still need to port lskat and get some review from the games people. Also there are one or two outstanding issues to be resolved.
And to get back to the topic: What took so long is figuring out how all the geometry calculations work, so I find the right spots to place CardCache::setSize() calls. For kpat it wasn’t quite obvious and me being geometry-wise challenged didn’t help either. I really can’t think this stuff, I have to write those formulas and calculations down and run it through a few example numbers.😦
Sorry, the comment form is closed at this time.