Android GUI system Surfaceflinger (Handlepageflip)

Source: Internet
Author: User

1.1.1 Handlepageflip

Pageflip can be understood as "paging". From this point of view, it should be related to the layer buffer-because it is a multiple buffering mechanism, at the appropriate time, we need to do "flip" action.

void Surfaceflinger::handlepageflip ()

{...

Const DISPLAYHARDWARE&HW = Graphicplane (0). Displayhardware ()//display with number 0

Const regionscreenregion (Hw.bounds ());//Entire screen area

Const layervector&currentlayers (MDRAWINGSTATE.LAYERSSORTEDBYZ);/* Current All layers*/

const BOOL Visibleregions = Lockpageflip (currentlayers); The following is a detailed analysis of this function, noting its return

Value is a bool type variable. */

if (Visibleregions | | Mvisibleregionsdirty) {//visible area changed

regionopaqueregion;//Opaque Area

Computevisibleregions (Currentlayers, Mdirtyregion, opaqueregion)/*step2. Calculate Visible Area * *

/*step3. Reconstruct the Mvisiblelayerssortedbyz, that is, the sort of all visible layers * *

Const size_t count= currentlayers.size ();

Mvisiblelayerssortedbyz.clear ()/Empty

Mvisiblelayerssortedbyz.setcapacity (count);//capacity

for (size_t i=0; i<count; i++) {

if (!currentlayers[i]->visibleregionscreen.isempty ())//Current layer has visible area

Mvisiblelayerssortedbyz.add (Currentlayers[i]);

}

Mwormholeregion = Screenregion.subtract (opaqueregion);/*step4. Worm Hole Calculation * *

Mvisibleregionsdirty = false;

Invalidatehwcgeometry ();

}

Unlockpageflip (currentlayers);/*step5 with Lockpageflip.

...

Mdirtyregion.andself (screenregion);//Excluding areas outside the screen range

}

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.