Chromium Direct synthesis of images (IMG elements) on M34, Nativeimageskia: Related code:d raw path

Source: Internet
Author: User

An image can directly compositing if it's the sole content of the layer, and have no box decorations//that require P Ainting. Direct compositing saves backing Store.bool compositedlayermapping::isdirectlycompositedimage () const{    renderobject* RenderObject = renderer ();    if (!renderobject->isimage () | | m_owninglayer->hasboxdecorationsorbackground () | | renderobject->hasclip ())        return false;    renderimage* imagerenderer = Torenderimage (renderobject);    if (imageresource* cachedimage = Imagerenderer->cachedimage ()) {        if (!cachedimage->hasimage ())            return false;        image* image = Cachedimage->imageforrenderer (imagerenderer);        return Image->isbitmapimage ();    }    return false;}


void compositedlayermapping::contentchanged (Contentchangetype changetype) {    if (changetype = = ImageChanged) && Isdirectlycompositedimage ()) {        updateimagecontents ();        return;    }    if ((changetype = = maskimagechanged) && m_masklayer) {        //The composited layer bounds relies on BOX->MASKCL Iprect (), which changes        //When the mask image becomes available.        Updateafterlayout (Compositingchildrenonly | isupdateroot);    }    if (changetype = = Canvaschanged | | changetype = canvaspixelschanged) && Isacceleratedcanvas (Renderer ())) {
   m_graphicslayer->setcontentsneedsdisplay ();        return;}    }

void Compositedlayermapping::updateimagecontents () {    ASSERT (renderer ()->isimage ());    renderimage* imagerenderer = Torenderimage (renderer ());    imageresource* cachedimage = Imagerenderer->cachedimage ();    if (!cachedimage)        return;    image* image = Cachedimage->imageforrenderer (imagerenderer);    if (!image)        return;    We have a to wait until the image was fully loaded before setting it on the layer.    if (!cachedimage->isloaded ())        return;    This is a no-op if the layer doesn ' t has a inner layer for the image.    M_graphicslayer->setcontentstoimage (image);    BOOL Issimplecontainer = false;    Updatedrawscontent (Issimplecontainer);

void Graphicslayer::setcontentstoimage (image* image) {    refptr<nativeimageskia> nativeimage = image? image- >nativeimageforcurrentframe (): 0;    if (nativeimage) {        if (!m_imagelayer) {            M_imagelayer = adoptptr (Platform::current ()->compositorsupport ()- >createimagelayer ());            Registercontentslayer (M_imagelayer->layer ());        }        M_imagelayer->setbitmap (Nativeimage->bitmap ());        M_imagelayer->layer ()->setopaque (Image->currentframeknowntobeopaque ());        Updatecontentsrect ();    } else {        if (m_imagelayer) {            unregistercontentslayer (M_imagelayer->layer ());            M_imagelayer.clear ();        }    }    Setcontentsto (M_imagelayer m_imagelayer->layer (): 0);}

M39 on the contrary is not this behavior, will go Nativeimageskia::d Raw. Of course, M39 on Slimmingpaint and Ganesh (GPU rasterization) are still in continuous refactoring.

Chromium M34 (img element) direct synthesis, do not go Nativeimageskia::d The raw path of the relevant code

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.