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" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // NOTE: These functions do not do correct clipping against w = 0 plane, but
they | 99 // NOTE: These functions do not do correct clipping against w = 0 plane, but
they |
100 // correctly detect the clipped condition via the boolean clipped. | 100 // correctly detect the clipped condition via the boolean clipped. |
101 static gfx::QuadF mapQuad(const gfx::Transform&, const gfx::QuadF&, bool& cl
ipped); | 101 static gfx::QuadF mapQuad(const gfx::Transform&, const gfx::QuadF&, bool& cl
ipped); |
102 static gfx::PointF mapPoint(const gfx::Transform&, const gfx::PointF&, bool&
clipped); | 102 static gfx::PointF mapPoint(const gfx::Transform&, const gfx::PointF&, bool&
clipped); |
103 static gfx::Point3F mapPoint(const gfx::Transform&, const gfx::Point3F&, boo
l& clipped); | 103 static gfx::Point3F mapPoint(const gfx::Transform&, const gfx::Point3F&, boo
l& clipped); |
104 static gfx::QuadF projectQuad(const gfx::Transform&, const gfx::QuadF&, bool
& clipped); | 104 static gfx::QuadF projectQuad(const gfx::Transform&, const gfx::QuadF&, bool
& clipped); |
105 static gfx::PointF projectPoint(const gfx::Transform&, const gfx::PointF&, b
ool& clipped); | 105 static gfx::PointF projectPoint(const gfx::Transform&, const gfx::PointF&, b
ool& clipped); |
106 | 106 |
107 static void flattenTransformTo2d(gfx::Transform&); | 107 static void flattenTransformTo2d(gfx::Transform&); |
108 | 108 |
109 static gfx::Vector2dF computeTransform2dScaleComponents(const gfx::Transform
&); | 109 static gfx::Vector2dF computeTransform2dScaleComponents(const gfx::Transform
&, float fallbackValue); |
110 | 110 |
111 // Returns the smallest angle between the given two vectors in degrees. Neit
her vector is | 111 // Returns the smallest angle between the given two vectors in degrees. Neit
her vector is |
112 // assumed to be normalized. | 112 // assumed to be normalized. |
113 static float smallestAngleBetweenVectors(gfx::Vector2dF, gfx::Vector2dF); | 113 static float smallestAngleBetweenVectors(gfx::Vector2dF, gfx::Vector2dF); |
114 | 114 |
115 // Projects the |source| vector onto |destination|. Neither vector is assume
d to be normalized. | 115 // Projects the |source| vector onto |destination|. Neither vector is assume
d to be normalized. |
116 static gfx::Vector2dF projectVector(gfx::Vector2dF source, gfx::Vector2dF de
stination); | 116 static gfx::Vector2dF projectVector(gfx::Vector2dF source, gfx::Vector2dF de
stination); |
117 | 117 |
118 // Temporary API to ease migration from gfx::Transform | 118 // Temporary API to ease migration from gfx::Transform |
119 // to gfx::Transform. | 119 // to gfx::Transform. |
120 // | 120 // |
121 // TODO(shawnsingh, vollick) we should phase out as much as possible of | 121 // TODO(shawnsingh, vollick) we should phase out as much as possible of |
122 // these temporary functions, putting functionality into gfx::Transform. | 122 // these temporary functions, putting functionality into gfx::Transform. |
123 static void rotateEulerAngles(gfx::Transform*, double eulerX, double eulerY,
double eulerZ); | 123 static void rotateEulerAngles(gfx::Transform*, double eulerX, double eulerY,
double eulerZ); |
124 static gfx::Transform inverse(const gfx::Transform&); | 124 static gfx::Transform inverse(const gfx::Transform&); |
125 static gfx::Transform to2dTransform(const gfx::Transform&); | 125 static gfx::Transform to2dTransform(const gfx::Transform&); |
126 // Note carefully: the args here are labeled as per Webcore indexing convent
ions. | 126 // Note carefully: the args here are labeled as per Webcore indexing convent
ions. |
127 static gfx::Transform createGfxTransform(double m11, double m12, double m13,
double m14, | 127 static gfx::Transform createGfxTransform(double m11, double m12, double m13,
double m14, |
128 double m21, double m22, double m23,
double m24, | 128 double m21, double m22, double m23,
double m24, |
129 double m31, double m32, double m33,
double m34, | 129 double m31, double m32, double m33,
double m34, |
130 double m41, double m42, double m43,
double m44); | 130 double m41, double m42, double m43,
double m44); |
131 | 131 |
132 static gfx::Transform createGfxTransform(double a, double b, double c, | 132 static gfx::Transform createGfxTransform(double a, double b, double c, |
133 double d, double e, double f); | 133 double d, double e, double f); |
134 }; | 134 }; |
135 | 135 |
136 } // namespace cc | 136 } // namespace cc |
137 | 137 |
138 #endif // CC_MATH_UTIL_H_ | 138 #endif // CC_MATH_UTIL_H_ |
OLD | NEW |