Chromium for android v34 2dcanvas hardware rendering implementation analysis
This article is followed by the 2dcanvas hardware painting in the previous article. It analyzes the process in which the texture of the drawing result is merged to the on screen framebuffer.
1. webkit is the render Tree node RenderHTMLCanvas corresponding to the canvas element,
The RenderLayer creation process is as follows:
RenderLayerModelObject: createLayer () call
RenderLayer: insertOnlyThisLayer () will be created
Add the RenderLayer to the renderlayer tree. <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + encrypt/decrypt + CrG7t + encrypt/decrypt/bpmyfpwqo6pgjypgo8l3a + CjxwPjxpbWcgc3JjPQ = "http://www.2cto.com/uploadfile/Collfiles/20141011/201410110833405.jpg" alt = "\">
GraphicsLayer: setupContentsLayer () includes
The WebLayerImpl instance is associated with GraphicsLayer as a subnode.
The contained WebContentLayer contains the WebLayerImpl instance.
In this way, Canvas2DLayerBridge contains the TextureLayer created in the WebExternalTextureLayerImpl instance.
It is associated with the layer tree in the cc module indirectly contained in the renderlayer tree.
The class diagrams involved in the above two processes:
The full parsing of the chromium for android hardware rendering process (render process) shows that this layer tree will eventually be transferred to the cc: LayerTreeHost.
When the page is updated, the layer tree is traversed to call the Update () of each node in turn ().
3. The canvas Element corresponds to the texturelayer indirectly contained by the renderlayer to obtain the mailbox storing the drawn result information.
The bitmap returned by SkBitmapDevice: onaccesskeyitmap () is
Created in the SkGpuDevice constructor. This bitmap is created by the following statement:
SkBitmapDevice (make_bitmap (context, renderTarget ));
Therefore, the content of this bitmap is to save the content of the target texture of the hardware drawing result.
SkSurface_Gpu: onNewImageSnapshot () creates a SkImage with the bitmap parameter.
Canvas2DLayerBridge: prepareMailbox () encapsulate this SkImage into mailboxinfo.
Before sending mailboxinfo, Canvas2DLayerBridge: prepareMailbox () calls
WebGraphicsContext3D: produceTextureCHROMIUM (). Finally called
GLES2DecoderImpl: DoProduceTextureCHROMIUM ().
WebExternalTextureLayerImpl: PrepareTextureMailbox ()
Encapsulate blink: WebExternalTextureMailbox into cc: TextureMailbox and return it
TextureLayer.
4. the Browser process consumes the process of saving the target texture of the drawn result.
TextureLayer: Update () is only used to get the texture containing the drawing result.
Texture corresponding to the canvas element. The mailbox that encapsulates the rendering result is obtained.
TextureLayer: PushPropertiesTo () passed the mailbox to TextureLayerImpl.
Call in TextureLayerImpl: WillDraw ()
ResourceProvider: CreateResourceFromTextureMailbox (). Save the mailbox in
Resource created by ResourceProvider.
The merging process executed in the Browser process is called,
GLRenderer: DrawRenderPassQuad ()
ScopedReadLockGL: ScopedReadLockGL () call
ResourceProvider: LockForRead ()
ResourceProvider: LockForRead () will call
ConsumeTextureCHROMIUM () is finally called
GLES2DecoderImpl: DoProduceTextureCHROMIUM ().
The above process has been analyzed in previous articles.