Title: [184070] trunk/Source/WebCore
Revision
184070
Author
[email protected]
Date
2015-05-11 01:52:35 -0700 (Mon, 11 May 2015)

Log Message

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: trunk/Source/WebCore/ChangeLog (184069 => 184070)


--- trunk/Source/WebCore/ChangeLog	2015-05-11 08:40:15 UTC (rev 184069)
+++ trunk/Source/WebCore/ChangeLog	2015-05-11 08:52:35 UTC (rev 184070)
@@ -1,5 +1,27 @@
 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-11  Zan Dobersek  <[email protected]>
+
         Add missing vtable override specifiers under Source/WebCore/loader, Source/WebCore/xml
         https://bugs.webkit.org/show_bug.cgi?id=144793
 

Modified: trunk/Source/WebCore/css/WebKitCSSMatrix.cpp (184069 => 184070)


--- trunk/Source/WebCore/css/WebKitCSSMatrix.cpp	2015-05-11 08:40:15 UTC (rev 184069)
+++ trunk/Source/WebCore/css/WebKitCSSMatrix.cpp	2015-05-11 08:52:35 UTC (rev 184070)
@@ -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