diff options
author | Nicolas Roard <nicolas@android.com> | 2011-02-28 09:58:49 -0800 |
---|---|---|
committer | The Android Automerger <android-build@android.com> | 2011-02-28 16:45:09 -0800 |
commit | 65b97159d8d180594e604d2ca5f6674388354416 (patch) | |
tree | 667d4ab9b5ebfad88357607a0dcc3534a88ad30c /WebCore/platform | |
parent | 50b859bbf59fd5f64f2b9fbbf24c83dc9ae789b7 (diff) | |
download | external_webkit-65b97159d8d180594e604d2ca5f6674388354416.zip external_webkit-65b97159d8d180594e604d2ca5f6674388354416.tar.gz external_webkit-65b97159d8d180594e604d2ca5f6674388354416.tar.bz2 |
Cap framerate at 60fps
bug:3471680
Change-Id: Ia19c4402858b758312c1f801bda990275f970b63
Diffstat (limited to 'WebCore/platform')
-rw-r--r-- | WebCore/platform/graphics/android/BaseLayerAndroid.cpp | 1 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/GLWebViewState.cpp | 16 |
2 files changed, 15 insertions, 2 deletions
diff --git a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp index e373c3d..6f27321 100644 --- a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp +++ b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp @@ -337,7 +337,6 @@ bool BaseLayerAndroid::drawGL(IntRect& viewRect, SkRect& visibleRect, TilesManager::instance()->cleanupLayersTextures(0); } - glFinish(); glBindBuffer(GL_ARRAY_BUFFER, 0); m_previousVisible = visibleRect; diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp index eef32e8..57d4c66 100644 --- a/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -32,11 +32,11 @@ #include "ClassTracker.h" #include "LayerAndroid.h" #include "TilesManager.h" +#include <wtf/CurrentTime.h> #ifdef DEBUG #include <cutils/log.h> -#include <wtf/CurrentTime.h> #include <wtf/text/CString.h> #undef XLOG @@ -52,6 +52,8 @@ #define FIRST_TILED_PAGE_ID 1 #define SECOND_TILED_PAGE_ID 2 +#define FRAMERATE_CAP 0.01666 // We cap at 60 fps + namespace WebCore { using namespace android; @@ -296,8 +298,20 @@ void GLWebViewState::setViewport(SkRect& viewport, float scale) m_tiledPageB->updateBaseTileSize(); } +static double gPrevTime = 0; + bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, float scale, SkColor color) { + glFinish(); + + double currentTime = WTF::currentTime(); + double delta = currentTime - gPrevTime; + + if (delta < FRAMERATE_CAP) + return true; + + gPrevTime = currentTime; + m_baseLayerLock.lock(); BaseLayerAndroid* baseLayer = m_currentBaseLayer; baseLayer->safeRef(); |