Changeset 249366 in webkit


Ignore:
Timestamp:
Sep 1, 2019 11:13:03 AM (5 years ago)
Author:
Brent Fulgham
Message:

[WinCairo, FTW] Properly handle device scale factor
https://bugs.webkit.org/show_bug.cgi?id=201361

Reviewed by Don Olmstead.

Source/WebCore:

Update the Direct2D ImageBuffer/ImageBufferData classes to correctly handle
the device scale factor.

  • platform/graphics/win/ImageBufferDataDirect2D.cpp:

(WebCore::ImageBufferData::putData):

  • platform/graphics/win/ImageBufferDirect2D.cpp:

(WebCore::ImageBuffer::putByteArray):

Source/WebKit:

Update the WebView and WebProcess to correctly handle
the device scale factor.

  • UIProcess/win/WebView.cpp:

(WebKit::WebView::WebView): Tell the page the current device scale factor.

  • WebProcess/win/WebProcessMainWin.cpp:

(WebKit::WebProcessMainWin): Tell the process to be aware of device scale.

Tools:

Reset zoom to 1.0; device scale is handled elsewhere.

  • MiniBrowser/win/WebKitBrowserWindow.cpp:

(WebKitBrowserWindow::resetZoom):

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r249364 r249366  
     12019-08-30  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [WinCairo, FTW] Properly handle device scale factor
     4        https://bugs.webkit.org/show_bug.cgi?id=201361
     5
     6        Reviewed by Don Olmstead.
     7
     8        Update the Direct2D ImageBuffer/ImageBufferData classes to correctly handle
     9        the device scale factor.
     10
     11        * platform/graphics/win/ImageBufferDataDirect2D.cpp:
     12        (WebCore::ImageBufferData::putData):
     13        * platform/graphics/win/ImageBufferDirect2D.cpp:
     14        (WebCore::ImageBuffer::putByteArray):
     15
    1162019-08-31  Said Abou-Hallawa  <sabouhallawa@apple.com>
    217
  • trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp

    r249110 r249366  
    173173    Checked<int> originx = sourceRect.x();
    174174    Checked<int> destx = (Checked<int>(destPoint.x()) + sourceRect.x());
    175     destx *= resolutionScale;
    176175    ASSERT(destx.unsafeGet() >= 0);
    177176    ASSERT(destx.unsafeGet() < size.width());
     
    180179
    181180    Checked<int> endx = (Checked<int>(destPoint.x()) + sourceRect.maxX());
    182     endx *= resolutionScale;
    183181    ASSERT(endx.unsafeGet() <= size.width());
    184182
     
    188186    Checked<int> originy = sourceRect.y();
    189187    Checked<int> desty = (Checked<int>(destPoint.y()) + sourceRect.y());
    190     desty *= resolutionScale;
    191188    ASSERT(desty.unsafeGet() >= 0);
    192189    ASSERT(desty.unsafeGet() < size.height());
     
    195192
    196193    Checked<int> endy = (Checked<int>(destPoint.y()) + sourceRect.maxY());
    197     endy *= resolutionScale;
    198194    ASSERT(endy.unsafeGet() <= size.height());
    199195
  • trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.h

    r249110 r249366  
    5151
    5252    RefPtr<Uint8ClampedArray> getData(AlphaPremultiplication, const IntRect&, const IntSize&, bool accelerateRendering, float resolutionScale) const;
    53     void putData(const Uint8ClampedArray& source, AlphaPremultiplication sourceFormat, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, const IntSize&, bool accelerateRendering, float resolutionScale);
     53    void putData(const Uint8ClampedArray& source, AlphaPremultiplication sourceFormat, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, const IntSize&, bool accelerateRendering, float resolutionScale = 1.0f);
    5454
    5555    COMPtr<ID2D1Bitmap> compatibleBitmap(ID2D1RenderTarget*);
  • trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp

    r249335 r249366  
    325325    IntRect scaledSourceRect = sourceRect;
    326326    IntSize scaledSourceSize = sourceSize;
     327    IntPoint scaledDestPoint = destPoint;
     328
    327329    if (coordinateSystem == LogicalCoordinateSystem) {
    328330        scaledSourceRect.scale(m_resolutionScale);
    329331        scaledSourceSize.scale(m_resolutionScale);
    330     }
    331 
    332     m_data.putData(source, bufferFormat, scaledSourceSize, scaledSourceRect, destPoint, internalSize(), context().isAcceleratedContext(), 1);
     332        scaledDestPoint.scale(m_resolutionScale);
     333    }
     334
     335    m_data.putData(source, bufferFormat, scaledSourceSize, scaledSourceRect, scaledDestPoint, internalSize(), context().isAcceleratedContext());
    333336}
    334337
  • trunk/Source/WebKit/ChangeLog

    r249359 r249366  
     12019-08-30  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [WinCairo, FTW] Properly handle device scale factor
     4        https://bugs.webkit.org/show_bug.cgi?id=201361
     5
     6        Reviewed by Don Olmstead.
     7
     8        Update the WebView and WebProcess to correctly handle
     9        the device scale factor.
     10
     11        * UIProcess/win/WebView.cpp:
     12        (WebKit::WebView::WebView): Tell the page the current device scale factor.
     13        * WebProcess/win/WebProcessMainWin.cpp:
     14        (WebKit::WebProcessMainWin): Tell the process to be aware of device scale.
     15
    1162019-08-31  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/Source/WebKit/UIProcess/win/WebView.cpp

    r249335 r249366  
    4646#include <WebCore/Editor.h>
    4747#include <WebCore/FloatRect.h>
     48#include <WebCore/GDIUtilities.h>
    4849#include <WebCore/HWndDC.h>
    4950#include <WebCore/IntRect.h>
     
    247248    WebProcessPool* processPool = pageConfiguration->processPool();
    248249    m_page = processPool->createWebPage(*m_pageClient, WTFMove(pageConfiguration));
     250    m_page->setIntrinsicDeviceScaleFactor(WebCore::deviceScaleFactorForWindow(parentWindow));
    249251    m_page->initializeWebPage();
    250252
  • trunk/Source/WebKit/WebProcess/win/WebProcessMainWin.cpp

    r248444 r249366  
    4747    HRESULT hr = ::CoInitializeEx(nullptr, COINIT_MULTITHREADED);
    4848    RELEASE_ASSERT(SUCCEEDED(hr));
     49
     50    ::SetProcessDPIAware();
     51
    4952    return AuxiliaryProcessMain<WebProcess, WebProcessMain>(argc, argv);
    5053}
  • trunk/Tools/ChangeLog

    r249358 r249366  
     12019-08-30  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [WinCairo, FTW] Properly handle device scale factor
     4        https://bugs.webkit.org/show_bug.cgi?id=201361
     5
     6        Reviewed by Don Olmstead.
     7
     8        Reset zoom to 1.0; device scale is handled elsewhere.
     9
     10        * MiniBrowser/win/WebKitBrowserWindow.cpp:
     11        (WebKitBrowserWindow::resetZoom):
     12
    1132019-08-30  Zhifei Fang  <zhifei_fang@apple.com>
    214
  • trunk/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp

    r249245 r249366  
    282282{
    283283    auto page = WKViewGetPage(m_view.get());
    284     WKPageSetPageZoomFactor(page, WebCore::deviceScaleFactorForWindow(hwnd()));
     284    WKPageSetPageZoomFactor(page, 1.0);
    285285}
    286286
Note: See TracChangeset for help on using the changeset viewer.