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 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 TransformationMatrix& TransformationMatrix::applyPerspective(double p) | 1081 TransformationMatrix& TransformationMatrix::applyPerspective(double p) |
1082 { | 1082 { |
1083 TransformationMatrix mat; | 1083 TransformationMatrix mat; |
1084 if (p != 0) | 1084 if (p != 0) |
1085 mat.m_matrix[2][3] = -1/p; | 1085 mat.m_matrix[2][3] = -1/p; |
1086 | 1086 |
1087 multiply(mat); | 1087 multiply(mat); |
1088 return *this; | 1088 return *this; |
1089 } | 1089 } |
1090 | 1090 |
1091 TransformationMatrix TransformationMatrix::rectToRect(const FloatRect& from, con
st FloatRect& to) | |
1092 { | |
1093 ASSERT(!from.isEmpty()); | |
1094 return TransformationMatrix(to.width() / from.width(), | |
1095 0, 0, | |
1096 to.height() / from.height(), | |
1097 to.x() - from.x(), | |
1098 to.y() - from.y()); | |
1099 } | |
1100 | |
1101 // this = mat * this. | 1091 // this = mat * this. |
1102 TransformationMatrix& TransformationMatrix::multiply(const TransformationMatrix&
mat) | 1092 TransformationMatrix& TransformationMatrix::multiply(const TransformationMatrix&
mat) |
1103 { | 1093 { |
1104 #if CPU(ARM64) | 1094 #if CPU(ARM64) |
1105 double* rightMatrix = &(m_matrix[0][0]); | 1095 double* rightMatrix = &(m_matrix[0][0]); |
1106 const double* leftMatrix = &(mat.m_matrix[0][0]); | 1096 const double* leftMatrix = &(mat.m_matrix[0][0]); |
1107 asm volatile( | 1097 asm volatile( |
1108 // Load mat.m_matrix to v16 - v23. | 1098 // Load mat.m_matrix to v16 - v23. |
1109 // Load this.m_matrix to v24 - v31. | 1099 // Load this.m_matrix to v24 - v31. |
1110 // Result: this = mat * this | 1100 // Result: this = mat * this |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 ret.setDouble(2, 2, matrix.m33()); | 1680 ret.setDouble(2, 2, matrix.m33()); |
1691 ret.setDouble(2, 3, matrix.m43()); | 1681 ret.setDouble(2, 3, matrix.m43()); |
1692 ret.setDouble(3, 0, matrix.m14()); | 1682 ret.setDouble(3, 0, matrix.m14()); |
1693 ret.setDouble(3, 1, matrix.m24()); | 1683 ret.setDouble(3, 1, matrix.m24()); |
1694 ret.setDouble(3, 2, matrix.m34()); | 1684 ret.setDouble(3, 2, matrix.m34()); |
1695 ret.setDouble(3, 3, matrix.m44()); | 1685 ret.setDouble(3, 3, matrix.m44()); |
1696 return ret; | 1686 return ret; |
1697 } | 1687 } |
1698 | 1688 |
1699 } | 1689 } |
OLD | NEW |