码迷,mamicode.com
首页 > 其他好文 > 详细

Tiled Backing Store (二)

时间:2015-03-03 01:13:33      阅读:255      评论:0      收藏:0      [点我收藏+]

标签:

2.2 前缓冲区(Front buffer)

       通过QPinter来绘制tile实际上就是要绘制存储在前缓冲区里的pixmap。没有前缓冲区的tile意味着它不需要绘制。

2.3 后缓冲区(Backend Buffer)

       后缓冲区充当tile内容的屏下(off-screen)后缓冲区并且可以采用Qt的画笔绘制到Qt widget上。在更新后缓冲区的过程中(In the process of updateBackBuffer),对于无效操作(invalidate)引起的脏区域,WebKit绘制脏区域的内容到屏下缓冲区,它使用的画笔因为有缩放请求或许带有缩放等几何变换。

WebCore::FrameView通过调用paintContents来更新脏区域 。一旦后缓冲区更新完毕,它就会被函数swapBackBufferToFron交换到前面去,从而tile(的新内容)可以绘制到Qt widget上。


2.4 TiledBackingStore的职责

TiledBackingStore职责就是管理所有的tile,功能包括:

  • 定义分片策略(Tiling Policy):包括tile的大小,覆盖区域因子,创建延迟时间,内容缩放因子。

  • 创建tile:使用定时器来触发创建tile的操作。定时器也可以通过函数TiledBackingStore::startTileCreationTimer触发,一旦时间到,createTiles会执行. 当TiledBackingStore尝试调整可见区域时,tile的创建会被安排在区域调整之后执行。

  • 更新Tile缓冲区: 类似与tile的创建,更新操作也是通过定时器实现的。当一块内容区变脏了,TiledBackingStore首先计算哪些tile与脏区域有交集,随后安排更新任务。

  • 冻结状态(Frozen State): TiledBackingStore has nothing to do in frozen state, for example, it will not update back buffer and create tiles. The frozen state is introduced mainly for avoiding time-consuming operations on TiledBackingStore in some scenarios, such as content scale. On exiting frozen state by setContentsFrozen(false), TiledBackingStore will check the pending scale factor. If the pending scale is not 0, it has to update the back buffer in accordance with the pending scale. 

2.5 TiledBackingStoreClient

       所有与渲染相关的功能都抽象到了此类,它是一个接口, WebCore::Frame是它的实例,它负责:
  • tiledBackingStorePaintBegin:更新tiled backing store开始之前必须做完的事情。Render engine should make sure the contents being painted to TiledBackingStore off-screen buffer are correct at that time, so it has to flush all deferred repaint operation.

  • tiledBackingStorePaint: 渲染引擎通过调用WebCore::FrameView::paintContents绘制内容到TiledBackingStore的屏下缓冲区.

  • tiledBackingStorePaintEnd: 更新tiled backing store开始之后必须做完的事情T. Once the off-screen buffer for TiledBackingStore is updated, a question naturally comes in the way:

     ‘‘‘How does UI front know such update immediately and then schedule a repaint event to their widget to draw the content?Download

    T
    he answer is, at the end of TiledBackingStore update, it will notify the WebCore::ChromeClient (ChromeClientQt for WebKit port) to invalidate contents by calling invalidateContentsAndWindow. In QtWebKit, invalidateContentsAndWindow finally schedules a paint event through PageClientQGraphicsWidget to QGraphicsWebView.

  • tiledBackingStoreContentsRect Return the content size of web frame.

  • tiledBackingStoreVisibleRect  Return the visible area of the graphics item used for drawing web content. It is actually the visible rect of QGraphicsWebView.

Tiled Backing Store (二)

标签:

原文地址:http://blog.csdn.net/lichwei1983/article/details/44027591

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!