OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CCMathUtil_h | 5 #ifndef CCMathUtil_h |
6 #define CCMathUtil_h | 6 #define CCMathUtil_h |
7 | 7 |
| 8 #include "base/logging.h" |
8 #include "FloatPoint.h" | 9 #include "FloatPoint.h" |
9 #include "FloatPoint3D.h" | 10 #include "FloatPoint3D.h" |
10 | 11 |
11 namespace WebKit { | 12 namespace WebKit { |
12 class WebTransformationMatrix; | 13 class WebTransformationMatrix; |
13 } | 14 } |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 | 17 |
17 class IntRect; | 18 class IntRect; |
(...skipping 13 matching lines...) Expand all Loading... |
31 { | 32 { |
32 return w <= 0; | 33 return w <= 0; |
33 } | 34 } |
34 | 35 |
35 FloatPoint cartesianPoint2d() const | 36 FloatPoint cartesianPoint2d() const |
36 { | 37 { |
37 if (w == 1) | 38 if (w == 1) |
38 return FloatPoint(x, y); | 39 return FloatPoint(x, y); |
39 | 40 |
40 // For now, because this code is used privately only by CCMathUtil, it s
hould never be called when w == 0, and we do not yet need to handle that case. | 41 // For now, because this code is used privately only by CCMathUtil, it s
hould never be called when w == 0, and we do not yet need to handle that case. |
41 ASSERT(w); | 42 DCHECK(w); |
42 double invW = 1.0 / w; | 43 double invW = 1.0 / w; |
43 return FloatPoint(x * invW, y * invW); | 44 return FloatPoint(x * invW, y * invW); |
44 } | 45 } |
45 | 46 |
46 FloatPoint3D cartesianPoint3d() const | 47 FloatPoint3D cartesianPoint3d() const |
47 { | 48 { |
48 if (w == 1) | 49 if (w == 1) |
49 return FloatPoint3D(x, y, z); | 50 return FloatPoint3D(x, y, z); |
50 | 51 |
51 // For now, because this code is used privately only by CCMathUtil, it s
hould never be called when w == 0, and we do not yet need to handle that case. | 52 // For now, because this code is used privately only by CCMathUtil, it s
hould never be called when w == 0, and we do not yet need to handle that case. |
52 ASSERT(w); | 53 DCHECK(w); |
53 double invW = 1.0 / w; | 54 double invW = 1.0 / w; |
54 return FloatPoint3D(x * invW, y * invW, z * invW); | 55 return FloatPoint3D(x * invW, y * invW, z * invW); |
55 } | 56 } |
56 | 57 |
57 double x; | 58 double x; |
58 double y; | 59 double y; |
59 double z; | 60 double z; |
60 double w; | 61 double w; |
61 }; | 62 }; |
62 | 63 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // assumed to be normalized. | 99 // assumed to be normalized. |
99 static float smallestAngleBetweenVectors(const FloatSize&, const FloatSize&)
; | 100 static float smallestAngleBetweenVectors(const FloatSize&, const FloatSize&)
; |
100 | 101 |
101 // Projects the |source| vector onto |destination|. Neither vector is assume
d to be normalized. | 102 // Projects the |source| vector onto |destination|. Neither vector is assume
d to be normalized. |
102 static FloatSize projectVector(const FloatSize& source, const FloatSize& des
tination); | 103 static FloatSize projectVector(const FloatSize& source, const FloatSize& des
tination); |
103 }; | 104 }; |
104 | 105 |
105 } // namespace cc | 106 } // namespace cc |
106 | 107 |
107 #endif // #define CCMathUtil_h | 108 #endif // #define CCMathUtil_h |
OLD | NEW |