Skip to content

Commit c69775d

Browse files
pixelflingerAndroid (Google) Code Review
authored andcommitted
Merge "fix [2664345] Flash: Bad flicker at the end of a pinch zoom." into froyo
2 parents 0dd3a23 + 2df6f51 commit c69775d

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

libs/surfaceflinger/Layer.cpp

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,28 @@ void Layer::onDraw(const Region& clip) const
281281
GLuint textureName = mTextures[index].name;
282282
if (UNLIKELY(textureName == -1LU)) {
283283
// the texture has not been created yet, this Layer has
284-
// in fact never been drawn into. this happens frequently with
285-
// SurfaceView.
286-
clearWithOpenGL(clip);
284+
// in fact never been drawn into. This happens frequently with
285+
// SurfaceView because the WindowManager can't know when the client
286+
// has drawn the first time.
287+
288+
// If there is nothing under us, we paint the screen in black, otherwise
289+
// we just skip this update.
290+
291+
// figure out if there is something below us
292+
Region under;
293+
const SurfaceFlinger::LayerVector& drawingLayers(mFlinger->mDrawingState.layersSortedByZ);
294+
const size_t count = drawingLayers.size();
295+
for (size_t i=0 ; i<count ; ++i) {
296+
const sp<LayerBase>& layer(drawingLayers[i]);
297+
if (layer.get() == static_cast<LayerBase const*>(this))
298+
break;
299+
under.orSelf(layer->visibleRegionScreen);
300+
}
301+
// if not everything below us is covered, we plug the holes!
302+
Region holes(clip.subtract(under));
303+
if (!holes.isEmpty()) {
304+
clearWithOpenGL(holes);
305+
}
287306
return;
288307
}
289308
drawWithOpenGL(clip, mTextures[index]);

0 commit comments

Comments
 (0)