⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 184070 in webkit


Ignore:
Timestamp:
May 11, 2015, 1:52:35 AM (11 years ago)
Author:
zandobersek@gmail.com
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r184069 r184070  
     12015-05-11  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        Reduce TransformationMatrix copies in WebKitCSSMatrix operations
     4        https://bugs.webkit.org/show_bug.cgi?id=144795
     5
     6        Reviewed by Darin Adler.
     7
     8        Instead of copying the TransformationMatrix member, performing
     9        the operation on it and then copying it again when creating
     10        the new WebKitCSSMatrix object, copy it just once by first
     11        creating the new WebKitCSSMatrix object and then performing
     12        the operation on that object's TransformationMatrix directly.
     13
     14        * css/WebKitCSSMatrix.cpp:
     15        (WebCore::WebKitCSSMatrix::multiply):
     16        (WebCore::WebKitCSSMatrix::translate):
     17        (WebCore::WebKitCSSMatrix::scale):
     18        (WebCore::WebKitCSSMatrix::rotate):
     19        (WebCore::WebKitCSSMatrix::rotateAxisAngle):
     20        (WebCore::WebKitCSSMatrix::skewX):
     21        (WebCore::WebKitCSSMatrix::skewY):
     22
    1232015-05-11  Zan Dobersek  <zdobersek@igalia.com>
    224
  • trunk/Source/WebCore/css/WebKitCSSMatrix.cpp

    r183017 r184070  
    9393{
    9494    if (!secondMatrix)
    95         return 0;
    96 
    97     return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).multiply(secondMatrix->m_matrix));
     95        return nullptr;
     96
     97    RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(m_matrix);
     98    matrix->m_matrix.multiply(secondMatrix->m_matrix);
     99    return matrix.release();
    98100}
    99101
     
    116118    if (std::isnan(z))
    117119        z = 0;
    118     return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).translate3d(x, y, z));
     120
     121    RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(m_matrix);
     122    matrix->m_matrix.translate3d(x, y, z);
     123    return matrix.release();
    119124}
    120125
     
    127132    if (std::isnan(scaleZ))
    128133        scaleZ = 1;
    129     return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).scale3d(scaleX, scaleY, scaleZ));
     134
     135    RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(m_matrix);
     136    matrix->m_matrix.scale3d(scaleX, scaleY, scaleZ);
     137    return matrix.release();
    130138}
    131139
     
    145153    if (std::isnan(rotZ))
    146154        rotZ = 0;
    147     return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).rotate3d(rotX, rotY, rotZ));
     155
     156    RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(m_matrix);
     157    matrix->m_matrix.rotate3d(rotX, rotY, rotZ);
     158    return matrix.release();
    148159}
    149160
     
    160171    if (x == 0 && y == 0 && z == 0)
    161172        z = 1;
    162     return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).rotate3d(x, y, z, angle));
     173
     174    RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(m_matrix);
     175    matrix->m_matrix.rotate3d(x, y, z, angle);
     176    return matrix.release();
    163177}
    164178
     
    167181    if (std::isnan(angle))
    168182        angle = 0;
    169     return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).skewX(angle));
     183
     184    RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(m_matrix);
     185    matrix->m_matrix.skewX(angle);
     186    return matrix.release();
    170187}
    171188
     
    174191    if (std::isnan(angle))
    175192        angle = 0;
    176     return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).skewY(angle));
     193
     194    RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(m_matrix);
     195    matrix->m_matrix.skewY(angle);
     196    return matrix.release();
    177197}
    178198
Note: See TracChangeset for help on using the changeset viewer.