diff options
Diffstat (limited to 'WebCore')
-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(); |