[GTK] Support HiDPI Properly in WebKitGtk+ with the TextureMapper
authoryoon@igalia.com <yoon@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Sep 2015 09:55:59 +0000 (09:55 +0000)
committeryoon@igalia.com <yoon@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Sep 2015 09:55:59 +0000 (09:55 +0000)
commit499cf55c07994ae206e74f6bc7a108833ef5e769
tree4203971feae1af16a2b6de102e612b20f2ea62f6
parentf9a61f891ccf83cc5e4584c18118f39e6d4b519e
[GTK] Support HiDPI Properly in WebKitGtk+ with the TextureMapper
https://bugs.webkit.org/show_bug.cgi?id=141782

Reviewed by Carlos Garcia Campos.

Source/WebCore:

This patch fixes HiDPI issue in the TextureMapper.
To support HiDPI in the TextureMapper, we need to draw scaled contents
in the TextureMapperTile, and apply the global scale in the root layer
to apply transforms correctly.

Supporting the device scale is handled at LayerTreeHostGtk and
TextureMapperBackingStore, and GraphicsLayerTextureMapper doesn't handle
the device scale directly.

From the TextureMapperLayer, deviceScale and pageScale do not have to be
handled differently. These are multiplied and provided to
TextureMapperBackingStore.

* platform/graphics/texmap/TextureMapperTile.cpp:
(WebCore::TextureMapperTile::updateContents):
* platform/graphics/texmap/TextureMapperTile.h:
* platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:

    Modified to increase the cover rect for tiles creation. For the image
    contents, it just creates texture with a image size, regardless of the
    contents scale.

* platform/graphics/texmap/BitmapTexture.cpp:
(WebCore::BitmapTexture::updateContents):

    Apply the device scale to the graphics context before painting contents.

* platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
(WebCore::GraphicsLayerTextureMapper::setContentsToImage):
(WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):

    Apply the device scale and the page scale to the backing store

Source/WebKit2:

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
* UIProcess/gtk/RedirectedXCompositeWindow.cpp:

    Modified to create scaled size of window.

* WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
(WebKit::LayerTreeHostGtk::initialize):
(WebKit::LayerTreeHostGtk::deviceOrPageScaleFactorChanged):

    We should apply device scale factor to the root layer to apply
    the scale matrix before applying other transform matrices.

(WebKit::LayerTreeHostGtk::deviceScaleFactor): Added.
(WebKit::LayerTreeHostGtk::pageScaleFactor): Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190344 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp
Source/WebCore/platform/graphics/texmap/BitmapTexture.h
Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperTile.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperTile.h
Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.cpp
Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.h
Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp
Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h