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 CC_MATH_UTIL_H_ | 5 #ifndef CC_MATH_UTIL_H_ |
6 #define CC_MATH_UTIL_H_ | 6 #define CC_MATH_UTIL_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "cc/cc_export.h" | 9 #include "cc/cc_export.h" |
10 #include "ui/gfx/point_f.h" | 10 #include "ui/gfx/point_f.h" |
11 #include "ui/gfx/point3_f.h" | 11 #include "ui/gfx/point3_f.h" |
12 | 12 |
13 namespace WebKit { | 13 namespace WebKit { |
14 class WebTransformationMatrix; | 14 class WebTransformationMatrix; |
15 } | 15 } |
16 | 16 |
17 namespace gfx { | 17 namespace gfx { |
18 class QuadF; | 18 class QuadF; |
19 class Rect; | 19 class Rect; |
20 class RectF; | 20 class RectF; |
| 21 class Vector2dF; |
21 } | 22 } |
22 | 23 |
23 namespace cc { | 24 namespace cc { |
24 | 25 |
25 class FloatSize; | |
26 | |
27 struct HomogeneousCoordinate { | 26 struct HomogeneousCoordinate { |
28 HomogeneousCoordinate(double newX, double newY, double newZ, double newW) | 27 HomogeneousCoordinate(double newX, double newY, double newZ, double newW) |
29 : x(newX) | 28 : x(newX) |
30 , y(newY) | 29 , y(newY) |
31 , z(newZ) | 30 , z(newZ) |
32 , w(newW) | 31 , w(newW) |
33 { | 32 { |
34 } | 33 } |
35 | 34 |
36 bool shouldBeClipped() const | 35 bool shouldBeClipped() const |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 static gfx::Point3F mapPoint(const WebKit::WebTransformationMatrix&, const g
fx::Point3F&, bool& clipped); | 96 static gfx::Point3F mapPoint(const WebKit::WebTransformationMatrix&, const g
fx::Point3F&, bool& clipped); |
98 static gfx::QuadF projectQuad(const WebKit::WebTransformationMatrix&, const
gfx::QuadF&, bool& clipped); | 97 static gfx::QuadF projectQuad(const WebKit::WebTransformationMatrix&, const
gfx::QuadF&, bool& clipped); |
99 static gfx::PointF projectPoint(const WebKit::WebTransformationMatrix&, cons
t gfx::PointF&, bool& clipped); | 98 static gfx::PointF projectPoint(const WebKit::WebTransformationMatrix&, cons
t gfx::PointF&, bool& clipped); |
100 | 99 |
101 static void flattenTransformTo2d(WebKit::WebTransformationMatrix&); | 100 static void flattenTransformTo2d(WebKit::WebTransformationMatrix&); |
102 | 101 |
103 static gfx::Vector2dF computeTransform2dScaleComponents(const WebKit::WebTra
nsformationMatrix&); | 102 static gfx::Vector2dF computeTransform2dScaleComponents(const WebKit::WebTra
nsformationMatrix&); |
104 | 103 |
105 // Returns the smallest angle between the given two vectors in degrees. Neit
her vector is | 104 // Returns the smallest angle between the given two vectors in degrees. Neit
her vector is |
106 // assumed to be normalized. | 105 // assumed to be normalized. |
107 static float smallestAngleBetweenVectors(const FloatSize&, const FloatSize&)
; | 106 static float smallestAngleBetweenVectors(gfx::Vector2dF, gfx::Vector2dF); |
108 | 107 |
109 // Projects the |source| vector onto |destination|. Neither vector is assume
d to be normalized. | 108 // Projects the |source| vector onto |destination|. Neither vector is assume
d to be normalized. |
110 static FloatSize projectVector(const FloatSize& source, const FloatSize& des
tination); | 109 static gfx::Vector2dF projectVector(gfx::Vector2dF source, gfx::Vector2dF de
stination); |
111 }; | 110 }; |
112 | 111 |
113 } // namespace cc | 112 } // namespace cc |
114 | 113 |
115 #endif // CC_MATH_UTIL_H_ | 114 #endif // CC_MATH_UTIL_H_ |
OLD | NEW |