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 corresponding render tree node for the canvas element Renderhtmlcanvas,
The steps for creating Renderlayer are as follows:


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


2.canvas2dlayerbridge includes Webexternaltexturelayerimpl instances,
The texturelayer created in the Webexternaltexturelayerimpl constructor
is encapsulated in the Weblayerimpl instance included in the Webexternaltexturelayerimpl.
Here are the steps to create the Weblayerimpl associated to the corresponding renderlayer on the canvas node, such as the following:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvamf5bgluemhvdq==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">

Graphicslayer::setupcontentslayer () will include Webexternaltexturelayerimpl
Weblayerimpl instances are associated to graphicslayer as child nodes
The included Webcontentlayer are included on the Weblayerimpl instance.
In this way, Canvas2dlayerbridge includes the Texturelayer created in the Webexternaltexturelayerimpl instance
is linked to the layer tree in the CC module indirectly included in the Renderlayer tree.
The above two processes involve the class diagram:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvamf5bgluemhvdq==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">

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 corresponding to Renderlayer indirectly includes the Texturelayer to obtain the mailbox process of saving 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)).
So. The content of this bitmap is the content of the target texture to save the hardware drawing result.


Sksurface_gpu::onnewimagesnapshot () created skimage with bitmap as a reference.
Canvas2dlayerbridge::p Reparemailbox () encapsulates this skimage into Mailboxinfo.
Before sending the mailboxinfo out. Canvas2dlayerbridge::p Reparemailbox () called the
Webgraphicscontext3d::p roducetexturechromium (). Finally called 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 texture including the result of the drawing, for
The corresponding texture of the canvas element is the 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 runs in the browser process is called to the
Glrenderer::D Rawrenderpassquad ()
SCOPEDREADLOCKGL::SCOPEDREADLOCKGL () call
Resourceprovider::lockforread ()
The Resourceprovider::lockforread () is called
Consumetexturechromium () is finally called to
Gles2decoderimpl::D oconsumetexturechromium ().
The above process, has been analyzed in the article, 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.