WebKit Bugzilla
Attachment 346167 Details for
Bug 188195
: Use static const global variable for TransformationMatrix instead of NeverDestroyed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188195-20180801004249.patch (text/plain), 4.94 KB, created by
Yusuke Suzuki
on 2018-07-31 08:42:50 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2018-07-31 08:42:50 PDT
Size:
4.94 KB
patch
obsolete
>Subversion Revision: 234423 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 74e5096c249e3945d35870424c43470424521202..2e53a145616a957d54a37520569650b299dd0350 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2018-07-31 Yusuke Suzuki <utatane.tea@gmail.com> >+ >+ Use static const global variable for TransformationMatrix instead of NeverDestroyed >+ https://bugs.webkit.org/show_bug.cgi?id=188195 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Since TransformationMatrix does not have a non-trivial destructor, we can put it >+ as static const global variable if its constructor is constexpr. This patch makes >+ some of constructors constexpr and makes identityTransform static const global variable >+ instead of NeverDestroyed<> + static function. This removes unnecessary static function >+ and lazy initialization. >+ >+ No behavior change. >+ >+ * platform/graphics/GraphicsLayer.cpp: >+ (WebCore::GraphicsLayer::transform const): >+ (WebCore::GraphicsLayer::childrenTransform const): >+ (WebCore::identityTransform): Deleted. >+ * platform/graphics/transforms/TransformationMatrix.h: >+ (WebCore::TransformationMatrix::TransformationMatrix): >+ > 2018-07-31 Zalan Bujtas <zalan@apple.com> > > [LFC][Floating] Add basic left/right floating positioning. >diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.cpp b/Source/WebCore/platform/graphics/GraphicsLayer.cpp >index b9641bb536e0720164c49afa3dc83e7ed542ae17..38c034a37a187750659ea2765a97a05f44607dfc 100644 >--- a/Source/WebCore/platform/graphics/GraphicsLayer.cpp >+++ b/Source/WebCore/platform/graphics/GraphicsLayer.cpp >@@ -292,15 +292,11 @@ void GraphicsLayer::removeFromParent() > } > } > >-static const TransformationMatrix& identityTransform() >-{ >- static NeverDestroyed<TransformationMatrix> identityTransform; >- return identityTransform; >-} >+static const TransformationMatrix identityTransform { }; > > const TransformationMatrix& GraphicsLayer::transform() const > { >- return m_transform ? *m_transform : identityTransform(); >+ return m_transform ? *m_transform : identityTransform; > } > > void GraphicsLayer::setTransform(const TransformationMatrix& matrix) >@@ -313,7 +309,7 @@ void GraphicsLayer::setTransform(const TransformationMatrix& matrix) > > const TransformationMatrix& GraphicsLayer::childrenTransform() const > { >- return m_childrenTransform ? *m_childrenTransform : identityTransform(); >+ return m_childrenTransform ? *m_childrenTransform : identityTransform; > } > > void GraphicsLayer::setChildrenTransform(const TransformationMatrix& matrix) >diff --git a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h >index e832ba9af13a2e223f11e16f078f405980442c9c..89896200aa090351ee5c7c7906ad61e20a4c36c7 100644 >--- a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h >+++ b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h >@@ -82,18 +82,42 @@ class TransformationMatrix { > typedef double Matrix4[4][4]; > #endif > >- TransformationMatrix() { makeIdentity(); } >- WEBCORE_EXPORT TransformationMatrix(const AffineTransform&); >- TransformationMatrix(const TransformationMatrix& t) { *this = t; } >- TransformationMatrix(double a, double b, double c, double d, double e, double f) { setMatrix(a, b, c, d, e, f); } >- TransformationMatrix(double m11, double m12, double m13, double m14, >- double m21, double m22, double m23, double m24, >- double m31, double m32, double m33, double m34, >- double m41, double m42, double m43, double m44) >+ constexpr explicit TransformationMatrix() >+ : m_matrix { >+ { 1, 0, 0, 0 }, >+ { 0, 1, 0, 0 }, >+ { 0, 0, 1, 0 }, >+ { 0, 0, 0, 1 }, >+ } >+ { >+ } >+ >+ constexpr TransformationMatrix(double a, double b, double c, double d, double e, double f) >+ : m_matrix { >+ { a, b, 0, 0 }, >+ { c, d, 0, 0 }, >+ { 0, 0, 1, 0 }, >+ { e, f, 0, 1 }, >+ } > { >- setMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44); > } > >+ constexpr TransformationMatrix( >+ double m11, double m12, double m13, double m14, >+ double m21, double m22, double m23, double m24, >+ double m31, double m32, double m33, double m34, >+ double m41, double m42, double m43, double m44) >+ : m_matrix { >+ { m11, m12, m13, m14 }, >+ { m21, m22, m23, m24 }, >+ { m31, m32, m33, m34 }, >+ { m41, m42, m43, m44 }, >+ } >+ { >+ } >+ >+ WEBCORE_EXPORT TransformationMatrix(const AffineTransform&); >+ > void setMatrix(double a, double b, double c, double d, double e, double f) > { > m_matrix[0][0] = a; m_matrix[0][1] = b; m_matrix[0][2] = 0; m_matrix[0][3] = 0;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188195
:
346167
|
346168
|
346169