diff options
author | Nicolas Roard <nicolasroard@google.com> | 2011-10-06 17:10:55 -0700 |
---|---|---|
committer | Nicolas Roard <nicolasroard@google.com> | 2011-10-06 17:46:59 -0700 |
commit | 7baf9c5d380cd891e4e6488c09a08d0e9c7e1e4f (patch) | |
tree | 9b8e693fc1e06e08689207569ad62433e24cf854 /Source | |
parent | 4a7bb352bfa0e515586d929c9528bc6e3a4ca0da (diff) | |
download | external_webkit-7baf9c5d380cd891e4e6488c09a08d0e9c7e1e4f.zip external_webkit-7baf9c5d380cd891e4e6488c09a08d0e9c7e1e4f.tar.gz external_webkit-7baf9c5d380cd891e4e6488c09a08d0e9c7e1e4f.tar.bz2 |
Fix repaint request logic for the image layer code path
bug:5425608 bug:5218173
Change-Id: Ib14a5e53466b05781a842e24443e89a4779dba68
Diffstat (limited to 'Source')
3 files changed, 22 insertions, 25 deletions
diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp index 09a4bc6..eadac6b 100644 --- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp @@ -120,7 +120,6 @@ GraphicsLayerAndroid::GraphicsLayerAndroid(GraphicsLayerClient* client) : m_haveContents(false), m_haveImage(false), m_newImage(false), - m_imageRef(0), m_foregroundLayer(0), m_foregroundClipLayer(0) { @@ -387,6 +386,7 @@ void GraphicsLayerAndroid::setDrawsContent(bool drawsContent) if (drawsContent == m_drawsContent) return; GraphicsLayer::setDrawsContent(drawsContent); + m_contentLayer->setVisible(drawsContent); if (m_drawsContent) { m_haveContents = true; setNeedsDisplay(); @@ -836,22 +836,14 @@ void GraphicsLayerAndroid::setContentsToImage(Image* image) if (image) { m_haveContents = true; m_haveImage = true; - // Only pass the new image if it's a different one - if (image->nativeImageForCurrentFrame() != m_imageRef) { - m_newImage = true; - m_contentLayer->setContentsImage(image->nativeImageForCurrentFrame()); - // remember the passed image. - m_imageRef = image->nativeImageForCurrentFrame(); - setNeedsDisplay(); - askForSync(); - } + m_newImage = true; + m_contentLayer->setContentsImage(image->nativeImageForCurrentFrame()); } - if (m_haveImage && !image) { + if (m_haveImage && !image) m_contentLayer->setContentsImage(0); - m_imageRef = 0; - setNeedsDisplay(); - askForSync(); - } + + setNeedsDisplay(); + askForSync(); } void GraphicsLayerAndroid::setContentsToMedia(PlatformLayer* mediaLayer) diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.h b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.h index a693de3..af8d7ce 100644 --- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.h +++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.h @@ -147,7 +147,6 @@ private: bool m_haveContents; bool m_haveImage; bool m_newImage; - SkBitmapRef* m_imageRef; // only used to remember previously passed images SkRegion m_dirtyRegion; diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp index 4e00a4b..91c44c6 100644 --- a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -778,6 +778,9 @@ bool LayerAndroid::updateWithTree(LayerAndroid* newTree) return needsRepaint; } +// Return true to indicate to WebViewCore that the updates +// are too complicated to be fully handled and we need a full +// call to webkit (e.g. handle repaints) bool LayerAndroid::updateWithLayer(LayerAndroid* layer) { if (!layer) @@ -790,6 +793,9 @@ bool LayerAndroid::updateWithLayer(LayerAndroid* layer) m_opacity = layer->m_opacity; m_transform = layer->m_transform; + if (m_imageRef != layer->m_imageRef) + m_visible = false; + if ((m_recordingPicture != layer->m_recordingPicture) || (m_imageRef != layer->m_imageRef)) return true; @@ -879,28 +885,28 @@ bool LayerAndroid::drawGL(GLWebViewState* glWebViewState, SkMatrix& matrix) if (!m_visible) return false; - bool askPaint = false; + bool askScreenUpdate = false; if (m_texture) - askPaint |= m_texture->draw(); + askScreenUpdate |= m_texture->draw(); if (m_imageTexture) m_imageTexture->draw(this); // When the layer is dirty, the UI thread should be notified to redraw. - askPaint |= drawChildrenGL(glWebViewState, matrix); + askScreenUpdate |= drawChildrenGL(glWebViewState, matrix); m_atomicSync.lock(); - askPaint |= m_dirty; - if (askPaint || m_hasRunningAnimations || m_drawTransform.hasPerspective()) + askScreenUpdate |= m_dirty; + if (askScreenUpdate || m_hasRunningAnimations || m_drawTransform.hasPerspective()) addDirtyArea(glWebViewState); m_atomicSync.unlock(); - return askPaint; + return askScreenUpdate; } bool LayerAndroid::drawChildrenGL(GLWebViewState* glWebViewState, SkMatrix& matrix) { - bool askPaint = false; + bool askScreenUpdate = false; int count = this->countChildren(); if (count > 0) { Vector <LayerAndroid*> sublayers; @@ -911,11 +917,11 @@ bool LayerAndroid::drawChildrenGL(GLWebViewState* glWebViewState, SkMatrix& matr std::stable_sort(sublayers.begin(), sublayers.end(), compareLayerZ); for (int i = 0; i < count; i++) { LayerAndroid* layer = sublayers[i]; - askPaint |= layer->drawGL(glWebViewState, matrix); + askScreenUpdate |= layer->drawGL(glWebViewState, matrix); } } - return askPaint; + return askScreenUpdate; } void LayerAndroid::extraDraw(SkCanvas* canvas) |