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

Stefan Majewsky majewsky at gmx.net
Mon Aug 9 11:49:13 CEST 2010


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


FYI: I added http://bugreports.qt.nokia.com/browse/QTBUG-12740 which requests API in QSvgRenderer to do this magic more efficiently.

- Stefan


On 2010-08-05 15:51:36, Stefan Majewsky wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/4908/
> -----------------------------------------------------------
> 
> (Updated 2010-08-05 15:51:36)
> 
> 
> 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.
> 
> Because the KGameRenderer API is not stable yet, I made no attempt to make this patch ABI-compatible. (It's only source-compatible.) So don't forget to recompile your KGameRenderer-based apps after applying the patch.
> 
> 
> 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/20100809/64197e02/attachment.htm 


More information about the kde-games-devel mailing list