diff options
| author | 2010-05-07 13:39:29 -0700 | |
|---|---|---|
| committer | 2010-05-07 13:39:29 -0700 | |
| commit | c69775d616c25d31dcea119ab1e7af19148853e2 (patch) | |
| tree | 7c08d5a69566a8c6f8631362447ea370b53d05b2 | |
| parent | 0dd3a239519369933d4efa701479c816b4b33874 (diff) | |
| parent | 2df6f515675917a7a2812cf35faa5a1f47a6305f (diff) | |
Merge "fix [2664345] Flash: Bad flicker at the end of a pinch zoom." into froyo
| -rw-r--r-- | libs/surfaceflinger/Layer.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp index 0a3254dec5c0..ce7e9aa3f9bc 100644 --- a/libs/surfaceflinger/Layer.cpp +++ b/libs/surfaceflinger/Layer.cpp @@ -281,9 +281,28 @@ void Layer::onDraw(const Region& clip) const GLuint textureName = mTextures[index].name; if (UNLIKELY(textureName == -1LU)) { // the texture has not been created yet, this Layer has - // in fact never been drawn into. this happens frequently with - // SurfaceView. - clearWithOpenGL(clip); + // in fact never been drawn into. This happens frequently with + // SurfaceView because the WindowManager can't know when the client + // has drawn the first time. + + // If there is nothing under us, we paint the screen in black, otherwise + // we just skip this update. + + // figure out if there is something below us + Region under; + const SurfaceFlinger::LayerVector& drawingLayers(mFlinger->mDrawingState.layersSortedByZ); + const size_t count = drawingLayers.size(); + for (size_t i=0 ; i<count ; ++i) { + const sp<LayerBase>& layer(drawingLayers[i]); + if (layer.get() == static_cast<LayerBase const*>(this)) + break; + under.orSelf(layer->visibleRegionScreen); + } + // if not everything below us is covered, we plug the holes! + Region holes(clip.subtract(under)); + if (!holes.isEmpty()) { + clearWithOpenGL(holes); + } return; } drawWithOpenGL(clip, mTextures[index]); |