diff options
author | Mathias Agopian <mathias@google.com> | 2010-05-06 20:21:45 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-05-06 20:21:45 -0700 |
commit | 179169e88e05261196b76d7ddf94aa870aafaf9a (patch) | |
tree | bc4ecd363fce00fea66961b5aabbdf58bb5de3f0 /libs/surfaceflinger/Layer.cpp | |
parent | 359b3fd8d8351ac2abc3ec65f355d4fe9d5b9c31 (diff) | |
download | frameworks_native-179169e88e05261196b76d7ddf94aa870aafaf9a.zip frameworks_native-179169e88e05261196b76d7ddf94aa870aafaf9a.tar.gz frameworks_native-179169e88e05261196b76d7ddf94aa870aafaf9a.tar.bz2 |
fix [2664345] Flash: Bad flicker at the end of a pinch zoom.
the window manger puts SurfaceViews up before they have been
rendered into, because of that surfaceflinger doesn't have
anything ready to draw for that surface when an udpate occurs
and responds by filling the surface with black.
With this fix, we only fill those areas of the framebuffer
that would otherwise be undefined (no content at all).
in the Flash case, the "flash" window is not drawn at all
until it has some content, instead the underlaying browser
window is shown.
Change-Id: Ifb610f7f8c27b88edf83e09adc4803fc295c15a1
Diffstat (limited to 'libs/surfaceflinger/Layer.cpp')
-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 0a3254d..ce7e9aa 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]); |