Remove the use of GraphicsContextStateSaver from RenderLayer::paintLayerByApplyingTra...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2015 00:49:48 +0000 (00:49 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2015 00:49:48 +0000 (00:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151829

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2015-12-03
Reviewed by Simon Fraser.

Set the CTM of the GraphicsContext to its original value before changing
it. This is a lot cheaper than using GraphicsContextStateSaver to save the
whole state of the GraphicsContext and restore it back;

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintLayerByApplyingTransform):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193390 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayer.cpp

index ce649b9..156582b 100644 (file)
@@ -1,3 +1,17 @@
+2015-12-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        Remove the use of GraphicsContextStateSaver from RenderLayer::paintLayerByApplyingTransform
+        https://bugs.webkit.org/show_bug.cgi?id=151829
+
+        Reviewed by Simon Fraser.
+
+        Set the CTM of the GraphicsContext to its original value before changing
+        it. This is a lot cheaper than using GraphicsContextStateSaver to save the
+        whole state of the GraphicsContext and restore it back;
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintLayerByApplyingTransform):
+
 2015-12-03  Eric Carlson  <eric.carlson@apple.com>
 
         [MediaStream] Update MediaStreamTrack.getCapabilities
index 0695cd9..72365f8 100644 (file)
@@ -4405,7 +4405,7 @@ void RenderLayer::paintLayerByApplyingTransform(GraphicsContext& context, const
     // Translate the graphics context to the snapping position to avoid off-device-pixel positing.
     transform.translateRight(devicePixelSnappedOffsetForThisLayer.width(), devicePixelSnappedOffsetForThisLayer.height());
     // Apply the transform.
-    GraphicsContextStateSaver stateSaver(context);
+    AffineTransform oldTransfrom = context.getCTM();
     context.concatCTM(transform.toAffineTransform());
 
     // Now do a paint with the root layer shifted to be us.
@@ -4413,6 +4413,7 @@ void RenderLayer::paintLayerByApplyingTransform(GraphicsContext& context, const
     LayerPaintingInfo transformedPaintingInfo(this, LayoutRect(encloseRectToDevicePixels(transform.inverse().valueOr(AffineTransform()).mapRect(paintingInfo.paintDirtyRect), deviceScaleFactor)),
         paintingInfo.paintBehavior, adjustedSubpixelAccumulation, paintingInfo.subtreePaintRoot, paintingInfo.overlapTestRequests);
     paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags);
+    context.setCTM(oldTransfrom);
 }
 
 void RenderLayer::paintList(Vector<RenderLayer*>* list, GraphicsContext& context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)