Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Torch Mobile, Inc. | 3 * Copyright (C) 2009 Torch Mobile, Inc. |
| 4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 #include "platform/geometry/FloatBox.h" | 30 #include "platform/geometry/FloatBox.h" |
| 31 #include "platform/geometry/FloatQuad.h" | 31 #include "platform/geometry/FloatQuad.h" |
| 32 #include "platform/geometry/FloatRect.h" | 32 #include "platform/geometry/FloatRect.h" |
| 33 #include "platform/geometry/IntRect.h" | 33 #include "platform/geometry/IntRect.h" |
| 34 #include "platform/geometry/LayoutRect.h" | 34 #include "platform/geometry/LayoutRect.h" |
| 35 #include "platform/transforms/AffineTransform.h" | 35 #include "platform/transforms/AffineTransform.h" |
| 36 #include "platform/transforms/Rotation.h" | 36 #include "platform/transforms/Rotation.h" |
| 37 | 37 |
| 38 #include "wtf/Assertions.h" | 38 #include "wtf/Assertions.h" |
| 39 #include "wtf/MathExtras.h" | 39 #include "wtf/MathExtras.h" |
| 40 #include "wtf/text/WTFString.h" | |
| 40 | 41 |
| 41 #include <cmath> | 42 #include <cmath> |
| 42 #include <cstdlib> | 43 #include <cstdlib> |
| 43 | 44 |
| 44 #if CPU(X86_64) | 45 #if CPU(X86_64) |
| 45 #include <emmintrin.h> | 46 #include <emmintrin.h> |
| 46 #endif | 47 #endif |
| 47 | 48 |
| 48 namespace blink { | 49 namespace blink { |
| 49 | 50 |
| (...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1591 ret.setDouble(2, 1, matrix.m23()); | 1592 ret.setDouble(2, 1, matrix.m23()); |
| 1592 ret.setDouble(2, 2, matrix.m33()); | 1593 ret.setDouble(2, 2, matrix.m33()); |
| 1593 ret.setDouble(2, 3, matrix.m43()); | 1594 ret.setDouble(2, 3, matrix.m43()); |
| 1594 ret.setDouble(3, 0, matrix.m14()); | 1595 ret.setDouble(3, 0, matrix.m14()); |
| 1595 ret.setDouble(3, 1, matrix.m24()); | 1596 ret.setDouble(3, 1, matrix.m24()); |
| 1596 ret.setDouble(3, 2, matrix.m34()); | 1597 ret.setDouble(3, 2, matrix.m34()); |
| 1597 ret.setDouble(3, 3, matrix.m44()); | 1598 ret.setDouble(3, 3, matrix.m44()); |
| 1598 return ret; | 1599 return ret; |
| 1599 } | 1600 } |
| 1600 | 1601 |
| 1602 String TransformationMatrix::toString(bool asMatrix) const | |
| 1603 { | |
| 1604 if (asMatrix) { | |
| 1605 // Return as a matrix in row-major order. | |
| 1606 return String::format("[%lg,%lg,%lg,%lg,\n%lg,%lg,%lg,%lg,\n%lg,%lg,%lg, %lg,\n%lg,%lg,%lg,%lg]", | |
| 1607 m11(), m21(), m31(), m41(), | |
| 1608 m12(), m22(), m32(), m42(), | |
| 1609 m13(), m23(), m33(), m43(), | |
| 1610 m14(), m24(), m34(), m44()); | |
| 1611 } | |
| 1612 | |
| 1613 TransformationMatrix::DecomposedType decomposition; | |
| 1614 if (!decompose(decomposition)) | |
| 1615 return "degenerate"; | |
|
jbroman
2016/08/21 16:21:07
nit: maybe the matrix representation above would b
pdr.
2016/08/22 17:27:35
Good idea, done.
| |
| 1616 | |
| 1617 if (isIdentityOrTranslation()) { | |
| 1618 if (decomposition.translateX == 0 && decomposition.translateY == 0 && de composition.translateZ == 0) | |
| 1619 return "identity"; | |
| 1620 return String::format("translation(%lg,%lg,%lg)", decomposition.translat eX, decomposition.translateY, decomposition.translateZ); | |
| 1621 } | |
| 1622 | |
| 1623 return String::format("translation(%lg,%lg,%lg), scale(%lg,%lg,%lg), skew(%l g,%lg,%lg), quaternion(%lg,%lg,%lg,%lg), perspective(%lg,%lg,%lg,%lg)", | |
| 1624 decomposition.translateX, decomposition.translateY, decomposition.transl ateZ, | |
| 1625 decomposition.scaleX, decomposition.scaleY, decomposition.scaleZ, | |
| 1626 decomposition.skewXY, decomposition.skewXZ, decomposition.skewYZ, | |
| 1627 decomposition.quaternionX, decomposition.quaternionY, decomposition.quat ernionZ, decomposition.quaternionW, | |
| 1628 decomposition.perspectiveX, decomposition.perspectiveY, decomposition.pe rspectiveZ, decomposition.perspectiveW); | |
| 1629 } | |
| 1630 | |
| 1601 } // namespace blink | 1631 } // namespace blink |
| OLD | NEW |