Title: [193844] trunk/Source/WebKit2
Revision
193844
Author
y...@igalia.com
Date
2015-12-09 10:52:16 -0800 (Wed, 09 Dec 2015)

Log Message

[ThreadedCompositor] Add support for HiDPI
https://bugs.webkit.org/show_bug.cgi?id=152071

Reviewed by Carlos Garcia Campos.

* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::setDeviceScaleFactor): Added to receive the
device scale factor from the layer tree host.
(WebKit::ThreadedCompositor::renderLayerTree):
Apply device scale factor before rendering the page.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
(WebKit::ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged):
Send a updated device scale factor to the compositing thread.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (193843 => 193844)


--- trunk/Source/WebKit2/ChangeLog	2015-12-09 18:32:22 UTC (rev 193843)
+++ trunk/Source/WebKit2/ChangeLog	2015-12-09 18:52:16 UTC (rev 193844)
@@ -1,3 +1,20 @@
+2015-12-09  Gwang Yoon Hwang  <y...@igalia.com>
+
+        [ThreadedCompositor] Add support for HiDPI
+        https://bugs.webkit.org/show_bug.cgi?id=152071
+
+        Reviewed by Carlos Garcia Campos.
+
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
+        (WebKit::ThreadedCompositor::setDeviceScaleFactor): Added to receive the
+        device scale factor from the layer tree host.
+        (WebKit::ThreadedCompositor::renderLayerTree):
+        Apply device scale factor before rendering the page.
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
+        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
+        (WebKit::ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged):
+        Send a updated device scale factor to the compositing thread.
+
 2015-12-09  Ryuan Choi  <ryuan.c...@navercorp.com>
 
         [CoordinatedGraphics] Remove unnecessary guards in CoordinatedDrawingArea

Modified: trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp (193843 => 193844)


--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2015-12-09 18:32:22 UTC (rev 193843)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2015-12-09 18:52:16 UTC (rev 193844)
@@ -116,6 +116,7 @@
 
 ThreadedCompositor::ThreadedCompositor(Client* client)
     : m_client(client)
+    , m_deviceScaleFactor(1)
     , m_threadIdentifier(0)
 {
     createCompositingThread();
@@ -143,6 +144,14 @@
     });
 }
 
+void ThreadedCompositor::setDeviceScaleFactor(float scale)
+{
+    RefPtr<ThreadedCompositor> protector(this);
+    callOnCompositingThread([=] {
+        protector->m_deviceScaleFactor = scale;
+        protector->scheduleDisplayImmediately();
+    });
+}
 
 void ThreadedCompositor::didChangeViewportSize(const IntSize& newSize)
 {
@@ -262,7 +271,7 @@
 
     TransformationMatrix viewportTransform;
     FloatPoint scrollPostion = viewportController()->visibleContentsRect().location();
-    viewportTransform.scale(viewportController()->pageScaleFactor());
+    viewportTransform.scale(viewportController()->pageScaleFactor() * m_deviceScaleFactor);
     viewportTransform.translate(-scrollPostion.x(), -scrollPostion.y());
 
     m_scene->paintToCurrentGLContext(viewportTransform, 1, clipRect, Color::white, false, scrollPostion);

Modified: trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h (193843 => 193844)


--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h	2015-12-09 18:32:22 UTC (rev 193843)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h	2015-12-09 18:52:16 UTC (rev 193844)
@@ -67,6 +67,7 @@
     void setNeedsDisplay();
 
     void setNativeSurfaceHandleForCompositing(uint64_t);
+    void setDeviceScaleFactor(float);
 
     void updateSceneState(const WebCore::CoordinatedGraphicsState&);
 
@@ -106,6 +107,7 @@
     std::unique_ptr<WebCore::GLContext> m_context;
 
     WebCore::IntSize m_viewportSize;
+    float m_deviceScaleFactor;
     uint64_t m_nativeSurfaceHandle;
 
     std::unique_ptr<CompositingRunLoop> m_compositingRunLoop;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp (193843 => 193844)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp	2015-12-09 18:32:22 UTC (rev 193843)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp	2015-12-09 18:52:16 UTC (rev 193844)
@@ -152,6 +152,7 @@
 void ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged()
 {
     m_coordinator->deviceOrPageScaleFactorChanged();
+    m_compositor->setDeviceScaleFactor(m_webPage->deviceScaleFactor());
 }
 
 void ThreadedCoordinatedLayerTreeHost::pauseRendering()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to