| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #define TRANSFORMATION_MATRIX_USE_X86_64_SSE2 | 47 #define TRANSFORMATION_MATRIX_USE_X86_64_SSE2 |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 // TransformationMatrix must not be allocated on Oilpan's heap since | 50 // TransformationMatrix must not be allocated on Oilpan's heap since |
| 51 // Oilpan doesn't (yet) have an ability to allocate the TransformationMatrix | 51 // Oilpan doesn't (yet) have an ability to allocate the TransformationMatrix |
| 52 // with 16-byte alignment. PartitionAlloc has the ability. | 52 // with 16-byte alignment. PartitionAlloc has the ability. |
| 53 class PLATFORM_EXPORT TransformationMatrix { | 53 class PLATFORM_EXPORT TransformationMatrix { |
| 54 USING_FAST_MALLOC(TransformationMatrix); | 54 USING_FAST_MALLOC(TransformationMatrix); |
| 55 public: | 55 public: |
| 56 | 56 |
| 57 #if CPU(APPLE_ARMV7S) || defined(TRANSFORMATION_MATRIX_USE_X86_64_SSE2) | 57 #if defined(TRANSFORMATION_MATRIX_USE_X86_64_SSE2) |
| 58 typedef WTF_ALIGNED(double, Matrix4[4][4], 16); | 58 typedef WTF_ALIGNED(double, Matrix4[4][4], 16); |
| 59 #else | 59 #else |
| 60 typedef double Matrix4[4][4]; | 60 typedef double Matrix4[4][4]; |
| 61 #endif | 61 #endif |
| 62 | 62 |
| 63 TransformationMatrix() | 63 TransformationMatrix() |
| 64 { | 64 { |
| 65 checkAlignment(); | 65 checkAlignment(); |
| 66 makeIdentity(); | 66 makeIdentity(); |
| 67 } | 67 } |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 } | 381 } |
| 382 | 382 |
| 383 void setMatrix(const Matrix4 m) | 383 void setMatrix(const Matrix4 m) |
| 384 { | 384 { |
| 385 if (m && m != m_matrix) | 385 if (m && m != m_matrix) |
| 386 memcpy(m_matrix, m, sizeof(Matrix4)); | 386 memcpy(m_matrix, m, sizeof(Matrix4)); |
| 387 } | 387 } |
| 388 | 388 |
| 389 void checkAlignment() | 389 void checkAlignment() |
| 390 { | 390 { |
| 391 #if CPU(APPLE_ARMV7S) || defined(TRANSFORMATION_MATRIX_USE_X86_64_SSE2) | 391 #if defined(TRANSFORMATION_MATRIX_USE_X86_64_SSE2) |
| 392 // m_matrix can cause this class to require higher than usual alignment. | 392 // m_matrix can cause this class to require higher than usual alignment. |
| 393 // Make sure the allocator handles this. | 393 // Make sure the allocator handles this. |
| 394 ASSERT((reinterpret_cast<uintptr_t>(this) & (WTF_ALIGN_OF(Transformation
Matrix) - 1)) == 0); | 394 ASSERT((reinterpret_cast<uintptr_t>(this) & (WTF_ALIGN_OF(Transformation
Matrix) - 1)) == 0); |
| 395 #endif | 395 #endif |
| 396 } | 396 } |
| 397 | 397 |
| 398 Matrix4 m_matrix; | 398 Matrix4 m_matrix; |
| 399 }; | 399 }; |
| 400 | 400 |
| 401 // Redeclared here to avoid ODR issues. | 401 // Redeclared here to avoid ODR issues. |
| 402 // See platform/testing/TransformPrinters.h. | 402 // See platform/testing/TransformPrinters.h. |
| 403 void PrintTo(const TransformationMatrix&, std::ostream*); | 403 void PrintTo(const TransformationMatrix&, std::ostream*); |
| 404 | 404 |
| 405 } // namespace blink | 405 } // namespace blink |
| 406 | 406 |
| 407 #endif // TransformationMatrix_h | 407 #endif // TransformationMatrix_h |
| OLD | NEW |