Title: [184187] releases/WebKitGTK/webkit-2.8/Source/WebCore
Revision
184187
Author
[email protected]
Date
2015-05-12 02:17:53 -0700 (Tue, 12 May 2015)

Log Message

Merge r184070 - Reduce TransformationMatrix copies in WebKitCSSMatrix operations
https://bugs.webkit.org/show_bug.cgi?id=144795

Reviewed by Darin Adler.

Instead of copying the TransformationMatrix member, performing
the operation on it and then copying it again when creating
the new WebKitCSSMatrix object, copy it just once by first
creating the new WebKitCSSMatrix object and then performing
the operation on that object's TransformationMatrix directly.

* css/WebKitCSSMatrix.cpp:
(WebCore::WebKitCSSMatrix::multiply):
(WebCore::WebKitCSSMatrix::translate):
(WebCore::WebKitCSSMatrix::scale):
(WebCore::WebKitCSSMatrix::rotate):
(WebCore::WebKitCSSMatrix::rotateAxisAngle):
(WebCore::WebKitCSSMatrix::skewX):
(WebCore::WebKitCSSMatrix::skewY):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (184186 => 184187)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-05-12 09:17:02 UTC (rev 184186)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-05-12 09:17:53 UTC (rev 184187)
@@ -1,3 +1,25 @@
+2015-05-11  Zan Dobersek  <[email protected]>
+
+        Reduce TransformationMatrix copies in WebKitCSSMatrix operations
+        https://bugs.webkit.org/show_bug.cgi?id=144795
+
+        Reviewed by Darin Adler.
+
+        Instead of copying the TransformationMatrix member, performing
+        the operation on it and then copying it again when creating
+        the new WebKitCSSMatrix object, copy it just once by first
+        creating the new WebKitCSSMatrix object and then performing
+        the operation on that object's TransformationMatrix directly.
+
+        * css/WebKitCSSMatrix.cpp:
+        (WebCore::WebKitCSSMatrix::multiply):
+        (WebCore::WebKitCSSMatrix::translate):
+        (WebCore::WebKitCSSMatrix::scale):
+        (WebCore::WebKitCSSMatrix::rotate):
+        (WebCore::WebKitCSSMatrix::rotateAxisAngle):
+        (WebCore::WebKitCSSMatrix::skewX):
+        (WebCore::WebKitCSSMatrix::skewY):
+
 2015-05-08  Alexey Proskuryakov  <[email protected]>
 
         Crashes in SocketStreamHandleBase::close

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/css/WebKitCSSMatrix.cpp (184186 => 184187)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/css/WebKitCSSMatrix.cpp	2015-05-12 09:17:02 UTC (rev 184186)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/css/WebKitCSSMatrix.cpp	2015-05-12 09:17:53 UTC (rev 184187)
@@ -92,9 +92,11 @@
 PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::multiply(WebKitCSSMatrix* secondMatrix) const
 {
     if (!secondMatrix)
-        return 0;
+        return nullptr;
 
-    return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).multiply(secondMatrix->m_matrix));
+    RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(m_matrix);
+    matrix->m_matrix.multiply(secondMatrix->m_matrix);
+    return matrix.release();
 }
 
 PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::inverse(ExceptionCode& ec) const
@@ -115,7 +117,10 @@
         y = 0;
     if (std::isnan(z))
         z = 0;
-    return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).translate3d(x, y, z));
+
+    RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(m_matrix);
+    matrix->m_matrix.translate3d(x, y, z);
+    return matrix.release();
 }
 
 PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::scale(double scaleX, double scaleY, double scaleZ) const
@@ -126,7 +131,10 @@
         scaleY = scaleX;
     if (std::isnan(scaleZ))
         scaleZ = 1;
-    return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).scale3d(scaleX, scaleY, scaleZ));
+
+    RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(m_matrix);
+    matrix->m_matrix.scale3d(scaleX, scaleY, scaleZ);
+    return matrix.release();
 }
 
 PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::rotate(double rotX, double rotY, double rotZ) const
@@ -144,7 +152,10 @@
         rotY = 0;
     if (std::isnan(rotZ))
         rotZ = 0;
-    return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).rotate3d(rotX, rotY, rotZ));
+
+    RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(m_matrix);
+    matrix->m_matrix.rotate3d(rotX, rotY, rotZ);
+    return matrix.release();
 }
 
 PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::rotateAxisAngle(double x, double y, double z, double angle) const
@@ -159,21 +170,30 @@
         angle = 0;
     if (x == 0 && y == 0 && z == 0)
         z = 1;
-    return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).rotate3d(x, y, z, angle));
+
+    RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(m_matrix);
+    matrix->m_matrix.rotate3d(x, y, z, angle);
+    return matrix.release();
 }
 
 PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::skewX(double angle) const
 {
     if (std::isnan(angle))
         angle = 0;
-    return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).skewX(angle));
+
+    RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(m_matrix);
+    matrix->m_matrix.skewX(angle);
+    return matrix.release();
 }
 
 PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::skewY(double angle) const
 {
     if (std::isnan(angle))
         angle = 0;
-    return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).skewY(angle));
+
+    RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(m_matrix);
+    matrix->m_matrix.skewY(angle);
+    return matrix.release();
 }
 
 String WebKitCSSMatrix::toString() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to