summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebCore/platform/graphics/android/BaseLayerAndroid.cpp8
-rw-r--r--WebCore/platform/graphics/android/GLWebViewState.cpp25
-rw-r--r--WebCore/platform/graphics/android/GLWebViewState.h12
3 files changed, 33 insertions, 12 deletions
diff --git a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
index 52ef8ca..b6177aa 100644
--- a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
@@ -195,13 +195,15 @@ bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale)
// the two pages (current one and future one with the new scale factor)
if (m_glWebViewState->scaleRequestState() == GLWebViewState::kReceivedNewScale) {
TiledPage* nextTiledPage = m_glWebViewState->backPage();
- double transitionTime = m_glWebViewState->transitionTime(currentTime);
+ double transitionTime = (scale < m_glWebViewState->currentScale()) ?
+ m_glWebViewState->zoomOutTransitionTime(currentTime) :
+ m_glWebViewState->zoomInTransitionTime(currentTime);
float newTilesTransparency = 1;
if (scale < m_glWebViewState->currentScale())
- newTilesTransparency = 1 - m_glWebViewState->transparency(currentTime);
+ newTilesTransparency = 1 - m_glWebViewState->zoomOutTransparency(currentTime);
else
- transparency = m_glWebViewState->transparency(currentTime);
+ transparency = m_glWebViewState->zoomInTransparency(currentTime);
nextTiledPage->draw(newTilesTransparency, viewportTileBounds);
diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp
index 252eeab..3b66b04 100644
--- a/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -201,17 +201,32 @@ void GLWebViewState::scheduleUpdate(const double& currentTime,
}
}
-double GLWebViewState::transitionTime(double currentTime)
+double GLWebViewState::zoomInTransitionTime(double currentTime)
{
if (m_transitionTime == -1)
- m_transitionTime = currentTime + s_transitionDelay;
+ m_transitionTime = currentTime + s_zoomInTransitionDelay;
return m_transitionTime;
}
-float GLWebViewState::transparency(double currentTime)
+double GLWebViewState::zoomOutTransitionTime(double currentTime)
{
- float t = transitionTime(currentTime) - currentTime;
- t *= s_invTransitionDelay;
+ if (m_transitionTime == -1)
+ m_transitionTime = currentTime + s_zoomOutTransitionDelay;
+ return m_transitionTime;
+}
+
+
+float GLWebViewState::zoomInTransparency(double currentTime)
+{
+ float t = zoomInTransitionTime(currentTime) - currentTime;
+ t *= s_invZoomInTransitionDelay;
+ return fmin(1, fmax(0, t));
+}
+
+float GLWebViewState::zoomOutTransparency(double currentTime)
+{
+ float t = zoomOutTransitionTime(currentTime) - currentTime;
+ t *= s_invZoomOutTransitionDelay;
return fmin(1, fmax(0, t));
}
diff --git a/WebCore/platform/graphics/android/GLWebViewState.h b/WebCore/platform/graphics/android/GLWebViewState.h
index 3f933ca..81dcb9e 100644
--- a/WebCore/platform/graphics/android/GLWebViewState.h
+++ b/WebCore/platform/graphics/android/GLWebViewState.h
@@ -164,8 +164,10 @@ public:
void setFutureViewport(const SkIRect& viewport) { m_futureViewportTileBounds = viewport; }
double updateTime() const { return m_updateTime; }
void setUpdateTime(double value) { m_updateTime = value; }
- double transitionTime(double currentTime);
- float transparency(double currentTime);
+ double zoomInTransitionTime(double currentTime);
+ double zoomOutTransitionTime(double currentTime);
+ float zoomInTransparency(double currentTime);
+ float zoomOutTransparency(double currentTime);
void resetTransitionTime() { m_transitionTime = -1; }
unsigned int paintBaseLayerContent(SkCanvas* canvas);
@@ -217,8 +219,10 @@ private:
static const double s_updateDelay = 0.1; // 100 ms
// Delay for the transition between the two pages
- static const double s_transitionDelay = 0.5; // 500 ms
- static const double s_invTransitionDelay = 2;
+ static const double s_zoomInTransitionDelay = 0.1; // 100 ms
+ static const double s_invZoomInTransitionDelay = 10;
+ static const double s_zoomOutTransitionDelay = 0.2; // 200 ms
+ static const double s_invZoomOutTransitionDelay = 5;
GLScaleState m_scaleRequestState;
float m_currentScale;