diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2012-05-31 10:12:25 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-05-31 10:12:25 -0700 |
commit | 362d14dc49917319bec73c2f89aee9c6f2692a48 (patch) | |
tree | cd37b6e7cfcbcc54541b3c0f62f74ce001329edd /Source | |
parent | be480525e35fed411698c2a58200b5d010f5ecde (diff) | |
parent | b10052827bf3e6263912013b2daaf928a63508e8 (diff) | |
download | external_webkit-362d14dc49917319bec73c2f89aee9c6f2692a48.zip external_webkit-362d14dc49917319bec73c2f89aee9c6f2692a48.tar.gz external_webkit-362d14dc49917319bec73c2f89aee9c6f2692a48.tar.bz2 |
am b1005282: am 150a26fa: Fix animation in single surface mode
* commit 'b10052827bf3e6263912013b2daaf928a63508e8':
Fix animation in single surface mode
Diffstat (limited to 'Source')
4 files changed, 27 insertions, 27 deletions
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp index 3cfabe1..1c769bf 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp @@ -151,10 +151,8 @@ void SurfaceCollection::addFrameworkInvals() bool SurfaceCollection::isReady() { // Override layer readiness check for single surface mode - if (m_compositedRoot->state()->isSingleSurfaceRenderingMode()) { - // TODO: single surface mode should be properly double buffered - return true; - } + if (m_compositedRoot->state()->isSingleSurfaceRenderingMode()) + return m_surfaces[0]->isReady(); for (unsigned int i = 0; i < m_surfaces.size(); i++) { if (!m_surfaces[i]->isReady()) { @@ -165,12 +163,6 @@ bool SurfaceCollection::isReady() return true; } -bool SurfaceCollection::isBaseSurfaceReady() -{ - // m_surfaces[0] should be the base surface when in single surface mode. - return m_surfaces[0]->isReady(); -} - bool SurfaceCollection::isMissingBackgroundContent() { // return true when the first surface is missing content (indicating the @@ -222,9 +214,9 @@ void SurfaceCollection::mergeInvalsInto(SurfaceCollection* replacementSurface) m_compositedRoot->mergeInvalsInto(replacementSurface->m_compositedRoot); } -void SurfaceCollection::evaluateAnimations(double currentTime) +bool SurfaceCollection::evaluateAnimations(double currentTime) { - m_compositedRoot->evaluateAnimations(currentTime); + return m_compositedRoot->evaluateAnimations(currentTime); } bool SurfaceCollection::hasCompositedLayers() diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h index ff4195f..a903015 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h @@ -54,7 +54,6 @@ public: void swapTiles(); void addFrameworkInvals(); bool isReady(); - bool isBaseSurfaceReady(); bool isMissingBackgroundContent(); void removePainterOperations(); void computeTexturesAmount(TexturesResult* result); @@ -63,7 +62,7 @@ public: void setIsPainting(SurfaceCollection* drawingSurfaceCollection); void setIsDrawing(); void mergeInvalsInto(SurfaceCollection* replacementSurfaceCollection); - void evaluateAnimations(double currentTime); + bool evaluateAnimations(double currentTime); bool hasCompositedLayers(); bool hasCompositedAnimations(); 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()); diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h index 6aed060..53b5bb6 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h @@ -59,7 +59,7 @@ private: void swap(); void clearCollections(); void updatePaintingCollection(SurfaceCollection* newCollection); - int singleSurfaceModeInvalidation(bool scrolling, bool shouldDraw); + int singleSurfaceModeInvalidation(bool hasRunningAnimation, bool scrolling, bool shouldDraw); SurfaceCollection* m_drawingCollection; SurfaceCollection* m_paintingCollection; SurfaceCollection* m_queuedCollection; |