Changeset 252962 in webkit


Ignore:
Timestamp:
Nov 30, 2019 5:06:49 PM (4 years ago)
Author:
timothy_horton@apple.com
Message:

Reimplement some PlatformCALayer methods using GraphicsContext instead of CGContextRef
https://bugs.webkit.org/show_bug.cgi?id=204698

Reviewed by Sam Weinig.

Source/WebCore:

In order to make PlatformCALayer-level DisplayList recording possible,
reimplement a few methods in terms of WebCore::GraphicsContext instead
of CGContextRef directly. Namely, collectRectsToPaint, drawLayerContents,
and drawRepaintIndicator.

In the drawLayerContents case, there are operations (like setting the
AppKit global graphics context) that cannot be done without a platform
context. In those cases, we skip that operation if we don't have a
platform context.

Anything depending on this downstream will break and need to be
implemented a different way in the DisplayList case.

  • platform/graphics/GraphicsContext.h:
  • platform/graphics/ca/PlatformCALayer.cpp:

(WebCore::PlatformCALayer::drawRepaintIndicator):

  • platform/graphics/ca/PlatformCALayer.h:
  • platform/graphics/ca/TileGrid.cpp:

(WebCore::TileGrid::platformCALayerPaintContents):

  • platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
  • platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:

(WebCore::PlatformCALayer::collectRectsToPaint):
(WebCore::PlatformCALayer::drawLayerContents):
(WebCore::PlatformCALayerCocoa::enumerateRectsBeingDrawn):

  • platform/graphics/ca/win/PlatformCALayerWin.cpp:

(PlatformCALayer::collectRectsToPaint):

  • platform/graphics/mac/WebLayer.mm:

(-[WebLayer drawInContext:]):

Source/WebKit:

  • Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
  • Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:

(WebKit::RemoteLayerBackingStore::drawInContext):
(WebKit::RemoteLayerBackingStore::enumerateRectsBeingDrawn):

  • WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:

(WebKit::PlatformCALayerRemote::enumerateRectsBeingDrawn):

  • WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
Location:
trunk/Source
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r252961 r252962  
     12019-11-30  Tim Horton  <timothy_horton@apple.com>
     2
     3        Reimplement some PlatformCALayer methods using GraphicsContext instead of CGContextRef
     4        https://bugs.webkit.org/show_bug.cgi?id=204698
     5
     6        Reviewed by Sam Weinig.
     7
     8        In order to make PlatformCALayer-level DisplayList recording possible,
     9        reimplement a few methods in terms of WebCore::GraphicsContext instead
     10        of CGContextRef directly. Namely, collectRectsToPaint, drawLayerContents,
     11        and drawRepaintIndicator.
     12
     13        In the drawLayerContents case, there are operations (like setting the
     14        AppKit global graphics context) that cannot be done without a platform
     15        context. In those cases, we skip that operation if we don't have a
     16        platform context.
     17
     18        Anything depending on this downstream will break and need to be
     19        implemented a different way in the DisplayList case.
     20
     21        * platform/graphics/GraphicsContext.h:
     22        * platform/graphics/ca/PlatformCALayer.cpp:
     23        (WebCore::PlatformCALayer::drawRepaintIndicator):
     24        * platform/graphics/ca/PlatformCALayer.h:
     25        * platform/graphics/ca/TileGrid.cpp:
     26        (WebCore::TileGrid::platformCALayerPaintContents):
     27        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
     28        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
     29        (WebCore::PlatformCALayer::collectRectsToPaint):
     30        (WebCore::PlatformCALayer::drawLayerContents):
     31        (WebCore::PlatformCALayerCocoa::enumerateRectsBeingDrawn):
     32        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
     33        (PlatformCALayer::collectRectsToPaint):
     34        * platform/graphics/mac/WebLayer.mm:
     35        (-[WebLayer drawInContext:]):
     36
    1372019-11-30  youenn fablet  <youenn@apple.com>
    238
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.h

    r251796 r252962  
    479479
    480480    enum IncludeDeviceScale { DefinitelyIncludeDeviceScale, PossiblyIncludeDeviceScale };
    481     AffineTransform getCTM(IncludeDeviceScale includeScale = PossiblyIncludeDeviceScale) const;
     481    WEBCORE_EXPORT AffineTransform getCTM(IncludeDeviceScale includeScale = PossiblyIncludeDeviceScale) const;
    482482
    483483    // This function applies the device scale factor to the context, making the context capable of
  • trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp

    r251123 r252962  
    8080}
    8181
    82 void PlatformCALayer::drawRepaintIndicator(CGContextRef context, PlatformCALayer* platformCALayer, int repaintCount, CGColorRef customBackgroundColor)
    83 {
    84     char text[16]; // that's a lot of repaints
    85     snprintf(text, sizeof(text), "%d", repaintCount);
    86    
    87     FloatRect indicatorBox = platformCALayer->bounds();\
    88     indicatorBox.setLocation( { 1, 1 } );
    89     indicatorBox.setSize(FloatSize(12 + 10 * strlen(text), 27));
    90 
    91     CGContextStateSaver stateSaver(context);
    92    
    93     CGContextSetAlpha(context, 0.5f);
    94     CGContextBeginTransparencyLayerWithRect(context, indicatorBox, 0);
    95    
    96     if (customBackgroundColor)
    97         CGContextSetFillColorWithColor(context, customBackgroundColor);
    98     else
    99         CGContextSetRGBFillColor(context, 0, 0.5f, 0.25f, 1);
    100    
     82void PlatformCALayer::drawRepaintIndicator(GraphicsContext& graphicsContext, PlatformCALayer* platformCALayer, int repaintCount, Color customBackgroundColor)
     83{
     84    const float verticalMargin = 2.5;
     85    const float horizontalMargin = 5;
     86    const unsigned fontSize = 22;
     87    const Color backgroundColor(0.5f, 0.25f, 1.0f, 1.0f);
     88    const Color acceleratedContextLabelColor(1.0f, 0.f, 0.f, 1.0f);
     89    const Color unacceleratedContextLabelColor(1.0f, 1.0f, 1.0f, 1.0f);
     90    const Color linearGlyphMaskOutlineColor(0.f, 0.f, 0.f, 0.75f);
     91    const Color displayListBorderColor(0.f, 0.f, 0.f, 0.65f);
     92
     93    TextRun textRun(String::number(repaintCount));
     94
     95    FontCascadeDescription fontDescription;
     96    fontDescription.setOneFamily("Helvetica");
     97    fontDescription.setSpecifiedSize(fontSize);
     98    fontDescription.setComputedSize(fontSize);
     99
     100    FontCascade cascade(WTFMove(fontDescription));
     101    cascade.update(nullptr);
     102
     103    float textWidth = cascade.width(textRun);
     104
     105    GraphicsContextStateSaver stateSaver(graphicsContext);
     106
     107    graphicsContext.beginTransparencyLayer(0.5f);
     108
     109    graphicsContext.setFillColor(customBackgroundColor.isValid() ? customBackgroundColor : backgroundColor);
     110    FloatRect indicatorBox(1, 1, horizontalMargin * 2 + textWidth, verticalMargin * 2 + fontSize);
    101111    if (platformCALayer->isOpaque())
    102         CGContextFillRect(context, indicatorBox);
     112        graphicsContext.fillRect(indicatorBox);
    103113    else {
    104114        Path boundsPath;
     
    112122        boundsPath.closeSubpath();
    113123
    114         CGContextAddPath(context, boundsPath.platformPath());
    115         CGContextFillPath(context);
     124        graphicsContext.fillPath(boundsPath);
    116125    }
    117126
    118127    if (platformCALayer->owner()->isUsingDisplayListDrawing(platformCALayer)) {
    119         CGContextSetRGBStrokeColor(context, 0, 0, 0, 0.65);
    120         CGContextSetLineWidth(context, 2);
    121         CGContextStrokeRect(context, indicatorBox);
    122     }
    123 
    124     CGFloat strokeWidthAsPercentageOfFontSize = 0;
    125     Color strokeColor;
     128        graphicsContext.setStrokeColor(displayListBorderColor);
     129        graphicsContext.strokeRect(indicatorBox, 2);
     130    }
    126131
    127132    if (!platformCALayer->isOpaque() && platformCALayer->supportsSubpixelAntialiasedText() && platformCALayer->acceleratesDrawing()) {
    128         strokeColor = Color(0, 0, 0, 200);
    129         strokeWidthAsPercentageOfFontSize = -4.5; // Negative means "stroke and fill"; see docs for kCTStrokeWidthAttributeName.
    130     }
    131 
    132     if (platformCALayer->acceleratesDrawing())
    133         CGContextSetRGBFillColor(context, 1, 0, 0, 1);
    134     else
    135         CGContextSetRGBFillColor(context, 1, 1, 1, 1);
    136    
    137     platformCALayer->drawTextAtPoint(context, indicatorBox.x() + 5, indicatorBox.y() + 22, CGSizeMake(1, -1), 22, text, strlen(text), strokeWidthAsPercentageOfFontSize, strokeColor);
    138    
    139     CGContextEndTransparencyLayer(context);
     133        graphicsContext.setStrokeColor(linearGlyphMaskOutlineColor);
     134        graphicsContext.setStrokeThickness(4.5);
     135        graphicsContext.setTextDrawingMode(TextModeFill | TextModeStroke);
     136    }
     137
     138    graphicsContext.setFillColor(platformCALayer->acceleratesDrawing() ? acceleratedContextLabelColor : unacceleratedContextLabelColor);
     139
     140    graphicsContext.drawText(cascade, textRun, FloatPoint(indicatorBox.x() + horizontalMargin, indicatorBox.y() + fontSize));
     141    graphicsContext.endTransparencyLayer();
    140142}
    141143
  • trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h

    r251123 r252962  
    269269
    270270#if PLATFORM(COCOA)
    271     virtual void enumerateRectsBeingDrawn(CGContextRef, void (^block)(CGRect)) = 0;
     271    virtual void enumerateRectsBeingDrawn(GraphicsContext&, void (^block)(FloatRect)) = 0;
    272272#endif
    273273
     
    282282       
    283283    // Functions allows us to share implementation across WebTiledLayer and WebLayer
    284     static RepaintRectList collectRectsToPaint(CGContextRef, PlatformCALayer*);
    285     static void drawLayerContents(CGContextRef, PlatformCALayer*, RepaintRectList& dirtyRects, GraphicsLayerPaintBehavior);
    286     static void drawRepaintIndicator(CGContextRef, PlatformCALayer*, int repaintCount, CGColorRef customBackgroundColor);
     284    static RepaintRectList collectRectsToPaint(GraphicsContext&, PlatformCALayer*);
     285    static void drawLayerContents(GraphicsContext&, PlatformCALayer*, RepaintRectList&, GraphicsLayerPaintBehavior);
     286    static void drawRepaintIndicator(GraphicsContext&, PlatformCALayer*, int repaintCount, Color customBackgroundColor = { });
    287287    static CGRect frameForLayer(const PlatformLayer*);
    288288
  • trunk/Source/WebCore/platform/graphics/ca/TileGrid.cpp

    r248514 r252962  
    730730        context.scale(m_scale);
    731731
    732         PlatformCALayer::RepaintRectList dirtyRects = PlatformCALayer::collectRectsToPaint(context.platformContext(), platformCALayer);
    733         PlatformCALayer::drawLayerContents(context.platformContext(), &m_controller.rootLayer(), dirtyRects, layerPaintBehavior);
     732        PlatformCALayer::RepaintRectList dirtyRects = PlatformCALayer::collectRectsToPaint(context, platformCALayer);
     733        PlatformCALayer::drawLayerContents(context, &m_controller.rootLayer(), dirtyRects, layerPaintBehavior);
    734734    }
    735735
    736736    int repaintCount = platformCALayerIncrementRepaintCount(platformCALayer);
    737737    if (m_controller.rootLayer().owner()->platformCALayerShowRepaintCounter(0))
    738         PlatformCALayer::drawRepaintIndicator(context.platformContext(), platformCALayer, repaintCount, cachedCGColor(m_controller.tileDebugBorderColor()));
     738        PlatformCALayer::drawRepaintIndicator(context, platformCALayer, repaintCount, m_controller.tileDebugBorderColor());
    739739
    740740    if (m_controller.scrollingPerformanceLoggingEnabled()) {
  • trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h

    r252346 r252962  
    179179    Ref<PlatformCALayer> createCompatibleLayer(PlatformCALayer::LayerType, PlatformCALayerClient*) const override;
    180180
    181     void enumerateRectsBeingDrawn(CGContextRef, void (^block)(CGRect)) override;
     181    void enumerateRectsBeingDrawn(GraphicsContext&, void (^block)(FloatRect)) override;
    182182
    183183    unsigned backingStoreBytesPerPixel() const override;
  • trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm

    r252346 r252962  
    11201120#endif // PLATFORM(IOS_FAMILY)
    11211121
    1122 PlatformCALayer::RepaintRectList PlatformCALayer::collectRectsToPaint(CGContextRef context, PlatformCALayer* platformCALayer)
     1122PlatformCALayer::RepaintRectList PlatformCALayer::collectRectsToPaint(GraphicsContext& context, PlatformCALayer* platformCALayer)
    11231123{
    11241124    __block double totalRectArea = 0;
     
    11261126    __block RepaintRectList dirtyRects;
    11271127   
    1128     platformCALayer->enumerateRectsBeingDrawn(context, ^(CGRect rect) {
     1128    platformCALayer->enumerateRectsBeingDrawn(context, ^(FloatRect rect) {
    11291129        if (++rectCount > webLayerMaxRectsToPaint)
    11301130            return;
    11311131       
    1132         totalRectArea += rect.size.width * rect.size.height;
     1132        totalRectArea += rect.area();
    11331133        dirtyRects.append(rect);
    11341134    });
    11351135   
    1136     FloatRect clipBounds = CGContextGetClipBoundingBox(context);
     1136    FloatRect clipBounds = context.clipBounds();
    11371137    double clipArea = clipBounds.width() * clipBounds.height();
    11381138   
     
    11451145}
    11461146
    1147 void PlatformCALayer::drawLayerContents(CGContextRef context, WebCore::PlatformCALayer* platformCALayer, RepaintRectList& dirtyRects, GraphicsLayerPaintBehavior layerPaintBehavior)
     1147void PlatformCALayer::drawLayerContents(GraphicsContext& graphicsContext, WebCore::PlatformCALayer* platformCALayer, RepaintRectList& dirtyRects, GraphicsLayerPaintBehavior layerPaintBehavior)
    11481148{
    11491149    WebCore::PlatformCALayerClient* layerContents = platformCALayer->owner();
     
    11541154        layerPaintBehavior |= GraphicsLayerPaintFirstTilePaint;
    11551155
    1156 #if PLATFORM(IOS_FAMILY)
    1157     WKSetCurrentGraphicsContext(context);
    1158 #endif
    1159    
    1160     CGContextSaveGState(context);
    1161    
     1156    GraphicsContextStateSaver saver(graphicsContext);
     1157
    11621158    // We never use CompositingCoordinatesOrientation::BottomUp on Mac.
    11631159    ASSERT(layerContents->platformCALayerContentsOrientation() == GraphicsLayer::CompositingCoordinatesOrientation::TopDown);
    1164    
     1160
    11651161#if PLATFORM(IOS_FAMILY)
    1166     FontAntialiasingStateSaver fontAntialiasingState(context, [platformCALayer->platformLayer() isOpaque]);
    1167     fontAntialiasingState.setup([WAKWindow hasLandscapeOrientation]);
     1162    WTF::Optional<FontAntialiasingStateSaver> fontAntialiasingState;
     1163#endif
     1164    if (graphicsContext.hasPlatformContext()) {
     1165        CGContextRef context = graphicsContext.platformContext();
     1166#if PLATFORM(IOS_FAMILY)
     1167        WKSetCurrentGraphicsContext(context);
     1168
     1169        fontAntialiasingState = FontAntialiasingStateSaver { context, [platformCALayer->platformLayer() isOpaque] };
     1170        fontAntialiasingState->setup([WAKWindow hasLandscapeOrientation]);
    11681171#else
    1169     [NSGraphicsContext saveGraphicsState];
    1170    
    1171     // Set up an NSGraphicsContext for the context, so that parts of AppKit that rely on
    1172     // the current NSGraphicsContext (e.g. NSCell drawing) get the right one.
    1173     ALLOW_DEPRECATED_DECLARATIONS_BEGIN
    1174     NSGraphicsContext* layerContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:YES];
    1175     ALLOW_DEPRECATED_DECLARATIONS_END
    1176     [NSGraphicsContext setCurrentContext:layerContext];
    1177 #endif
     1172        [NSGraphicsContext saveGraphicsState];
     1173
     1174        // Set up an NSGraphicsContext for the context, so that parts of AppKit that rely on
     1175        // the current NSGraphicsContext (e.g. NSCell drawing) get the right one.
     1176        ALLOW_DEPRECATED_DECLARATIONS_BEGIN
     1177        NSGraphicsContext* layerContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:YES];
     1178        ALLOW_DEPRECATED_DECLARATIONS_END
     1179        [NSGraphicsContext setCurrentContext:layerContext];
     1180#endif
     1181    }
    11781182   
    11791183    {
    1180         GraphicsContext graphicsContext(context);
    11811184        graphicsContext.setIsCALayerContext(true);
    11821185        graphicsContext.setIsAcceleratedContext(platformCALayer->acceleratesDrawing());
    1183        
     1186
    11841187        if (!layerContents->platformCALayerContentsOpaque() && !platformCALayer->supportsSubpixelAntialiasedText() && FontCascade::isSubpixelAntialiasingAvailable()) {
    11851188            // Turn off font smoothing to improve the appearance of text rendered onto a transparent background.
    11861189            graphicsContext.setShouldSmoothFonts(false);
    11871190        }
    1188        
     1191
    11891192#if PLATFORM(MAC)
    11901193        // It's important to get the clip from the context, because it may be significantly
    11911194        // smaller than the layer bounds (e.g. tiled layers)
    1192         ThemeMac::setFocusRingClipRect(CGContextGetClipBoundingBox(context));
    1193 #endif
    1194        
     1195        ThemeMac::setFocusRingClipRect(graphicsContext.clipBounds());
     1196#endif
     1197
    11951198        for (const auto& rect : dirtyRects) {
    11961199            GraphicsContextStateSaver stateSaver(graphicsContext);
    11971200            graphicsContext.clip(rect);
    1198            
     1201
    11991202            layerContents->platformCALayerPaintContents(platformCALayer, graphicsContext, rect, layerPaintBehavior);
    12001203        }
    1201        
     1204
    12021205#if PLATFORM(IOS_FAMILY)
    1203         fontAntialiasingState.restore();
     1206        if (fontAntialiasingState)
     1207            fontAntialiasingState->restore();
    12041208#else
    12051209        ThemeMac::setFocusRingClipRect(FloatRect());
    1206        
     1210
    12071211        [NSGraphicsContext restoreGraphicsState];
    12081212#endif
    12091213    }
    12101214
    1211     CGContextRestoreGState(context);
     1215    saver.restore();
    12121216
    12131217    // Re-fetch the layer owner, since <rdar://problem/9125151> indicates that it might have been destroyed during painting.
     
    12201224
    12211225    if (!platformCALayer->usesTiledBackingLayer() && layerContents && layerContents->platformCALayerShowRepaintCounter(platformCALayer))
    1222         drawRepaintIndicator(context, platformCALayer, repaintCount, nullptr);
     1226        drawRepaintIndicator(graphicsContext, platformCALayer, repaintCount);
    12231227}
    12241228
     
    12331237}
    12341238
    1235 void PlatformCALayerCocoa::enumerateRectsBeingDrawn(CGContextRef context, void (^block)(CGRect))
     1239void PlatformCALayerCocoa::enumerateRectsBeingDrawn(GraphicsContext& context, void (^block)(FloatRect))
    12361240{
    12371241    CGSRegionObj region = (CGSRegionObj)[m_layer regionBeingDrawn];
    12381242    if (!region) {
    1239         block(CGContextGetClipBoundingBox(context));
     1243        block(context.clipBounds());
    12401244        return;
    12411245    }
    12421246
    1243     CGAffineTransform inverseTransform = CGAffineTransformInvert(CGContextGetCTM(context));
     1247    CGAffineTransform inverseTransform = CGAffineTransformInvert(context.getCTM());
    12441248    CGSRegionEnumeratorObj enumerator = CGSRegionEnumerator(region);
    12451249    const CGRect* nextRect;
  • trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp

    r248846 r252962  
    102102}
    103103
    104 PlatformCALayer::RepaintRectList PlatformCALayer::collectRectsToPaint(CGContextRef, PlatformCALayer*)
     104PlatformCALayer::RepaintRectList PlatformCALayer::collectRectsToPaint(GraphicsContext&, PlatformCALayer*)
    105105{
    106106    // FIXME: We should actually collect rects to use instead of defaulting to Windows'
     
    110110}
    111111
    112 void PlatformCALayer::drawLayerContents(CGContextRef context, WebCore::PlatformCALayer* platformCALayer, RepaintRectList&, GraphicsLayerPaintBehavior)
    113 {
    114     intern(platformCALayer)->displayCallback(platformCALayer->platformLayer(), context);
     112void PlatformCALayer::drawLayerContents(GraphicsContext& context, WebCore::PlatformCALayer* platformCALayer, RepaintRectList&, GraphicsLayerPaintBehavior)
     113{
     114    intern(platformCALayer)->displayCallback(platformCALayer->platformLayer(), context.platformContext());
    115115}
    116116
  • trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp

    r234393 r252962  
    130130        backgroundColor = cachedCGColor(Color(255, 0, 0));
    131131
    132     PlatformCALayer::drawRepaintIndicator(context, owner(), drawCount, backgroundColor);
     132    GraphicsContext graphicsContext(context);
     133    PlatformCALayer::drawRepaintIndicator(graphicsContext, owner(), drawCount, backgroundColor);
    133134}
    134135
  • trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm

    r238410 r252962  
    5252    WebCore::PlatformCALayer* layer = WebCore::PlatformCALayer::platformCALayer((__bridge void*)self);
    5353    if (layer) {
    54         WebCore::PlatformCALayer::RepaintRectList rectsToPaint = WebCore::PlatformCALayer::collectRectsToPaint(context, layer);
    55         WebCore::PlatformCALayer::drawLayerContents(context, layer, rectsToPaint, self.isRenderingInContext ? WebCore::GraphicsLayerPaintSnapshotting : WebCore::GraphicsLayerPaintNormal);
     54        WebCore::GraphicsContext graphicsContext(context);
     55        WebCore::PlatformCALayer::RepaintRectList rectsToPaint = WebCore::PlatformCALayer::collectRectsToPaint(graphicsContext, layer);
     56        WebCore::PlatformCALayer::drawLayerContents(graphicsContext, layer, rectsToPaint, self.isRenderingInContext ? WebCore::GraphicsLayerPaintSnapshotting : WebCore::GraphicsLayerPaintNormal);
    5657    }
    5758}
  • trunk/Source/WebKit/ChangeLog

    r252945 r252962  
     12019-11-30  Tim Horton  <timothy_horton@apple.com>
     2
     3        Reimplement some PlatformCALayer methods using GraphicsContext instead of CGContextRef
     4        https://bugs.webkit.org/show_bug.cgi?id=204698
     5
     6        Reviewed by Sam Weinig.
     7
     8        * Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
     9        * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
     10        (WebKit::RemoteLayerBackingStore::drawInContext):
     11        (WebKit::RemoteLayerBackingStore::enumerateRectsBeingDrawn):
     12        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
     13        (WebKit::PlatformCALayerRemote::enumerateRectsBeingDrawn):
     14        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
     15
    1162019-11-27  Antoine Quint  <graouts@apple.com>
    217
  • trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h

    r233479 r252962  
    7272    static bool decode(IPC::Decoder&, RemoteLayerBackingStore&);
    7373
    74     void enumerateRectsBeingDrawn(CGContextRef, void (^)(CGRect));
     74    void enumerateRectsBeingDrawn(WebCore::GraphicsContext&, void (^)(WebCore::FloatRect));
    7575
    7676    bool hasFrontBuffer() const
  • trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm

    r247921 r252962  
    354354    case WebCore::PlatformCALayer::LayerTypeWebLayer:
    355355    case WebCore::PlatformCALayer::LayerTypeBackdropLayer:
    356         WebCore::PlatformCALayer::drawLayerContents(cgContext, m_layer, m_paintingRects, flags);
     356        WebCore::PlatformCALayer::drawLayerContents(context, m_layer, m_paintingRects, flags);
    357357        break;
    358358    case WebCore::PlatformCALayer::LayerTypeDarkSystemBackdropLayer:
     
    360360        // FIXME: These have a more complicated layer hierarchy. We need to paint into
    361361        // a child layer in order to see the rendered results.
    362         WebCore::PlatformCALayer::drawLayerContents(cgContext, m_layer, m_paintingRects, flags);
     362        WebCore::PlatformCALayer::drawLayerContents(context, m_layer, m_paintingRects, flags);
    363363        break;
    364364    case WebCore::PlatformCALayer::LayerTypeLayer:
     
    383383}
    384384
    385 void RemoteLayerBackingStore::enumerateRectsBeingDrawn(CGContextRef context, void (^block)(CGRect))
    386 {
    387     CGAffineTransform inverseTransform = CGAffineTransformInvert(CGContextGetCTM(context));
     385void RemoteLayerBackingStore::enumerateRectsBeingDrawn(WebCore::GraphicsContext& context, void (^block)(WebCore::FloatRect))
     386{
     387    CGAffineTransform inverseTransform = CGAffineTransformInvert(context.getCTM());
    388388
    389389    // We don't want to un-apply the flipping or contentsScale,
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp

    r248846 r252962  
    892892}
    893893
    894 void PlatformCALayerRemote::enumerateRectsBeingDrawn(CGContextRef context, void (^block)(CGRect))
     894void PlatformCALayerRemote::enumerateRectsBeingDrawn(WebCore::GraphicsContext& context, void (^block)(WebCore::FloatRect))
    895895{
    896896    m_properties.backingStore->enumerateRectsBeingDrawn(context, block);
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h

    r243962 r252962  
    185185    Ref<PlatformCALayer> createCompatibleLayer(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient*) const override;
    186186
    187     void enumerateRectsBeingDrawn(CGContextRef, void (^block)(CGRect)) override;
     187    void enumerateRectsBeingDrawn(WebCore::GraphicsContext&, void (^block)(WebCore::FloatRect)) override;
    188188
    189189    virtual uint32_t hostingContextID();
Note: See TracChangeset for help on using the changeset viewer.