summaryrefslogtreecommitdiffstats
path: root/WebCore
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2011-03-23 14:59:41 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-03-23 14:59:41 -0700
commit5bdfd148249f6196a184550910f1cd8cb138fe8c (patch)
tree18b23352122a8aa070481d70ab5d0f54c632b666 /WebCore
parent9d3427742106914aa11f06f5cf967a0d538f8d24 (diff)
parentce22862b0c41a8fedaf28166e857034f1484ea5c (diff)
downloadexternal_webkit-5bdfd148249f6196a184550910f1cd8cb138fe8c.zip
external_webkit-5bdfd148249f6196a184550910f1cd8cb138fe8c.tar.gz
external_webkit-5bdfd148249f6196a184550910f1cd8cb138fe8c.tar.bz2
Merge "Regression fix from bug:4136077 Plus animations improvement bug:3389597" into honeycomb-mr1
Diffstat (limited to 'WebCore')
-rw-r--r--WebCore/platform/graphics/android/AndroidAnimation.cpp17
-rw-r--r--WebCore/platform/graphics/android/AndroidAnimation.h2
-rw-r--r--WebCore/platform/graphics/android/BaseLayerAndroid.cpp11
-rw-r--r--WebCore/platform/graphics/android/BaseTile.cpp8
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.cpp5
-rw-r--r--WebCore/platform/graphics/android/TexturesGenerator.cpp7
-rw-r--r--WebCore/platform/graphics/android/TexturesGenerator.h2
-rw-r--r--WebCore/platform/graphics/android/TilesManager.h4
8 files changed, 40 insertions, 16 deletions
diff --git a/WebCore/platform/graphics/android/AndroidAnimation.cpp b/WebCore/platform/graphics/android/AndroidAnimation.cpp
index a064d05..199db53 100644
--- a/WebCore/platform/graphics/android/AndroidAnimation.cpp
+++ b/WebCore/platform/graphics/android/AndroidAnimation.cpp
@@ -60,6 +60,7 @@ AndroidAnimation::AndroidAnimation(AnimatedPropertyID type,
double beginTime)
: m_beginTime(beginTime)
, m_duration(animation->duration())
+ , m_finished(false)
, m_iterationCount(animation->iterationCount())
, m_direction(animation->direction())
, m_timingFunction(animation->timingFunction())
@@ -77,6 +78,7 @@ AndroidAnimation::AndroidAnimation(AnimatedPropertyID type,
AndroidAnimation::AndroidAnimation(AndroidAnimation* anim)
: m_beginTime(anim->m_beginTime)
, m_duration(anim->m_duration)
+ , m_finished(anim->m_finished)
, m_iterationCount(anim->m_iterationCount)
, m_direction(anim->m_direction)
, m_timingFunction(anim->m_timingFunction)
@@ -118,8 +120,10 @@ bool AndroidAnimation::checkIterationsAndProgress(double time, float* finalProgr
return false;
// If not infinite, return false if we are done
- if (m_iterationCount > 0 && progress > dur)
+ if (m_iterationCount > 0 && progress > dur) {
+ *finalProgress = 1.0;
return false;
+ }
double fractionalTime = progress / m_duration;
int integralTime = static_cast<int>(fractionalTime);
@@ -280,8 +284,11 @@ PassRefPtr<AndroidAnimation> AndroidTransformAnimation::copy()
bool AndroidTransformAnimation::evaluate(LayerAndroid* layer, double time)
{
float progress;
- if (!checkIterationsAndProgress(time, &progress))
- return false;
+ bool ret = true;
+ if (!checkIterationsAndProgress(time, &progress)) {
+ m_finished = true;
+ ret = false;
+ }
if (progress < 0) // we still want to be evaluated until we get progress > 0
return true;
@@ -292,7 +299,7 @@ bool AndroidTransformAnimation::evaluate(LayerAndroid* layer, double time)
, m_operations->size(), progress, layer->uniqueId(), size.width(), size.height());
if (!m_operations->size())
- return true;
+ return false;
// First, we need to get the from and to values
@@ -351,7 +358,7 @@ bool AndroidTransformAnimation::evaluate(LayerAndroid* layer, double time)
// Set the final transform on the layer
layer->setTransform(transformMatrix);
- return true;
+ return ret;
}
} // namespace WebCore
diff --git a/WebCore/platform/graphics/android/AndroidAnimation.h b/WebCore/platform/graphics/android/AndroidAnimation.h
index 4f84799..602abe2 100644
--- a/WebCore/platform/graphics/android/AndroidAnimation.h
+++ b/WebCore/platform/graphics/android/AndroidAnimation.h
@@ -53,11 +53,13 @@ class AndroidAnimation : public RefCounted<AndroidAnimation> {
void setName(const String& name) { m_name = name; }
String name() { return m_name; }
AnimatedPropertyID type() { return m_type; }
+ bool finished() { return m_finished; }
protected:
double m_beginTime;
double m_elapsedTime;
double m_duration;
+ bool m_finished;
int m_iterationCount;
int m_direction;
RefPtr<TimingFunction> m_timingFunction;
diff --git a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
index 5c63117..7a08e94 100644
--- a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
@@ -345,16 +345,21 @@ bool BaseLayerAndroid::drawGL(LayerAndroid* compositedRoot,
// Now that we marked the textures being used, we delete
// the unnecessary ones to make space...
TilesManager::instance()->cleanupLayersTextures(compositedRoot);
- // Finally do another pass to create new textures and schedule
- // repaints if needed
- compositedRoot->createGLTextures();
}
+ // Finally do another pass to create new textures and schedule
+ // repaints if needed
+ compositedRoot->createGLTextures();
if (compositedRoot->drawGL(m_glWebViewState, matrix))
needsRedraw = true;
else if (!animsRunning)
m_glWebViewState->resetLayersDirtyArea();
+ if (animsRunning) {
+ m_glWebViewState->resetLayersDirtyArea();
+ m_glWebViewState->resetFrameworkInval();
+ }
+
} else {
TilesManager::instance()->cleanupLayersTextures(0);
}
diff --git a/WebCore/platform/graphics/android/BaseTile.cpp b/WebCore/platform/graphics/android/BaseTile.cpp
index c67e2b8..391e87b 100644
--- a/WebCore/platform/graphics/android/BaseTile.cpp
+++ b/WebCore/platform/graphics/android/BaseTile.cpp
@@ -427,9 +427,15 @@ int BaseTile::paintPartialBitmap(SkIRect r, float ptx, float pty,
nCanvas->translate(tx, ty);
int pictureCount = tiledPage->paintBaseLayerContent(nCanvas);
picture.endRecording();
+
+ bool visualIndicator = TilesManager::instance()->getShowVisualIndicator();
+ if (visualIndicator)
+ canvas.save();
picture.draw(&canvas);
+ if (visualIndicator)
+ canvas.restore();
- if (TilesManager::instance()->getShowVisualIndicator()) {
+ if (visualIndicator) {
int color = 20 + pictureCount % 100;
canvas.drawARGB(color, 0, 255, 0);
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp
index dc40fb1..433e7ec 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -243,7 +243,8 @@ bool LayerAndroid::evaluateAnimations(double time)
gDebugNbAnims++;
nbAnims++;
LayerAndroid* currentLayer = const_cast<LayerAndroid*>(this);
- if ((it->second)->evaluate(currentLayer, time))
+ if (!(it->second)->finished() &&
+ (it->second)->evaluate(currentLayer, time))
m_hasRunningAnimations = true;
}
@@ -889,7 +890,7 @@ void LayerAndroid::createGLTextures()
uniqueId(), this, m_dirty, m_reservedTexture,
m_reservedTexture->rect().width(), m_reservedTexture->rect().height());
PaintLayerOperation* operation = new PaintLayerOperation(this);
- TilesManager::instance()->scheduleOperation(operation);
+ TilesManager::instance()->scheduleOperation(operation, !m_drawingTexture);
} else {
XLOG("We don't schedule a paint for layer %d (%x), because we already sent a request",
uniqueId(), this);
diff --git a/WebCore/platform/graphics/android/TexturesGenerator.cpp b/WebCore/platform/graphics/android/TexturesGenerator.cpp
index fae7ece..ad5de1f 100644
--- a/WebCore/platform/graphics/android/TexturesGenerator.cpp
+++ b/WebCore/platform/graphics/android/TexturesGenerator.cpp
@@ -51,7 +51,7 @@
namespace WebCore {
-void TexturesGenerator::scheduleOperation(QueuedOperation* operation)
+void TexturesGenerator::scheduleOperation(QueuedOperation* operation, bool scheduleFirst)
{
{
android::Mutex::Autolock lock(mRequestedOperationsLock);
@@ -68,7 +68,10 @@ void TexturesGenerator::scheduleOperation(QueuedOperation* operation)
}
}
- mRequestedOperations.append(operation);
+ if (scheduleFirst)
+ mRequestedOperations.prepend(operation);
+ else
+ mRequestedOperations.append(operation);
}
mRequestedOperationsCond.signal();
}
diff --git a/WebCore/platform/graphics/android/TexturesGenerator.h b/WebCore/platform/graphics/android/TexturesGenerator.h
index e36d85e..169471c 100644
--- a/WebCore/platform/graphics/android/TexturesGenerator.h
+++ b/WebCore/platform/graphics/android/TexturesGenerator.h
@@ -54,7 +54,7 @@ public:
void removeOperationsForTexture(LayerTexture* texture);
void removeOperationsForFilter(OperationFilter* filter);
- void scheduleOperation(QueuedOperation* operation);
+ void scheduleOperation(QueuedOperation* operation, bool scheduleFirst);
private:
virtual bool threadLoop();
diff --git a/WebCore/platform/graphics/android/TilesManager.h b/WebCore/platform/graphics/android/TilesManager.h
index 8c44bea..5a4e28a 100644
--- a/WebCore/platform/graphics/android/TilesManager.h
+++ b/WebCore/platform/graphics/android/TilesManager.h
@@ -67,9 +67,9 @@ public:
m_pixmapsGenerationThread->removeOperationsForTexture(texture);
}
- void scheduleOperation(QueuedOperation* operation)
+ void scheduleOperation(QueuedOperation* operation, bool scheduleFirst = false)
{
- m_pixmapsGenerationThread->scheduleOperation(operation);
+ m_pixmapsGenerationThread->scheduleOperation(operation, scheduleFirst);
}
ShaderProgram* shader() { return &m_shader; }