diff options
Diffstat (limited to 'WebCore/platform/graphics/android/GLWebViewState.cpp')
-rw-r--r-- | WebCore/platform/graphics/android/GLWebViewState.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp index b3c5b02..3ca04e9 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; @@ -299,8 +301,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; SkSafeRef(baseLayer); |