From a6b32db164e7834e211261046f3229bf50bc0098 Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Thu, 19 Jul 2012 16:44:38 -0700 Subject: [PATCH] Handle empty HWC layer list when composing Bug: 6777877 Change-Id: I71e9b948d04dda33d45cfa986d9c7e28328cf749 --- services/surfaceflinger/SurfaceFlinger.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 29ec1a7b7..693f24113 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1151,11 +1151,11 @@ void SurfaceFlinger::composeSurfaces(const DisplayHardware& hw, const Region& di const Vector< sp >& layers(hw.getVisibleLayersSortedByZ()); const size_t count = layers.size(); const Transform& tr = hw.getTransform(); - for (size_t i=0 ; cur!=end && i& layer(layers[i]); const Region clip(dirty.intersect(tr.transform(layer->visibleRegion))); if (!clip.isEmpty()) { - if (cur->getCompositionType() == HWC_OVERLAY) { + if (cur != end && cur->getCompositionType() == HWC_OVERLAY) { if (i && (cur->getHints() & HWC_HINT_CLEAR_FB) && layer->isOpaque()) { // never clear the very first layer since we're @@ -1167,6 +1167,9 @@ void SurfaceFlinger::composeSurfaces(const DisplayHardware& hw, const Region& di // render the layer layer->draw(hw, clip); } + if (cur != end) { + ++cur; + } } } }