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