Title: [133161] trunk/Source/WebKit2
Revision
133161
Author
kenn...@webkit.org
Date
2012-11-01 07:14:06 -0700 (Thu, 01 Nov 2012)

Log Message

[EFL] Correct our use of the coordinated graphics
https://bugs.webkit.org/show_bug.cgi?id=100947

Reviewed by Alexis Menard.

Replace the display(...) call with a regular update() on the view.
In the coordinated graphics case this updates our view using
paintToCurrentGLContext with our viewmodel matrix and clips it to
the viewport. This avoid the need to manually joining update regions.

Unneeded update calls have also been removed and the resizing
logic has been improved.

* UIProcess/API/efl/EwkViewImpl.cpp:
(EwkViewImpl::displayTimerFired):
(EwkViewImpl::update):
* UIProcess/API/efl/EwkViewImpl.h:
(WebCore):
(EwkViewImpl):
(EwkViewImpl::clearEvasGLSurface):
* UIProcess/API/efl/ewk_view.cpp:
(_ewk_view_smart_calculate):
* UIProcess/efl/PageClientImpl.cpp:
(WebKit::PageClientImpl::setViewNeedsDisplay):
* UIProcess/efl/PageViewportControllerClientEfl.cpp:
(WebKit::PageViewportControllerClientEfl::setVisibleContentsRect):
(WebKit::PageViewportControllerClientEfl::didChangeContentsSize):
(WebKit::PageViewportControllerClientEfl::didChangeVisibleContents):
* UIProcess/efl/PageViewportControllerClientEfl.h:
(PageViewportControllerClientEfl):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (133160 => 133161)


--- trunk/Source/WebKit2/ChangeLog	2012-11-01 14:10:37 UTC (rev 133160)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-01 14:14:06 UTC (rev 133161)
@@ -1,3 +1,36 @@
+2012-11-01  Kenneth Rohde Christiansen  <kenn...@webkit.org>
+
+        [EFL] Correct our use of the coordinated graphics
+        https://bugs.webkit.org/show_bug.cgi?id=100947
+
+        Reviewed by Alexis Menard.
+
+        Replace the display(...) call with a regular update() on the view.
+        In the coordinated graphics case this updates our view using
+        paintToCurrentGLContext with our viewmodel matrix and clips it to
+        the viewport. This avoid the need to manually joining update regions.
+
+        Unneeded update calls have also been removed and the resizing
+        logic has been improved.
+
+        * UIProcess/API/efl/EwkViewImpl.cpp:
+        (EwkViewImpl::displayTimerFired):
+        (EwkViewImpl::update):
+        * UIProcess/API/efl/EwkViewImpl.h:
+        (WebCore):
+        (EwkViewImpl):
+        (EwkViewImpl::clearEvasGLSurface):
+        * UIProcess/API/efl/ewk_view.cpp:
+        (_ewk_view_smart_calculate):
+        * UIProcess/efl/PageClientImpl.cpp:
+        (WebKit::PageClientImpl::setViewNeedsDisplay):
+        * UIProcess/efl/PageViewportControllerClientEfl.cpp:
+        (WebKit::PageViewportControllerClientEfl::setVisibleContentsRect):
+        (WebKit::PageViewportControllerClientEfl::didChangeContentsSize):
+        (WebKit::PageViewportControllerClientEfl::didChangeVisibleContents):
+        * UIProcess/efl/PageViewportControllerClientEfl.h:
+        (PageViewportControllerClientEfl):
+
 2012-11-01  Jocelyn Turcotte  <jocelyn.turco...@digia.com>
 
         [Qt] Double clicks/taps aren't passed down to the page

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp (133160 => 133161)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp	2012-11-01 14:10:37 UTC (rev 133160)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp	2012-11-01 14:14:06 UTC (rev 133161)
@@ -25,6 +25,8 @@
 #include "FindClientEfl.h"
 #include "FormClientEfl.h"
 #include "InputMethodContextEfl.h"
+#include "LayerTreeCoordinatorProxy.h"
+#include "LayerTreeRenderer.h"
 #include "PageClientImpl.h"
 #include "PageLoadClientEfl.h"
 #include "PagePolicyClientEfl.h"
@@ -237,38 +239,47 @@
 
 void EwkViewImpl::displayTimerFired(Timer<EwkViewImpl>*)
 {
+#if USE(COORDINATED_GRAPHICS)
     Ewk_View_Smart_Data* sd = smartData();
 
-    if (!sd->image)
-        return;
+    evas_gl_make_current(evasGL(), evasGLSurface(), evasGLContext());
 
-    ASSERT(m_dirtyRegion);
-    Vector<IntRect> rects = m_dirtyRegion->rects();
-    // Clear region.
-    m_dirtyRegion.clear();
+    // We are supposed to clip to the actual viewport, nothing less.
+    IntRect viewport(sd->view.x, sd->view.y, sd->view.w, sd->view.h);
 
-    Vector<IntRect>::const_iterator end = rects.end();
-    for (Vector<IntRect>::const_iterator it = rects.begin(); it != end; ++it) {
-        const IntRect& rect = *it;
-#if USE(COORDINATED_GRAPHICS)
-        evas_gl_make_current(evasGL(), evasGLSurface(), evasGLContext());
-        m_pageViewportControllerClient->display(rect, IntPoint(sd->view.x, sd->view.y));
+    IntPoint scrollPosition = m_pageViewportControllerClient->scrollPosition();
+    float scaleFactor = m_pageViewportControllerClient->scaleFactor();
+
+    WebCore::TransformationMatrix matrix;
+    matrix.translate(viewport.x(), viewport.y());
+    matrix.scale(scaleFactor);
+    matrix.translate(-scrollPosition.x(), -scrollPosition.y());
+
+    LayerTreeRenderer* renderer = page()->drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer();
+    renderer->setActive(true);
+    renderer->syncRemoteContent();
+
+    renderer->paintToCurrentGLContext(matrix, /* opacity */ 1, viewport);
+
+    evas_object_image_data_update_add(sd->image, viewport.x(), viewport.y(), viewport.width(), viewport.height());
 #endif
-
-        evas_object_image_data_update_add(sd->image, rect.x(), rect.y(), rect.width(), rect.height());
-    }
 }
 
-void EwkViewImpl::redrawRegion(const IntRect& rect)
+void EwkViewImpl::update(const IntRect& rect)
 {
-    if (m_dirtyRegion)
-        m_dirtyRegion->unite(rect);
-    else
-        m_dirtyRegion = adoptPtr(new Region(rect));
-
-    // Update display in the event loop.
+#if USE(COORDINATED_GRAPHICS)
+    // Coordinated graphices needs to schedule an full update, not
+    // repainting of a region. Update in the event loop.
+    UNUSED_PARAM(rect);
     if (!m_displayTimer.isActive())
         m_displayTimer.startOneShot(0);
+#else
+    Ewk_View_Smart_Data* sd = smartData();
+    if (!sd->image)
+        return;
+
+    evas_object_image_data_update_add(sd->image, rect.x(), rect.y(), rect.width(), rect.height());
+#endif
 }
 
 #if ENABLE(FULLSCREEN_API)

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h (133160 => 133161)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h	2012-11-01 14:10:37 UTC (rev 133160)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h	2012-11-01 14:14:06 UTC (rev 133161)
@@ -26,6 +26,7 @@
 #include "WKEinaSharedString.h"
 #include "WKRetainPtr.h"
 #include <Evas.h>
+#include <WebCore/IntRect.h>
 #include <WebCore/TextDirection.h>
 #include <WebCore/Timer.h>
 #include <WebKit2/WKBase.h>
@@ -63,9 +64,7 @@
 namespace WebCore {
 class Color;
 class Cursor;
-class IntRect;
 class IntSize;
-class Region;
 }
 
 class Ewk_Back_Forward_List;
@@ -126,9 +125,10 @@
 #endif
 
     void setCursor(const WebCore::Cursor& cursor);
-    void redrawRegion(const WebCore::IntRect& rect);
     void setImageData(void* imageData, const WebCore::IntSize& size);
 
+    void update(const WebCore::IntRect& rect = WebCore::IntRect());
+
     static void addToPageViewMap(EwkViewImpl* viewImpl);
     static void removeFromPageViewMap(EwkViewImpl* viewImpl);
     static const Evas_Object* viewFromPageViewMap(const WKPageRef);
@@ -181,7 +181,7 @@
     Evas_GL* evasGL() { return m_evasGL.get(); }
     Evas_GL_Context* evasGLContext() { return m_evasGLContext ? m_evasGLContext->context() : 0; }
     Evas_GL_Surface* evasGLSurface() { return m_evasGLSurface ? m_evasGLSurface->surface() : 0; }
-    void resetEvasGLSurface() { m_evasGLSurface.clear(); }
+    void clearEvasGLSurface() { m_evasGLSurface.clear(); }
 #endif
 
     // FIXME: needs refactoring (split callback invoke)
@@ -237,7 +237,6 @@
     bool m_touchEventsEnabled;
 #endif
     WebCore::Timer<EwkViewImpl> m_displayTimer;
-    OwnPtr<WebCore::Region> m_dirtyRegion;
     OwnPtr<Ewk_Popup_Menu> m_popupMenu;
     OwnPtr<WebKit::InputMethodContextEfl> m_inputMethodContext;
     OwnPtr<Ewk_Color_Picker> m_colorPicker;

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (133160 => 133161)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-11-01 14:10:37 UTC (rev 133160)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-11-01 14:14:06 UTC (rev 133161)
@@ -409,45 +409,37 @@
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
     EWK_VIEW_IMPL_GET_BY_SD_OR_RETURN(smartData, impl);
 
-#if USE(ACCELERATED_COMPOSITING)
-    bool needsNewSurface = false;
-#endif
-
     smartData->changed.any = false;
 
     Evas_Coord x, y, width, height;
     evas_object_geometry_get(ewkView, &x, &y, &width, &height);
 
-    if (smartData->changed.size) {
-#if USE(COORDINATED_GRAPHICS)
-        impl->pageViewportControllerClient()->updateViewportSize(IntSize(width, height));
-#endif
-#if USE(ACCELERATED_COMPOSITING)
-        needsNewSurface = impl->evasGLSurface();
-#endif
-
-        if (impl->page()->drawingArea())
-            impl->page()->drawingArea()->setSize(IntSize(width, height), IntSize());
-
-        smartData->view.w = width;
-        smartData->view.h = height;
-        smartData->changed.size = false;
-    }
-
     if (smartData->changed.position) {
-        evas_object_move(smartData->image, x, y);
+        smartData->changed.position = false;
         smartData->view.x = x;
         smartData->view.y = y;
-        smartData->changed.position = false;
+        evas_object_move(smartData->image, x, y);
     }
 
+    if (smartData->changed.size) {
+        smartData->changed.size = false;
+        smartData->view.w = width;
+        smartData->view.h = height;
+
+        if (impl->page()->drawingArea())
+            impl->page()->drawingArea()->setSize(IntSize(width, height), IntSize());
+
 #if USE(ACCELERATED_COMPOSITING)
-    if (needsNewSurface) {
-        impl->resetEvasGLSurface();
-        impl->createGLSurface(IntSize(width, height));
-        impl->redrawRegion(IntRect(IntPoint(), IntSize(width, height)));
-    }
+        // Recreate surface if needed.
+        if (impl->evasGLSurface()) {
+            impl->clearEvasGLSurface();
+            impl->createGLSurface(IntSize(width, height));
+        }
 #endif
+#if USE(COORDINATED_GRAPHICS)
+        impl->pageViewportControllerClient()->updateViewportSize(IntSize(width, height));
+#endif
+    }
 }
 
 static void _ewk_view_smart_show(Evas_Object* ewkView)

Modified: trunk/Source/WebKit2/UIProcess/efl/PageClientImpl.cpp (133160 => 133161)


--- trunk/Source/WebKit2/UIProcess/efl/PageClientImpl.cpp	2012-11-01 14:10:37 UTC (rev 133160)
+++ trunk/Source/WebKit2/UIProcess/efl/PageClientImpl.cpp	2012-11-01 14:14:06 UTC (rev 133161)
@@ -75,7 +75,7 @@
 
 void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect)
 {
-    m_viewImpl->redrawRegion(rect);
+    m_viewImpl->update(rect);
 }
 
 void PageClientImpl::displayView()

Modified: trunk/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp (133160 => 133161)


--- trunk/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp	2012-11-01 14:10:37 UTC (rev 133160)
+++ trunk/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp	2012-11-01 14:14:06 UTC (rev 133161)
@@ -61,19 +61,6 @@
     drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer()->setActive(active);
 }
 
-void PageViewportControllerClientEfl::display(const IntRect& rect, const IntPoint& viewPosition)
-{
-    WebCore::TransformationMatrix matrix;
-    matrix.setMatrix(m_scaleFactor, 0, 0, m_scaleFactor, -m_scrollPosition.x() * m_scaleFactor + viewPosition.x() , -m_scrollPosition.y() * m_scaleFactor + viewPosition.y());
-
-    LayerTreeRenderer* renderer = drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer();
-    renderer->setActive(true);
-    renderer->syncRemoteContent();
-    IntRect clipRect(rect);
-    clipRect.move(viewPosition.x(), viewPosition.y());
-    renderer->paintToCurrentGLContext(matrix, 1, clipRect);
-}
-
 void PageViewportControllerClientEfl::updateViewportSize(const IntSize& viewportSize)
 {
     m_viewportSize = viewportSize;
@@ -83,20 +70,18 @@
     m_controller->didChangeViewportSize(viewportSize);
 }
 
-void PageViewportControllerClientEfl::setVisibleContentsRect(const IntPoint& newScrollPosition, float newScale, const FloatPoint& /*trajectory*/)
+void PageViewportControllerClientEfl::setVisibleContentsRect(const IntPoint& newScrollPosition, float newScale, const FloatPoint& trajectory)
 {
     m_scaleFactor = newScale;
     m_scrollPosition = newScrollPosition;
 
     ASSERT(m_controller);
-    m_controller->didChangeContentsVisibility(m_scrollPosition, m_scaleFactor, FloatPoint());
+    m_controller->didChangeContentsVisibility(m_scrollPosition, m_scaleFactor, trajectory);
 }
 
 void PageViewportControllerClientEfl::didChangeContentsSize(const WebCore::IntSize& size)
 {
-    m_contentsSize = size;
-    IntRect rect = IntRect(IntPoint(), m_viewportSize);
-    m_viewImpl->redrawRegion(rect);
+    m_viewImpl->update();
 }
 
 void PageViewportControllerClientEfl::setViewportPosition(const WebCore::FloatPoint& contentsPoint)
@@ -119,8 +104,7 @@
 
 void PageViewportControllerClientEfl::didChangeVisibleContents()
 {
-    IntRect rect = IntRect(IntPoint(), m_viewportSize);
-    m_viewImpl->redrawRegion(rect);
+    m_viewImpl->update();
 }
 
 void PageViewportControllerClientEfl::didChangeViewportAttributes()

Modified: trunk/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.h (133160 => 133161)


--- trunk/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.h	2012-11-01 14:10:37 UTC (rev 133160)
+++ trunk/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.h	2012-11-01 14:14:06 UTC (rev 133161)
@@ -49,7 +49,6 @@
     float scaleFactor() const { return m_scaleFactor; }
     WebCore::IntPoint scrollPosition() { return m_scrollPosition; }
 
-    void display(const WebCore::IntRect&, const WebCore::IntPoint& viewPosition);
     void updateViewportSize(const WebCore::IntSize& viewportSize);
     void setVisibleContentsRect(const WebCore::IntPoint&, float, const WebCore::FloatPoint&);
     void setRendererActive(bool);
@@ -68,7 +67,6 @@
     explicit PageViewportControllerClientEfl(EwkViewImpl*);
 
     EwkViewImpl* m_viewImpl;
-    WebCore::IntSize m_contentsSize;
     WebCore::IntSize m_viewportSize;
     WebCore::IntPoint m_scrollPosition;
     float m_scaleFactor;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to