summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2012-05-30 16:54:41 -0700
committerTeng-Hui Zhu <ztenghui@google.com>2012-05-31 09:47:35 -0700
commit150a26fa5442a5fc931e5df05808e33aac1a7dea (patch)
treecb7bb0b1d274a3832535b9c78d7c673a6e001420 /Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp
parent6f60c96bbd87b5c54d89aeb23ace06ae3647e2f3 (diff)
downloadexternal_webkit-150a26fa5442a5fc931e5df05808e33aac1a7dea.zip
external_webkit-150a26fa5442a5fc931e5df05808e33aac1a7dea.tar.gz
external_webkit-150a26fa5442a5fc931e5df05808e33aac1a7dea.tar.bz2
Fix animation in single surface mode
bug:5683630 Change-Id: I4d617962a8412de884903f150799f733ea996e1c
Diffstat (limited to 'Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp
index 724bf89..174720f 100644
--- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp
@@ -171,7 +171,8 @@ void SurfaceCollectionManager::updateScrollableLayer(int layerId, int x, int y)
}
-int SurfaceCollectionManager::singleSurfaceModeInvalidation(bool scrolling,
+int SurfaceCollectionManager::singleSurfaceModeInvalidation(bool hasRunningAnimation,
+ bool scrolling,
bool shouldDraw)
{
int returnFlags = 0;
@@ -179,21 +180,28 @@ int SurfaceCollectionManager::singleSurfaceModeInvalidation(bool scrolling,
// scrolling or have an incoming painting tree.
bool requireDirtyAll = (m_previouslyScrolling && !scrolling)
|| m_newPaintingCollection;
- if (requireDirtyAll)
- TilesManager::instance()->dirtyAllTiles();
// We also need to tell the framework to continue to invoke until
// the base layer is ready.
bool drawingBaseSurfaceReady = m_drawingCollection
- && m_drawingCollection->isBaseSurfaceReady();
+ && m_drawingCollection->isReady();
+
+ // When the base layer is ready, we can ask the framework to draw. And if
+ // animation is running, dirty all the tiles, otherwise the animation will
+ // be paused.
+ if (drawingBaseSurfaceReady) {
+ if (!shouldDraw)
+ returnFlags |= DrawGlInfo::kStatusDraw;
+ else
+ requireDirtyAll |= hasRunningAnimation;
+ }
+ if (requireDirtyAll)
+ TilesManager::instance()->dirtyAllTiles();
+
bool requireInvoke = requireDirtyAll || !drawingBaseSurfaceReady;
if (requireInvoke)
returnFlags |= DrawGlInfo::kStatusInvoke;
- // When the base layer is ready, we can ask the framework to draw.
- if (!shouldDraw && drawingBaseSurfaceReady)
- returnFlags |= DrawGlInfo::kStatusDraw;
-
m_newPaintingCollection = false;
m_previouslyScrolling = scrolling;
@@ -246,9 +254,6 @@ int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect,
if (m_paintingCollection)
returnFlags |= DrawGlInfo::kStatusInvoke;
- if (singleSurfaceMode)
- returnFlags |= singleSurfaceModeInvalidation(scrolling, shouldDraw);
-
if (!shouldDraw) {
if (didCollectionSwap
|| (!m_paintingCollection
@@ -270,6 +275,7 @@ int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect,
// Don't have a drawing collection, draw white background
Color background = Color::white;
bool drawBackground = true;
+ bool hasRunningAnimation = false;
if (m_drawingCollection) {
bool drawingReady = didCollectionSwap || m_drawingCollection->isReady();
@@ -288,7 +294,7 @@ int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect,
returnFlags |= DrawGlInfo::kStatusInvoke;
}
- m_drawingCollection->evaluateAnimations(currentTime);
+ hasRunningAnimation = m_drawingCollection->evaluateAnimations(currentTime);
ALOGV("drawing collection %p", m_drawingCollection);
background = m_drawingCollection->getBackgroundColor();
@@ -298,6 +304,9 @@ int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect,
background = m_paintingCollection->getBackgroundColor();
}
+ if (singleSurfaceMode)
+ returnFlags |= singleSurfaceModeInvalidation(hasRunningAnimation,
+ scrolling, shouldDraw);
// Start doing the actual GL drawing.
if (drawBackground) {
ALOGV("background is %x", background.rgb());