WebKit Bugzilla
Attachment 346174 Details for
Bug 188197
: Clean up TransformationMatrix implementation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188197-20180801021741.patch (text/plain), 4.88 KB, created by
Yusuke Suzuki
on 2018-07-31 10:17:42 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2018-07-31 10:17:42 PDT
Size:
4.88 KB
patch
obsolete
>Subversion Revision: 234427 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index b2be80101e53bbfe715badaa232ed109adfbbdac..9721e639a131d53a618e25915e9cb575672dbc64 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+2018-07-31 Yusuke Suzuki <utatane.tea@gmail.com> >+ >+ Clean up TransformationMatrix implementation >+ https://bugs.webkit.org/show_bug.cgi?id=188197 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We perform cleaning up of TransformationMatrix. >+ >+ 1. We drop user-defined operator= and copy constructor. Default ones works well for TransformationMatrix. >+ 2. Remove unused setMatrix. We explicitly use memcpy in TransformationMatrix.cpp (only one place). >+ 3. Use memcmp for implementing operator==. >+ >+ In (2) and (3), we use `memcpy(&matrix[0][0], &tmp[0][0], sizeof(Matrix4))` instead of `memcpy(matrix, tmp, sizeof(Matrix4))`, >+ since they both are non nullptr and the former is easier to understand. >+ >+ * platform/graphics/transforms/TransformationMatrix.cpp: >+ (WebCore::TransformationMatrix::multiply): >+ * platform/graphics/transforms/TransformationMatrix.h: >+ (WebCore::TransformationMatrix::setMatrix): >+ (WebCore::TransformationMatrix::operator== const): >+ (WebCore::TransformationMatrix::operator =): Deleted. >+ > 2018-07-31 Yusuke Suzuki <utatane.tea@gmail.com> > > Use static const global variable for TransformationMatrix instead of NeverDestroyed >diff --git a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp >index eb3a47ec19f2b50951aa5353fb6113e355f40c31..1414e61deef93423ac99577d6c52f8933d6ea693 100644 >--- a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp >+++ b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp >@@ -1416,7 +1416,7 @@ TransformationMatrix& TransformationMatrix::multiply(const TransformationMatrix& > tmp[3][3] = (mat.m_matrix[3][0] * m_matrix[0][3] + mat.m_matrix[3][1] * m_matrix[1][3] > + mat.m_matrix[3][2] * m_matrix[2][3] + mat.m_matrix[3][3] * m_matrix[3][3]); > >- setMatrix(tmp); >+ memcpy(&m_matrix[0][0], &tmp[0][0], sizeof(Matrix4)); > #endif > return *this; > } >diff --git a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h >index 37d8159e6bb11d13dbbc02ee5c5b1acd3db1eb86..12428260e7f421675d5865c826bd1a07876d2e3c 100644 >--- a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h >+++ b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h >@@ -116,7 +116,6 @@ class TransformationMatrix { > { > } > >- TransformationMatrix(const TransformationMatrix& t) { *this = t; } > WEBCORE_EXPORT TransformationMatrix(const AffineTransform&); > > void setMatrix(double a, double b, double c, double d, double e, double f) >@@ -137,12 +136,6 @@ class TransformationMatrix { > m_matrix[2][0] = m31; m_matrix[2][1] = m32; m_matrix[2][2] = m33; m_matrix[2][3] = m34; > m_matrix[3][0] = m41; m_matrix[3][1] = m42; m_matrix[3][2] = m43; m_matrix[3][3] = m44; > } >- >- TransformationMatrix& operator =(const TransformationMatrix &t) >- { >- setMatrix(t.m_matrix); >- return *this; >- } > > TransformationMatrix& makeIdentity() > { >@@ -342,22 +335,7 @@ class TransformationMatrix { > > bool operator==(const TransformationMatrix& m2) const > { >- return (m_matrix[0][0] == m2.m_matrix[0][0] && >- m_matrix[0][1] == m2.m_matrix[0][1] && >- m_matrix[0][2] == m2.m_matrix[0][2] && >- m_matrix[0][3] == m2.m_matrix[0][3] && >- m_matrix[1][0] == m2.m_matrix[1][0] && >- m_matrix[1][1] == m2.m_matrix[1][1] && >- m_matrix[1][2] == m2.m_matrix[1][2] && >- m_matrix[1][3] == m2.m_matrix[1][3] && >- m_matrix[2][0] == m2.m_matrix[2][0] && >- m_matrix[2][1] == m2.m_matrix[2][1] && >- m_matrix[2][2] == m2.m_matrix[2][2] && >- m_matrix[2][3] == m2.m_matrix[2][3] && >- m_matrix[3][0] == m2.m_matrix[3][0] && >- m_matrix[3][1] == m2.m_matrix[3][1] && >- m_matrix[3][2] == m2.m_matrix[3][2] && >- m_matrix[3][3] == m2.m_matrix[3][3]); >+ return memcmp(&m_matrix[0][0], &m2.m_matrix[0][0], sizeof(Matrix4)) == 0; > } > > bool operator!=(const TransformationMatrix& other) const { return !(*this == other); } >@@ -439,12 +417,6 @@ class TransformationMatrix { > return FloatPoint3D(static_cast<float>(resultX), static_cast<float>(resultY), static_cast<float>(resultZ)); > } > >- void setMatrix(const Matrix4 m) >- { >- if (m && m != m_matrix) >- memcpy(m_matrix, m, sizeof(Matrix4)); >- } >- > Matrix4 m_matrix; > }; >
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
Flags:
simon.fraser
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188197
:
346173
| 346174