Chromium Code Reviews| 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 AffineTransform& t) | |
| 69 { | |
| 70 return adoptPtr(new TransformationMatrix(t)); | |
| 71 } | |
| 72 static PassOwnPtr<TransformationMatrix> create(const TransformationMatrix& t ) | |
| 73 { | |
| 74 return adoptPtr(new TransformationMatrix(t)); | |
| 75 } | |
| 76 static PassOwnPtr<TransformationMatrix> create(double a, double b, double c, double d, double e, double f) | |
| 77 { | |
| 78 return adoptPtr(new TransformationMatrix(a, b, c, d, e, f)); | |
| 79 } | |
| 80 static PassOwnPtr<TransformationMatrix> create(double m11, double m12, doubl e m13, double m14, | |
| 81 double m21, double m22, double m23, double m24, | |
| 82 double m31, double m32, double m33, double m34, | |
| 83 double m41, double m42, double m43, double m44) | |
| 84 { | |
| 85 return adoptPtr(new TransformationMatrix(m11, m12, m13, m14, m21, m22, m 23, m24, m31, m32, m33, m34, m41, m42, m43, m44)); | |
| 86 } | |
|
alancutter (OOO until 2018)
2016/02/08 04:29:52
Are all these needed? Can we omit any that aren't
tridgell
2016/02/08 05:30:54
Done. Removed. The only unused one was create(co
| |
| 87 | |
| 63 TransformationMatrix() | 88 TransformationMatrix() |
| 64 { | 89 { |
| 65 checkAlignment(); | 90 checkAlignment(); |
| 66 makeIdentity(); | 91 makeIdentity(); |
| 67 } | 92 } |
| 68 TransformationMatrix(const AffineTransform&); | 93 TransformationMatrix(const AffineTransform&); |
| 69 TransformationMatrix(const TransformationMatrix& t) | 94 TransformationMatrix(const TransformationMatrix& t) |
| 70 { | 95 { |
| 71 checkAlignment(); | 96 checkAlignment(); |
| 72 *this = t; | 97 *this = t; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 Matrix4 m_matrix; | 423 Matrix4 m_matrix; |
| 399 }; | 424 }; |
| 400 | 425 |
| 401 // Redeclared here to avoid ODR issues. | 426 // Redeclared here to avoid ODR issues. |
| 402 // See platform/testing/TransformPrinters.h. | 427 // See platform/testing/TransformPrinters.h. |
| 403 void PrintTo(const TransformationMatrix&, std::ostream*); | 428 void PrintTo(const TransformationMatrix&, std::ostream*); |
| 404 | 429 |
| 405 } // namespace blink | 430 } // namespace blink |
| 406 | 431 |
| 407 #endif // TransformationMatrix_h | 432 #endif // TransformationMatrix_h |
| OLD | NEW |