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 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 m_matrix[3][2] = 0; | 1391 m_matrix[3][2] = 0; |
1392 m_matrix[3][3] = 1; | 1392 m_matrix[3][3] = 1; |
1393 } | 1393 } |
1394 | 1394 |
1395 AffineTransform TransformationMatrix::toAffineTransform() const | 1395 AffineTransform TransformationMatrix::toAffineTransform() const |
1396 { | 1396 { |
1397 return AffineTransform(m_matrix[0][0], m_matrix[0][1], m_matrix[1][0], | 1397 return AffineTransform(m_matrix[0][0], m_matrix[0][1], m_matrix[1][0], |
1398 m_matrix[1][1], m_matrix[3][0], m_matrix[3][1]); | 1398 m_matrix[1][1], m_matrix[3][0], m_matrix[3][1]); |
1399 } | 1399 } |
1400 | 1400 |
| 1401 void TransformationMatrix::flattenTo2d() |
| 1402 { |
| 1403 m_matrix[2][0] = 0; |
| 1404 m_matrix[2][1] = 0; |
| 1405 m_matrix[0][2] = 0; |
| 1406 m_matrix[1][2] = 0; |
| 1407 m_matrix[2][2] = 1; |
| 1408 m_matrix[3][2] = 0; |
| 1409 m_matrix[2][3] = 0; |
| 1410 } |
| 1411 |
1401 static inline void blendFloat(double& from, double to, double progress) | 1412 static inline void blendFloat(double& from, double to, double progress) |
1402 { | 1413 { |
1403 if (from != to) | 1414 if (from != to) |
1404 from = from + (to - from) * progress; | 1415 from = from + (to - from) * progress; |
1405 } | 1416 } |
1406 | 1417 |
1407 void TransformationMatrix::blend(const TransformationMatrix& from, double progre
ss) | 1418 void TransformationMatrix::blend(const TransformationMatrix& from, double progre
ss) |
1408 { | 1419 { |
1409 if (from.isIdentity() && isIdentity()) | 1420 if (from.isIdentity() && isIdentity()) |
1410 return; | 1421 return; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 ret.setDouble(2, 2, matrix.m33()); | 1578 ret.setDouble(2, 2, matrix.m33()); |
1568 ret.setDouble(2, 3, matrix.m43()); | 1579 ret.setDouble(2, 3, matrix.m43()); |
1569 ret.setDouble(3, 0, matrix.m14()); | 1580 ret.setDouble(3, 0, matrix.m14()); |
1570 ret.setDouble(3, 1, matrix.m24()); | 1581 ret.setDouble(3, 1, matrix.m24()); |
1571 ret.setDouble(3, 2, matrix.m34()); | 1582 ret.setDouble(3, 2, matrix.m34()); |
1572 ret.setDouble(3, 3, matrix.m44()); | 1583 ret.setDouble(3, 3, matrix.m44()); |
1573 return ret; | 1584 return ret; |
1574 } | 1585 } |
1575 | 1586 |
1576 } // namespace blink | 1587 } // namespace blink |
OLD | NEW |