| 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 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #ifndef TransformationMatrix_h | 26 #ifndef TransformationMatrix_h |
| 27 #define TransformationMatrix_h | 27 #define TransformationMatrix_h |
| 28 | 28 |
| 29 #include "SkMatrix44.h" | 29 #include "SkMatrix44.h" |
| 30 #include "platform/geometry/FloatPoint.h" | 30 #include "platform/geometry/FloatPoint.h" |
| 31 #include "platform/geometry/FloatPoint3D.h" | 31 #include "platform/geometry/FloatPoint3D.h" |
| 32 #include "wtf/Alignment.h" | 32 #include "wtf/Alignment.h" |
| 33 #include "wtf/Allocator.h" | 33 #include "wtf/Allocator.h" |
| 34 #include "wtf/CPU.h" | 34 #include "wtf/CPU.h" |
| 35 #include "wtf/PassOwnPtr.h" | 35 #include "wtf/PtrUtil.h" |
| 36 #include <memory> |
| 36 #include <string.h> // for memcpy | 37 #include <string.h> // for memcpy |
| 37 | 38 |
| 38 namespace blink { | 39 namespace blink { |
| 39 | 40 |
| 40 class AffineTransform; | 41 class AffineTransform; |
| 41 class IntRect; | 42 class IntRect; |
| 42 class LayoutRect; | 43 class LayoutRect; |
| 43 class FloatRect; | 44 class FloatRect; |
| 44 class FloatQuad; | 45 class FloatQuad; |
| 45 class FloatBox; | 46 class FloatBox; |
| 46 struct Rotation; | 47 struct Rotation; |
| 47 #if CPU(X86_64) | 48 #if CPU(X86_64) |
| 48 #define TRANSFORMATION_MATRIX_USE_X86_64_SSE2 | 49 #define TRANSFORMATION_MATRIX_USE_X86_64_SSE2 |
| 49 #endif | 50 #endif |
| 50 | 51 |
| 51 // TransformationMatrix must not be allocated on Oilpan's heap since | 52 // TransformationMatrix must not be allocated on Oilpan's heap since |
| 52 // Oilpan doesn't (yet) have an ability to allocate the TransformationMatrix | 53 // Oilpan doesn't (yet) have an ability to allocate the TransformationMatrix |
| 53 // with 16-byte alignment. PartitionAlloc has the ability. | 54 // with 16-byte alignment. PartitionAlloc has the ability. |
| 54 class PLATFORM_EXPORT TransformationMatrix { | 55 class PLATFORM_EXPORT TransformationMatrix { |
| 55 USING_FAST_MALLOC(TransformationMatrix); | 56 USING_FAST_MALLOC(TransformationMatrix); |
| 56 public: | 57 public: |
| 57 | 58 |
| 58 #if defined(TRANSFORMATION_MATRIX_USE_X86_64_SSE2) | 59 #if defined(TRANSFORMATION_MATRIX_USE_X86_64_SSE2) |
| 59 typedef WTF_ALIGNED(double, Matrix4[4][4], 16); | 60 typedef WTF_ALIGNED(double, Matrix4[4][4], 16); |
| 60 #else | 61 #else |
| 61 typedef double Matrix4[4][4]; | 62 typedef double Matrix4[4][4]; |
| 62 #endif | 63 #endif |
| 63 | 64 |
| 64 static PassOwnPtr<TransformationMatrix> create() | 65 static std::unique_ptr<TransformationMatrix> create() |
| 65 { | 66 { |
| 66 return adoptPtr(new TransformationMatrix()); | 67 return wrapUnique(new TransformationMatrix()); |
| 67 } | 68 } |
| 68 static PassOwnPtr<TransformationMatrix> create(const TransformationMatrix& t
) | 69 static std::unique_ptr<TransformationMatrix> create(const TransformationMatr
ix& t) |
| 69 { | 70 { |
| 70 return adoptPtr(new TransformationMatrix(t)); | 71 return wrapUnique(new TransformationMatrix(t)); |
| 71 } | 72 } |
| 72 static PassOwnPtr<TransformationMatrix> create(double a, double b, double c,
double d, double e, double f) | 73 static std::unique_ptr<TransformationMatrix> create(double a, double b, doub
le c, double d, double e, double f) |
| 73 { | 74 { |
| 74 return adoptPtr(new TransformationMatrix(a, b, c, d, e, f)); | 75 return wrapUnique(new TransformationMatrix(a, b, c, d, e, f)); |
| 75 } | 76 } |
| 76 static PassOwnPtr<TransformationMatrix> create(double m11, double m12, doubl
e m13, double m14, | 77 static std::unique_ptr<TransformationMatrix> create(double m11, double m12,
double m13, double m14, |
| 77 double m21, double m22, double m23, double m24, | 78 double m21, double m22, double m23, double m24, |
| 78 double m31, double m32, double m33, double m34, | 79 double m31, double m32, double m33, double m34, |
| 79 double m41, double m42, double m43, double m44) | 80 double m41, double m42, double m43, double m44) |
| 80 { | 81 { |
| 81 return adoptPtr(new TransformationMatrix(m11, m12, m13, m14, m21, m22, m
23, m24, m31, m32, m33, m34, m41, m42, m43, m44)); | 82 return wrapUnique(new TransformationMatrix(m11, m12, m13, m14, m21, m22,
m23, m24, m31, m32, m33, m34, m41, m42, m43, m44)); |
| 82 } | 83 } |
| 83 | 84 |
| 84 TransformationMatrix() | 85 TransformationMatrix() |
| 85 { | 86 { |
| 86 checkAlignment(); | 87 checkAlignment(); |
| 87 makeIdentity(); | 88 makeIdentity(); |
| 88 } | 89 } |
| 89 TransformationMatrix(const AffineTransform&); | 90 TransformationMatrix(const AffineTransform&); |
| 90 TransformationMatrix(const TransformationMatrix& t) | 91 TransformationMatrix(const TransformationMatrix& t) |
| 91 { | 92 { |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 Matrix4 m_matrix; | 433 Matrix4 m_matrix; |
| 433 }; | 434 }; |
| 434 | 435 |
| 435 // Redeclared here to avoid ODR issues. | 436 // Redeclared here to avoid ODR issues. |
| 436 // See platform/testing/TransformPrinters.h. | 437 // See platform/testing/TransformPrinters.h. |
| 437 void PrintTo(const TransformationMatrix&, std::ostream*); | 438 void PrintTo(const TransformationMatrix&, std::ostream*); |
| 438 | 439 |
| 439 } // namespace blink | 440 } // namespace blink |
| 440 | 441 |
| 441 #endif // TransformationMatrix_h | 442 #endif // TransformationMatrix_h |
| OLD | NEW |