[Kde-games-devel] Review Request: Add support for custom colors in KGameRenderer

Stefan Majewsky majewsky at gmx.net
Thu Aug 5 17:50:07 CEST 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/4908/
-----------------------------------------------------------

Review request for KDE Games and Parker Coates.


Summary
-------

This patch adds support for custom colors, i.e. colors that are replaced inside the SVG element during rendering. Colors can be defined per client, e.g. to reuse an avatar for players with different player colors.

The implementation uses a proxy QPaintDevice that maps the used QBrushes and QPens during painting operations. This imposes a considerable runtime overhead (~20% on my site), so the proxy device is only used if there are custom colors. If the application does not use custom colors, the runtime overhead is therefore negligible.


Diffs
-----

  trunk/KDE/kdegames/libkdegames/CMakeLists.txt 1157590 
  trunk/KDE/kdegames/libkdegames/colorproxy_p.h PRE-CREATION 
  trunk/KDE/kdegames/libkdegames/colorproxy_p.cpp PRE-CREATION 
  trunk/KDE/kdegames/libkdegames/kgamerenderer.h 1157590 
  trunk/KDE/kdegames/libkdegames/kgamerenderer.cpp 1157590 
  trunk/KDE/kdegames/libkdegames/kgamerenderer_p.h 1157590 
  trunk/KDE/kdegames/libkdegames/kgamerendererclient.h 1157590 
  trunk/KDE/kdegames/libkdegames/kgamerendererclient.cpp 1157590 

Diff: http://reviewboard.kde.org/r/4908/diff


Testing
-------

The proxy QPaintDevice was developed and tested in a separate application, and was shown to work with single-colored brushes and pens as well as gradients (see my blog entry at http://majewsky.wordpress.com/2010/08/05/the-color-changing-qpaintdeviceproxy/ for details).

I have tested the integration with KGameRenderer by randomly picking a color from a KDiamond diamond, and replacing that with my favorite debugging color cyan. Look at the attached screenshot to see that it works.


Screenshots
-----------

Some color inside a KDiamond diamond replaced by cyan
  http://reviewboard.kde.org/r/4908/s/472/


Thanks,

Stefan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-games-devel/attachments/20100805/1f23be29/attachment.htm 


More information about the kde-games-devel mailing list