Diff
Modified: trunk/LayoutTests/ChangeLog (293442 => 293443)
--- trunk/LayoutTests/ChangeLog 2022-04-26 19:20:18 UTC (rev 293442)
+++ trunk/LayoutTests/ChangeLog 2022-04-26 19:25:35 UTC (rev 293443)
@@ -1,3 +1,17 @@
+2022-04-26 Simon Fraser <[email protected]>
+
+ Save a few drawing operations when painting layer contents
+ https://bugs.webkit.org/show_bug.cgi?id=239756
+
+ Reviewed by Tim Horton.
+
+ Remove an extra save/restore, and a translate(0,0) when painting layers and there's just one
+ dirty rect.
+
+ * displaylists/extent-includes-shadow-expected.txt:
+ * displaylists/layer-dispay-list-expected.txt:
+ * displaylists/replay-skip-clipped-rect-expected.txt:
+
2022-04-26 Karl Rackler <[email protected]>
[ macOS Debug wk2 ] Six imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/ are a flaky crash
Modified: trunk/LayoutTests/displaylists/extent-includes-shadow-expected.txt (293442 => 293443)
--- trunk/LayoutTests/displaylists/extent-includes-shadow-expected.txt 2022-04-26 19:20:18 UTC (rev 293442)
+++ trunk/LayoutTests/displaylists/extent-includes-shadow-expected.txt 2022-04-26 19:25:35 UTC (rev 293443)
@@ -1,7 +1,4 @@
-(translate
- (x 0.00)
- (y 0.00))
(save)
(set-state
(change-flags [drop-shadow])
Modified: trunk/LayoutTests/displaylists/layer-dispay-list-expected.txt (293442 => 293443)
--- trunk/LayoutTests/displaylists/layer-dispay-list-expected.txt 2022-04-26 19:20:18 UTC (rev 293442)
+++ trunk/LayoutTests/displaylists/layer-dispay-list-expected.txt 2022-04-26 19:25:35 UTC (rev 293443)
@@ -1,7 +1,4 @@
-(translate
- (x 0.00)
- (y 0.00))
(fill-composited-rect
(rect at (0,0) size 104x104)
(color #008000)
Modified: trunk/LayoutTests/displaylists/replay-skip-clipped-rect-expected.txt (293442 => 293443)
--- trunk/LayoutTests/displaylists/replay-skip-clipped-rect-expected.txt 2022-04-26 19:20:18 UTC (rev 293442)
+++ trunk/LayoutTests/displaylists/replay-skip-clipped-rect-expected.txt 2022-04-26 19:25:35 UTC (rev 293443)
@@ -1,7 +1,4 @@
recorded:
-(translate
- (x 0.00)
- (y 0.00))
(fill-composited-rect
(rect at (412,0) size 100x100)
(color #0000FF)
@@ -11,6 +8,3 @@
replayed:
(
(clip at (512,0) size 512x200)
-(translate
- (x 0.00)
- (y 0.00))
Modified: trunk/Source/WebCore/ChangeLog (293442 => 293443)
--- trunk/Source/WebCore/ChangeLog 2022-04-26 19:20:18 UTC (rev 293442)
+++ trunk/Source/WebCore/ChangeLog 2022-04-26 19:25:35 UTC (rev 293443)
@@ -1,3 +1,19 @@
+2022-04-26 Simon Fraser <[email protected]>
+
+ Save a few drawing operations when painting layer contents
+ https://bugs.webkit.org/show_bug.cgi?id=239756
+
+ Reviewed by Tim Horton.
+
+ Remove an extra save/restore, and a translate(0,0) when painting layers and there's just one
+ dirty rect.
+
+ * platform/graphics/GraphicsLayer.cpp:
+ (WebCore::GraphicsLayer::paintGraphicsLayerContents):
+ * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
+ (WebCore::PlatformCALayer::drawLayerContents): The caller sets the clip when there's just one
+ dirty rect.
+
2022-04-22 Elliott Williams <[email protected]>
[Xcode] Compute PGO profdata paths instead of searching for them at build time
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (293442 => 293443)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2022-04-26 19:20:18 UTC (rev 293442)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2022-04-26 19:25:35 UTC (rev 293443)
@@ -533,11 +533,13 @@
void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const FloatRect& clip, GraphicsLayerPaintBehavior layerPaintBehavior)
{
- FloatSize offset = offsetFromRenderer() - toFloatSize(scrollOffset());
- context.translate(-offset);
+ auto offset = offsetFromRenderer() - toFloatSize(scrollOffset());
+ auto clipRect = clip;
- FloatRect clipRect(clip);
- clipRect.move(offset);
+ if (!offset.isZero()) {
+ context.translate(-offset);
+ clipRect.move(offset);
+ }
client().paintContents(this, context, clipRect, layerPaintBehavior);
}
Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm (293442 => 293443)
--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm 2022-04-26 19:20:18 UTC (rev 293442)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm 2022-04-26 19:25:35 UTC (rev 293443)
@@ -1259,12 +1259,14 @@
// smaller than the layer bounds (e.g. tiled layers)
ThemeMac::setFocusRingClipRect(graphicsContext.clipBounds());
#endif
-
- for (const auto& rect : dirtyRects) {
- GraphicsContextStateSaver stateSaver(graphicsContext);
- graphicsContext.clip(rect);
-
- layerContents->platformCALayerPaintContents(platformCALayer, graphicsContext, rect, layerPaintBehavior);
+ if (dirtyRects.size() == 1)
+ layerContents->platformCALayerPaintContents(platformCALayer, graphicsContext, dirtyRects[0], layerPaintBehavior);
+ else {
+ for (const auto& rect : dirtyRects) {
+ GraphicsContextStateSaver stateSaver(graphicsContext);
+ graphicsContext.clip(rect);
+ layerContents->platformCALayerPaintContents(platformCALayer, graphicsContext, rect, layerPaintBehavior);
+ }
}
#if PLATFORM(MAC)