⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 109186 in webkit


Ignore:
Timestamp:
Feb 28, 2012, 8:46:47 PM (15 years ago)
Author:
Simon Fraser
Message:

Optimize the rects being drawn into compositing layers
​https://bugs.webkit.org/show_bug.cgi?id=79852

Reviewed by Dan Bernstein.

Use the newly added WebKitSystemInterface method
to limit the area being painted in a CALayer
-drawInContext callback. This avoids redundant drawing,
for performance.

  • platform/graphics/mac/WebLayer.mm:

(drawLayerContents):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r109184 r109186  
     12012-02-28  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Optimize the rects being drawn into compositing layers
     4        https://bugs.webkit.org/show_bug.cgi?id=79852
     5
     6        Reviewed by Dan Bernstein.
     7
     8        Use the newly added WebKitSystemInterface method
     9        to limit the area being painted in a CALayer
     10        -drawInContext callback. This avoids redundant drawing,
     11        for performance.
     12
     13        * platform/graphics/mac/WebLayer.mm:
     14        (drawLayerContents):
     15
    1162012-02-28  Simon Fraser  <simon.fraser@apple.com>
    217
  • trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm

    r106304 r109186  
    3636#import <QuartzCore/QuartzCore.h>
    3737#import <wtf/UnusedParam.h>
     38#import "WebCoreSystemInterface.h"
    3839
    3940@interface CALayer(WebCoreCALayerPrivate)
    … …  
    7778    // It's important to get the clip from the context, because it may be significantly
    7879    // smaller than the layer bounds (e.g. tiled layers)
    79     CGRect clipBounds = CGContextGetClipBoundingBox(context);
    80     IntRect clip(enclosingIntRect(clipBounds));
     80    FloatRect clipBounds = CGContextGetClipBoundingBox(context);
     81
     82#if !defined(BUILDING_ON_SNOW_LEOPARD)
     83    __block GraphicsContext* ctx = &graphicsContext;
     84
     85    wkCALayerEnumerateRectsBeingDrawnWithBlock(layer, context, ^(CGRect rect){
     86        FloatRect rectBeingDrawn(rect);
     87        rectBeingDrawn.intersect(clipBounds);
     88       
     89        GraphicsContextStateSaver stateSaver(*ctx);
     90        ctx->clip(rectBeingDrawn);
     91       
     92        layerContents->platformCALayerPaintContents(*ctx, enclosedIntRect(rectBeingDrawn));
     93    });
     94#else
     95    IntRect clip(enclosedIntRect(clipBounds));
    8196    layerContents->platformCALayerPaintContents(graphicsContext, clip);
     97#endif
    8298
    8399    [NSGraphicsContext restoreGraphicsState];
Note: See TracChangeset for help on using the changeset viewer.