From 7e7ed7f77a3963a3542bde529d2797a239e2798b Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 28 Aug 2012 14:20:00 -0700 Subject: 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 --- services/surfaceflinger/SurfaceFlinger.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'services') diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index da3e932..1162432 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -757,26 +757,31 @@ void SurfaceFlinger::rebuildLayerStacks() { const LayerVector& currentLayers(mDrawingState.layersSortedByZ); for (size_t dpy=0 ; dpy& 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 > layersSortedByZ; const size_t count = currentLayers.size(); for (size_t i=0 ; idrawingState()); + const sp& 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); } } } -- cgit v1.1