the layer list per display could contain non-visible layers

this happened because we didn't check that the visible
region was within the bounds of the display.

Bug: 7064121
Change-Id: I2e81850a3dc3d1474253520ad7f9e559c26d5a96
This commit is contained in:
Mathias Agopian 2012-08-28 14:20:00 -07:00
parent 55801e41e6
commit 7e7ed7f77a
1 changed files with 12 additions and 7 deletions

View File

@ -757,26 +757,31 @@ void SurfaceFlinger::rebuildLayerStacks() {
const LayerVector& currentLayers(mDrawingState.layersSortedByZ);
for (size_t dpy=0 ; dpy<mDisplays.size() ; dpy++) {
const sp<DisplayDevice>& hw(mDisplays[dpy]);
const Transform& tr(hw->getTransform());
const Rect bounds(hw->getBounds());
Region opaqueRegion;
Region dirtyRegion;
computeVisibleRegions(currentLayers,
hw->getLayerStack(), dirtyRegion, opaqueRegion);
hw->dirtyRegion.orSelf(dirtyRegion);
Vector< sp<LayerBase> > layersSortedByZ;
const size_t count = currentLayers.size();
for (size_t i=0 ; i<count ; i++) {
const Layer::State& s(currentLayers[i]->drawingState());
const sp<LayerBase>& layer(currentLayers[i]);
const Layer::State& s(layer->drawingState());
if (s.layerStack == hw->getLayerStack()) {
if (!currentLayers[i]->visibleRegion.isEmpty()) {
layersSortedByZ.add(currentLayers[i]);
Region visibleRegion(tr.transform(layer->visibleRegion));
visibleRegion.andSelf(bounds);
if (!visibleRegion.isEmpty()) {
layersSortedByZ.add(layer);
}
}
}
hw->setVisibleLayersSortedByZ(layersSortedByZ);
hw->undefinedRegion.set(hw->getBounds());
hw->undefinedRegion.subtractSelf(
hw->getTransform().transform(opaqueRegion));
hw->undefinedRegion.set(bounds);
hw->undefinedRegion.subtractSelf(tr.transform(opaqueRegion));
hw->dirtyRegion.orSelf(dirtyRegion);
}
}
}