[Kde-games-devel] SVG and MainWindow resize handling

Andreas Pakulat apaku at gmx.de
Sat Jan 19 23:56:30 CET 2008


On 19.01.08 20:15:52, Mauricio Piacentini wrote:
> Andreas Pakulat wrote:
> > I highly suspect this last one, as QPixmap doesn't let you specify the
> > format of the image wrt. alpha channels.
> 
> Cool, probably the reason why it was not used in my tests, as mahjongg 
> tilefaces and other elements (runners) need to have an alpha to be 
> composed properly.

Hmm, ok. Then I'll put down a todo note to actually test
qpixmap<->qimage conversion speed. Maybe that plays a role as well,
especially in card games I could imagine this - doing 3 conversions for
32 cards and one background can probably really slow your rendering
speed down.

> > However, the cardcache I've written on top of KPixmapCache still renders
> > svg's itself (because KPixmapCache has no way of defining the element in
> > the svg when letting it load the svg) and thus still uses a QImage as
> > "first" image source. The same happens for pngs, which are read into a
> > QImage and that one is then transformed to fit the requested size. Only
> > after that the image is converted into a pixmap and stored in the cache.
> 
> Similar to what is implemented (in a very simple manner) in 
> libkmahjongg. We render the pixmap, and store it in cache with a name 
> that is something like theme_elementid_width_height. When I want an 
> element, I try to get it from the cache. If it is not there, then render 
> and store. See the tileset or background class for the methods.

Yeah, except that reading the images from an mmapped file is (AFAIK, I'm
not much experienced in that department) should be a _lot_ faster than
reading the images from 32 independent .png files. 

> > OMG, I really need to stop being sucked into all kinds of things :) As I
> > said, I'll try to add the pixmap caching to kpat tomorrow and see
> > wether/how that improves speed at startup, changing decks and resizing.
> 
> IMO KPat is the game that experimented with caching earlier, so it maybe 
> has not benefited as much from what we learned, and changes in kdelibs 
> and Qt.

Hmm, so maybe this was at a time when KPixmapCache was still very young,
or maybe it was even QPixmapCache (i.e. before SoC last year)...

> > Next time I'll leave the question innocent as it was, before I added the
> > rest of the paragraph :)
> 
> Sorry for the outbreak, it was out of line. Apologies.

No apologies needed, re-reading my mails I agree that I should've
pointed out a bit better that I'm not blaming anybody for not paying
attention to speed in the games. Its just that I stepped into this list
only october last year or something like that and thus I miss all the
earlier discussions about this topic. So whenever anybody discovers that
I'm re-iterating old things, just tell me to shut up and read the
archive :)

Andreas

-- 
Good day for overcoming obstacles.  Try a steeplechase.


More information about the kde-games-devel mailing list