Chromium for Android v34 2dcanvas hardware Rendering implementation analysis

Source: Internet
Author: User

This article goes on to the previous 2dcanvas hardware drawing, analyzing the process of texture that save the drawing results to be synthesized on the on screen framebuffer.

1.webkit is the render tree node Renderhtmlcanvas for the canvas element,
The process for creating Renderlayer is as follows:


Renderlayermodelobject::createlayer () call
Renderlayer::insertonlythislayer () will finish creating
Renderlayer added to the Renderlayer tree.


2.canvas2dlayerbridge contains Webexternaltexturelayerimpl instances,
The texturelayer created in the Webexternaltexturelayerimpl constructor
is encapsulated in the Weblayerimpl instance contained in the Webexternaltexturelayerimpl.
The process created here Weblayerimpl associated to the Renderlayer on the canvas node is as follows:


Graphicslayer::setupcontentslayer () will webexternaltexturelayerimpl contain the
Weblayerimpl instances are associated to graphicslayer as child nodes
Contains the webcontentlayer contained on the Weblayerimpl instance.
In this way, Canvas2dlayerbridge contains the Texturelayer created in the Webexternaltexturelayerimpl instance
is linked to the layer tree in the CC module indirectly contained by the Renderlayer tree.
The above two processes involve the class diagram:


Chromium for Android hardware rendering process full parsing (render process) it is known that the layer tree will eventually be passed on to Cc::layertreehost hold.
When the page is updated, the layer tree is traversed to invoke the update () of each node in turn.


The 3.canvas element corresponds to the process by which the renderlayer indirectly contained Texturelayer gets the mailbox to save the drawing result information.


The bitmap returned by Skbitmapdevice::onaccessbitmap () is in
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 contents of the target texture of the hardware drawing result.
Sksurface_gpu::onnewimagesnapshot () created skimage with bitmap as a parameter.
Canvas2dlayerbridge::p Reparemailbox () encapsulates this skimage into Mailboxinfo.
Before sending the Mailboxinfo out, Canvas2dlayerbridge::p Reparemailbox () called the
Webgraphicscontext3d::p roducetexturechromium (). Final call to
Gles2decoderimpl::D oproducetexturechromium ().
Webexternaltexturelayerimpl::P Reparetexturemailbox ()
Package the Blink::webexternaltexturemailbox as Cc::texturemailbox back to
Texturelayer.


4.Browser process consumes the process of saving the target texture of the drawing result

Texturelayer::update () The only thing to do is to get the texture containing the result of the drawing, for
The texture of the canvas element, resulting in a mailbox that encapsulates the result of the drawing.
Texturelayer: This mailbox is passed to Texturelayerimpl in:P Ushpropertiesto ().
Called in Texturelayerimpl::willdraw ()
Resourceprovider::createresourcefromtexturemailbox (). Save the mailbox from the
Resourceprovider created in the resource.
The composition process that is performed in the browser process is called to the
Glrenderer::D Rawrenderpassquad ()
SCOPEDREADLOCKGL::SCOPEDREADLOCKGL () call
Resourceprovider::lockforread ()
The Resourceprovider::lockforread () is called
Consumetexturechromium () Final call to
Gles2decoderimpl::D oproducetexturechromium ().
The above process, the previous article analysis, not detailed analysis.

Chromium for Android v34 2dcanvas hardware Rendering implementation analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.