分类: LINUX
2010-08-28 17:12:38
这次的问题是在MeeGo环境下对Graphics的优化部分,使用Webkit编译的QtLauncher默认情况下绘图性能非常差,和Chrome的差距不是一点半点,当时阅读源代码的时候就发现在qpaintengine_x11.cpp中的代码其实组织的比较差,很多地方性能非常低,通过缓存+快路径的方式实施了几个补丁之后性能通常能有数倍至数百倍的提升,但是总体效果仍然不理想。
在调试一个rotation后背景显示的bug时突然意外发现,命令行中使用 -graphicssystem raster 时该bug不存在,再将之前的testcase都运行之后发现qpaintengine_raster的效率非常高,这才注意到,Qt在painting这一部分的优化工作其实都已经做了很多了,针对不同的应用情境Qt提供了很多的paintengine, 具体可见Qt文档。(下面英文部分)
当时看的不仔细,看的时候也不太理解,现在才明白了如此多的engine都是干什么用的了。
QPainter is a rich framework that allows developers to do a great variety of graphical operations, such as gradients, composition modes and vector graphics. And QPainter can do this across a variety of different hardware and software stacks. Naturally the underlying combination of hardware and software has some implications for performance, and ensuring that every single operation is fast in combination with all the various combinations of composition modes, brushes, clipping, transformation, etc, is close to an impossible task because of the number of permutations. As a compromise we have selected a subset of the QPainter API and backends, where performance is guaranteed to be as good as we can sensibly get it for the given combination of hardware and software.
The backends we focus on as high-performance engines are:
These operations are:
This list gives an indication of which features to safely use in an application where performance is critical. For certain setups, other operations may be fast too, but before making extensive use of them, it is recommended to benchmark and verify them on the system where the software will run in the end. There are also cases where expensive operations are ok to use, for instance when the result is cached in a .
See also QPaintDevice, , , , and .
chinaunix网友2010-08-30 21:42:41
Download More than 1000 free IT eBooks: http://free-ebooks.appspot.com