From 9f5143f9ae49a8e5fdb7ea626c4efad66096b020 Mon Sep 17 00:00:00 2001 From: Nicolas Roard Date: Tue, 15 Mar 2011 18:20:42 -0700 Subject: Implement partial screen invalidations bug:3461349 Change-Id: Id654d176c58027c67be7cb604b87c0ec68984525 --- WebKit/android/nav/WebView.cpp | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'WebKit/android') diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp index 8cc5810..6e85873 100644 --- a/WebKit/android/nav/WebView.cpp +++ b/WebKit/android/nav/WebView.cpp @@ -428,7 +428,7 @@ void drawCursorPostamble() } } -bool drawGL(WebCore::IntRect& viewRect, float scale, int extras) +bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect, float scale, int extras) { #if USE(ACCELERATED_COMPOSITING) if (!m_baseLayer || inFullScreenMode()) @@ -499,7 +499,7 @@ bool drawGL(WebCore::IntRect& viewRect, float scale, int extras) SkRect visibleRect; calcOurContentVisibleRect(&visibleRect); - bool ret = m_glWebViewState->drawGL(viewRect, visibleRect, scale); + bool ret = m_glWebViewState->drawGL(viewRect, visibleRect, invalRect, scale); if (ret || m_glWebViewState->currentPictureCounter() != pic) return true; #endif @@ -1473,7 +1473,7 @@ private: // local state for WebView class GLDrawFunctor : Functor { public: GLDrawFunctor(WebView* _wvInstance, - bool(WebView::*_funcPtr)(WebCore::IntRect&, jfloat, jint), + bool(WebView::*_funcPtr)(WebCore::IntRect&, WebCore::IntRect*, jfloat, jint), WebCore::IntRect _viewRect, float _scale, int _extras) { wvInstance = _wvInstance; funcPtr = _funcPtr; @@ -1501,13 +1501,26 @@ class GLDrawFunctor : Functor { float dirtyBottom; }; - bool retVal = (*wvInstance.*funcPtr)(viewRect, scale, extras); + WebCore::IntRect inval; + int titlebarHeight = webViewRect.height() - viewRect.height(); + bool retVal = (*wvInstance.*funcPtr)(viewRect, &inval, scale, extras); if (retVal) { DrawConstraints* constraints = reinterpret_cast(data); - constraints->dirtyLeft = webViewRect.x(); - constraints->dirtyTop = webViewRect.y(); - constraints->dirtyRight = webViewRect.right(); - constraints->dirtyBottom = webViewRect.bottom(); + IntRect finalInval; + if (inval.isEmpty()) { + finalInval = webViewRect; + retVal = false; + } else { + finalInval.setX(webViewRect.x() + inval.x()); + finalInval.setY(webViewRect.y() + inval.y() + titlebarHeight); + finalInval.setWidth(inval.width()); + finalInval.setHeight(inval.height()); + finalInval.intersect(webViewRect); + } + constraints->dirtyLeft = finalInval.x(); + constraints->dirtyTop = finalInval.y(); + constraints->dirtyRight = finalInval.right(); + constraints->dirtyBottom = finalInval.bottom(); } // return 1 if invalidation needed, 0 otherwise return retVal ? 1 : 0; @@ -1520,7 +1533,7 @@ class GLDrawFunctor : Functor { } private: WebView* wvInstance; - bool (WebView::*funcPtr)(WebCore::IntRect&, float, int); + bool (WebView::*funcPtr)(WebCore::IntRect&, WebCore::IntRect*, float, int); WebCore::IntRect viewRect; WebCore::IntRect webViewRect; jfloat scale; @@ -1805,13 +1818,14 @@ static bool nativeDrawGL(JNIEnv *env, jobject obj, jobject jrect, jfloat scale, jint extras) { WebCore::IntRect viewRect = jrect_to_webrect(env, jrect); - return GET_NATIVE_VIEW(env, obj)->drawGL(viewRect, scale, extras); + WebCore::IntRect invalRect; + return GET_NATIVE_VIEW(env, obj)->drawGL(viewRect, &invalRect, scale, extras); } static bool nativeEvaluateLayersAnimations(JNIEnv *env, jobject obj) { #if USE(ACCELERATED_COMPOSITING) - const LayerAndroid* root = GET_NATIVE_VIEW(env, obj)->compositeRoot(); + LayerAndroid* root = GET_NATIVE_VIEW(env, obj)->compositeRoot(); if (root) return root->evaluateAnimations(); #endif -- cgit v1.1