Changeset 188537 in webkit


Ignore:
Timestamp:
Aug 17, 2015 1:22:35 PM (9 years ago)
Author:
peavo@outlook.com
Message:

[WinCairo] Accelerated compositing does not respect device scale factor.
https://bugs.webkit.org/show_bug.cgi?id=148085

Reviewed by Brent Fulgham.

Scale root layer's transformation matrix with device scale factor.

  • WebCoreSupport/AcceleratedCompositingContext.cpp:

(AcceleratedCompositingContext::initialize):
(AcceleratedCompositingContext::startedAnimation):
(AcceleratedCompositingContext::applyDeviceScaleFactor):
(AcceleratedCompositingContext::compositeLayersToContext):
(AcceleratedCompositingContext::resizeRootLayer):
(AcceleratedCompositingContext::flushAndRenderLayers):
(AcceleratedCompositingContext::paintContents):
(AcceleratedCompositingContext::deviceScaleFactor):

  • WebCoreSupport/AcceleratedCompositingContext.h:
  • WebView.cpp:

(WebView::repaint):

Location:
trunk/Source/WebKit/win
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/win/ChangeLog

    r188525 r188537  
     12015-08-17  Per Arne Vollan  <peavo@outlook.com>
     2
     3        [WinCairo] Accelerated compositing does not respect device scale factor.
     4        https://bugs.webkit.org/show_bug.cgi?id=148085
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Scale root layer's transformation matrix with device scale factor.
     9
     10        * WebCoreSupport/AcceleratedCompositingContext.cpp:
     11        (AcceleratedCompositingContext::initialize):
     12        (AcceleratedCompositingContext::startedAnimation):
     13        (AcceleratedCompositingContext::applyDeviceScaleFactor):
     14        (AcceleratedCompositingContext::compositeLayersToContext):
     15        (AcceleratedCompositingContext::resizeRootLayer):
     16        (AcceleratedCompositingContext::flushAndRenderLayers):
     17        (AcceleratedCompositingContext::paintContents):
     18        (AcceleratedCompositingContext::deviceScaleFactor):
     19        * WebCoreSupport/AcceleratedCompositingContext.h:
     20        * WebView.cpp:
     21        (WebView::repaint):
     22
    1232015-08-17  Sungmann Cho  <sungmann.cho@navercorp.com>
    224
  • trunk/Source/WebKit/win/WebCoreSupport/AcceleratedCompositingContext.cpp

    r187109 r188537  
    8383    m_rootLayer->setSize(pageSize);
    8484
     85    applyDeviceScaleFactor();
     86
    8587    // The non-composited contents are a child of the root layer.
    8688    m_nonCompositedContentLayer = GraphicsLayer::create(nullptr, *this);
     
    151153}
    152154
     155void AcceleratedCompositingContext::applyDeviceScaleFactor()
     156{
     157    if (!m_rootLayer)
     158        return;
     159
     160    const FloatSize& size = m_rootLayer->size();
     161
     162    TransformationMatrix m;
     163    m.scale(deviceScaleFactor());
     164    // Center view
     165    double tx = (size.width() - size.width() / deviceScaleFactor()) / 2.0;
     166    double ty = (size.height() - size.height() / deviceScaleFactor()) / 2.0;
     167    m.translate(tx, ty);
     168    m_rootLayer->setTransform(m);
     169}
     170
    153171void AcceleratedCompositingContext::compositeLayersToContext(CompositePurpose purpose)
    154172{
     
    222240
    223241    m_rootLayer->setSize(newSize);
     242
     243    applyDeviceScaleFactor();
    224244
    225245    // If the newSize exposes new areas of the non-composited content a setNeedsDisplay is needed
     
    359379    if (!frame.contentRenderer() || !frame.view())
    360380        return;
     381
    361382    frame.view()->updateLayoutAndStyleIfNeededRecursive();
    362383
     
    390411}
    391412
     413float AcceleratedCompositingContext::deviceScaleFactor() const
     414{
     415    return m_webView.deviceScaleFactor();
     416}
     417
    392418#endif // USE(TEXTURE_MAPPER_GL)
  • trunk/Source/WebKit/win/WebCoreSupport/AcceleratedCompositingContext.h

    r183234 r188537  
    5353
    5454    // GraphicsLayerClient
    55     virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::FloatRect& rectToPaint);
     55    void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::FloatRect& rectToPaint) override;
     56    float deviceScaleFactor() const override;
    5657
    5758    void initialize();
     
    9697    bool prepareForRendering();
    9798    bool startedAnimation(WebCore::GraphicsLayer*);
     99    void applyDeviceScaleFactor();
    98100};
    99101
  • trunk/Source/WebKit/win/WebView.cpp

    r188215 r188537  
    839839        // The contentChanged, immediate, and repaintContentOnly parameters are all based on a non-
    840840        // compositing painting/scrolling model.
    841         addToDirtyRegion(windowRect);
     841        addToDirtyRegion(logicalWindowRect);
    842842        return;
    843843    }
Note: See TracChangeset for help on using the changeset viewer.