Title: [109186] trunk/Source/WebCore
Revision
109186
Author
simon.fra...@apple.com
Date
2012-02-28 20:46:47 -0800 (Tue, 28 Feb 2012)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (109185 => 109186)


--- trunk/Source/WebCore/ChangeLog	2012-02-29 04:25:42 UTC (rev 109185)
+++ trunk/Source/WebCore/ChangeLog	2012-02-29 04:46:47 UTC (rev 109186)
@@ -1,5 +1,20 @@
 2012-02-28  Simon Fraser  <simon.fra...@apple.com>
 
+        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):
+
+2012-02-28  Simon Fraser  <simon.fra...@apple.com>
+
         Fix the SnowLeopard build.
 
         * WebCore.exp.in:

Modified: trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm (109185 => 109186)


--- trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm	2012-02-29 04:25:42 UTC (rev 109185)
+++ trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm	2012-02-29 04:46:47 UTC (rev 109186)
@@ -35,6 +35,7 @@
 #import <objc/objc-runtime.h>
 #import <QuartzCore/QuartzCore.h>
 #import <wtf/UnusedParam.h>
+#import "WebCoreSystemInterface.h"
 
 @interface CALayer(WebCoreCALayerPrivate)
 - (void)reloadValueForKeyPath:(NSString *)keyPath;
@@ -76,9 +77,24 @@
     
     // It's important to get the clip from the context, because it may be significantly
     // smaller than the layer bounds (e.g. tiled layers)
-    CGRect clipBounds = CGContextGetClipBoundingBox(context);
-    IntRect clip(enclosingIntRect(clipBounds));
+    FloatRect clipBounds = CGContextGetClipBoundingBox(context);
+
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+    __block GraphicsContext* ctx = &graphicsContext;
+
+    wkCALayerEnumerateRectsBeingDrawnWithBlock(layer, context, ^(CGRect rect){
+        FloatRect rectBeingDrawn(rect);
+        rectBeingDrawn.intersect(clipBounds);
+        
+        GraphicsContextStateSaver stateSaver(*ctx);
+        ctx->clip(rectBeingDrawn);
+        
+        layerContents->platformCALayerPaintContents(*ctx, enclosedIntRect(rectBeingDrawn));
+    });
+#else
+    IntRect clip(enclosedIntRect(clipBounds));
     layerContents->platformCALayerPaintContents(graphicsContext, clip);
+#endif
 
     [NSGraphicsContext restoreGraphicsState];
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to