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 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 m_matrix[1][2] == 0 && m_matrix[1][3] == 0 && m_matrix[2][0] == 0 && | 213 m_matrix[1][2] == 0 && m_matrix[1][3] == 0 && m_matrix[2][0] == 0 && |
214 m_matrix[2][1] == 0 && m_matrix[2][2] == 1 && m_matrix[2][3] == 0 && | 214 m_matrix[2][1] == 0 && m_matrix[2][2] == 1 && m_matrix[2][3] == 0 && |
215 m_matrix[3][0] == 0 && m_matrix[3][1] == 0 && m_matrix[3][2] == 0 && | 215 m_matrix[3][0] == 0 && m_matrix[3][1] == 0 && m_matrix[3][2] == 0 && |
216 m_matrix[3][3] == 1; | 216 m_matrix[3][3] == 1; |
217 } | 217 } |
218 | 218 |
219 // Map a 3D point through the transform, returning a 3D point. | 219 // Map a 3D point through the transform, returning a 3D point. |
220 FloatPoint3D mapPoint(const FloatPoint3D&) const; | 220 FloatPoint3D mapPoint(const FloatPoint3D&) const; |
221 | 221 |
222 // Map a 2D point through the transform, returning a 2D point. | 222 // Map a 2D point through the transform, returning a 2D point. |
223 // Note that this ignores the z component, effectively projecting the point in
to the z=0 plane. | 223 // Note that this ignores the z component, effectively projecting the point |
| 224 // into the z=0 plane. |
224 FloatPoint mapPoint(const FloatPoint&) const; | 225 FloatPoint mapPoint(const FloatPoint&) const; |
225 | 226 |
226 // If the matrix has 3D components, the z component of the result is | 227 // If the matrix has 3D components, the z component of the result is |
227 // dropped, effectively projecting the rect into the z=0 plane | 228 // dropped, effectively projecting the rect into the z=0 plane |
228 FloatRect mapRect(const FloatRect&) const; | 229 FloatRect mapRect(const FloatRect&) const; |
229 | 230 |
230 // Rounds the resulting mapped rectangle out. This is helpful for bounding | 231 // Rounds the resulting mapped rectangle out. This is helpful for bounding |
231 // box computations but may not be what is wanted in other contexts. | 232 // box computations but may not be what is wanted in other contexts. |
232 IntRect mapRect(const IntRect&) const; | 233 IntRect mapRect(const IntRect&) const; |
233 LayoutRect mapRect(const LayoutRect&) const; | 234 LayoutRect mapRect(const LayoutRect&) const; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 return m13() == 0 && m14() == 0 && m23() == 0 && m24() == 0 && m31() == 0 && | 361 return m13() == 0 && m14() == 0 && m23() == 0 && m24() == 0 && m31() == 0 && |
361 m32() == 0 && m33() == 1 && m34() == 0 && m43() == 0 && m44() == 1; | 362 m32() == 0 && m33() == 1 && m34() == 0 && m43() == 0 && m44() == 1; |
362 } | 363 } |
363 | 364 |
364 // Throw away the non-affine parts of the matrix (lossy!) | 365 // Throw away the non-affine parts of the matrix (lossy!) |
365 void makeAffine(); | 366 void makeAffine(); |
366 | 367 |
367 AffineTransform toAffineTransform() const; | 368 AffineTransform toAffineTransform() const; |
368 | 369 |
369 // Flatten into a 2-D transformation (non-invertable). | 370 // Flatten into a 2-D transformation (non-invertable). |
370 // Same as gfx::Transform::FlattenTo2d(); see the docs for that function for d
etails and discussion. | 371 // Same as gfx::Transform::FlattenTo2d(); see the docs for that function for |
| 372 // details and discussion. |
371 void flattenTo2d(); | 373 void flattenTo2d(); |
372 | 374 |
373 bool operator==(const TransformationMatrix& m2) const { | 375 bool operator==(const TransformationMatrix& m2) const { |
374 return m_matrix[0][0] == m2.m_matrix[0][0] && | 376 return m_matrix[0][0] == m2.m_matrix[0][0] && |
375 m_matrix[0][1] == m2.m_matrix[0][1] && | 377 m_matrix[0][1] == m2.m_matrix[0][1] && |
376 m_matrix[0][2] == m2.m_matrix[0][2] && | 378 m_matrix[0][2] == m2.m_matrix[0][2] && |
377 m_matrix[0][3] == m2.m_matrix[0][3] && | 379 m_matrix[0][3] == m2.m_matrix[0][3] && |
378 m_matrix[1][0] == m2.m_matrix[1][0] && | 380 m_matrix[1][0] == m2.m_matrix[1][0] && |
379 m_matrix[1][1] == m2.m_matrix[1][1] && | 381 m_matrix[1][1] == m2.m_matrix[1][1] && |
380 m_matrix[1][2] == m2.m_matrix[1][2] && | 382 m_matrix[1][2] == m2.m_matrix[1][2] && |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 Matrix4 m_matrix; | 479 Matrix4 m_matrix; |
478 }; | 480 }; |
479 | 481 |
480 // Redeclared here to avoid ODR issues. | 482 // Redeclared here to avoid ODR issues. |
481 // See platform/testing/TransformPrinters.h. | 483 // See platform/testing/TransformPrinters.h. |
482 void PrintTo(const TransformationMatrix&, std::ostream*); | 484 void PrintTo(const TransformationMatrix&, std::ostream*); |
483 | 485 |
484 } // namespace blink | 486 } // namespace blink |
485 | 487 |
486 #endif // TransformationMatrix_h | 488 #endif // TransformationMatrix_h |
OLD | NEW |