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 15 matching lines...) Expand all Loading... |
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 "platform/geometry/IntPoint.h" | 32 #include "platform/geometry/IntPoint.h" |
33 #include "wtf/Alignment.h" | 33 #include "wtf/Alignment.h" |
34 #include "wtf/Allocator.h" | 34 #include "wtf/Allocator.h" |
35 #include "wtf/CPU.h" | 35 #include "wtf/CPU.h" |
| 36 #include "wtf/PassOwnPtr.h" |
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 #if CPU(X86_64) | 47 #if CPU(X86_64) |
47 #define TRANSFORMATION_MATRIX_USE_X86_64_SSE2 | 48 #define TRANSFORMATION_MATRIX_USE_X86_64_SSE2 |
48 #endif | 49 #endif |
49 | 50 |
50 // TransformationMatrix must not be allocated on Oilpan's heap since | 51 // TransformationMatrix must not be allocated on Oilpan's heap since |
51 // Oilpan doesn't (yet) have an ability to allocate the TransformationMatrix | 52 // Oilpan doesn't (yet) have an ability to allocate the TransformationMatrix |
52 // with 16-byte alignment. PartitionAlloc has the ability. | 53 // with 16-byte alignment. PartitionAlloc has the ability. |
53 class PLATFORM_EXPORT TransformationMatrix { | 54 class PLATFORM_EXPORT TransformationMatrix { |
54 USING_FAST_MALLOC(TransformationMatrix); | 55 USING_FAST_MALLOC(TransformationMatrix); |
55 public: | 56 public: |
56 | 57 |
57 #if defined(TRANSFORMATION_MATRIX_USE_X86_64_SSE2) | 58 #if defined(TRANSFORMATION_MATRIX_USE_X86_64_SSE2) |
58 typedef WTF_ALIGNED(double, Matrix4[4][4], 16); | 59 typedef WTF_ALIGNED(double, Matrix4[4][4], 16); |
59 #else | 60 #else |
60 typedef double Matrix4[4][4]; | 61 typedef double Matrix4[4][4]; |
61 #endif | 62 #endif |
62 | 63 |
| 64 static PassOwnPtr<TransformationMatrix> create() |
| 65 { |
| 66 return adoptPtr(new TransformationMatrix()); |
| 67 } |
| 68 static PassOwnPtr<TransformationMatrix> create(const TransformationMatrix& t
) |
| 69 { |
| 70 return adoptPtr(new TransformationMatrix(t)); |
| 71 } |
| 72 static PassOwnPtr<TransformationMatrix> create(double a, double b, double c,
double d, double e, double f) |
| 73 { |
| 74 return adoptPtr(new TransformationMatrix(a, b, c, d, e, f)); |
| 75 } |
| 76 static PassOwnPtr<TransformationMatrix> create(double m11, double m12, doubl
e m13, double m14, |
| 77 double m21, double m22, double m23, double m24, |
| 78 double m31, double m32, double m33, double m34, |
| 79 double m41, double m42, double m43, double m44) |
| 80 { |
| 81 return adoptPtr(new TransformationMatrix(m11, m12, m13, m14, m21, m22, m
23, m24, m31, m32, m33, m34, m41, m42, m43, m44)); |
| 82 } |
| 83 |
63 TransformationMatrix() | 84 TransformationMatrix() |
64 { | 85 { |
65 checkAlignment(); | 86 checkAlignment(); |
66 makeIdentity(); | 87 makeIdentity(); |
67 } | 88 } |
68 TransformationMatrix(const AffineTransform&); | 89 TransformationMatrix(const AffineTransform&); |
69 TransformationMatrix(const TransformationMatrix& t) | 90 TransformationMatrix(const TransformationMatrix& t) |
70 { | 91 { |
71 checkAlignment(); | 92 checkAlignment(); |
72 *this = t; | 93 *this = t; |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 Matrix4 m_matrix; | 419 Matrix4 m_matrix; |
399 }; | 420 }; |
400 | 421 |
401 // Redeclared here to avoid ODR issues. | 422 // Redeclared here to avoid ODR issues. |
402 // See platform/testing/TransformPrinters.h. | 423 // See platform/testing/TransformPrinters.h. |
403 void PrintTo(const TransformationMatrix&, std::ostream*); | 424 void PrintTo(const TransformationMatrix&, std::ostream*); |
404 | 425 |
405 } // namespace blink | 426 } // namespace blink |
406 | 427 |
407 #endif // TransformationMatrix_h | 428 #endif // TransformationMatrix_h |
OLD | NEW |