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 #include "ui/gfx/transform.h" |
12 | 13 |
13 namespace WebKit { | 14 namespace WebKit { |
14 class WebTransformationMatrix; | 15 class WebTransformationMatrix; |
15 } | 16 } |
16 | 17 |
17 namespace gfx { | 18 namespace gfx { |
18 class QuadF; | 19 class QuadF; |
19 class Rect; | 20 class Rect; |
20 class RectF; | 21 class RectF; |
21 class Vector2dF; | 22 class Vector2dF; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 static void flattenTransformTo2d(WebKit::WebTransformationMatrix&); | 109 static void flattenTransformTo2d(WebKit::WebTransformationMatrix&); |
109 | 110 |
110 static gfx::Vector2dF computeTransform2dScaleComponents(const WebKit::WebTra
nsformationMatrix&); | 111 static gfx::Vector2dF computeTransform2dScaleComponents(const WebKit::WebTra
nsformationMatrix&); |
111 | 112 |
112 // Returns the smallest angle between the given two vectors in degrees. Neit
her vector is | 113 // Returns the smallest angle between the given two vectors in degrees. Neit
her vector is |
113 // assumed to be normalized. | 114 // assumed to be normalized. |
114 static float smallestAngleBetweenVectors(gfx::Vector2dF, gfx::Vector2dF); | 115 static float smallestAngleBetweenVectors(gfx::Vector2dF, gfx::Vector2dF); |
115 | 116 |
116 // Projects the |source| vector onto |destination|. Neither vector is assume
d to be normalized. | 117 // Projects the |source| vector onto |destination|. Neither vector is assume
d to be normalized. |
117 static gfx::Vector2dF projectVector(gfx::Vector2dF source, gfx::Vector2dF de
stination); | 118 static gfx::Vector2dF projectVector(gfx::Vector2dF source, gfx::Vector2dF de
stination); |
| 119 |
| 120 // Temporary API to ease migration from WebKit::WebTransformationMatrix |
| 121 // to gfx::Transform. |
| 122 // |
| 123 // TODO(shawnsingh, vollick) we should phase out as much as possible of |
| 124 // these temporary functions, putting functionality into gfx::Transform. |
| 125 static bool isInvertible(const gfx::Transform&); |
| 126 static bool isBackFaceVisible(const gfx::Transform&); |
| 127 static bool isIdentity(const gfx::Transform&); |
| 128 static bool isIdentityOrTranslation(const gfx::Transform&); |
| 129 static bool hasPerspective(const gfx::Transform&); |
| 130 static void makeIdentity(gfx::Transform*); |
| 131 static void rotateEulerAngles(gfx::Transform*, double eulerX, double eulerY,
double eulerZ); |
| 132 static void rotateAxisAngle(gfx::Transform*, double i, double j, double k, d
ouble degrees); |
| 133 static gfx::Transform inverse(const gfx::Transform&); |
| 134 static gfx::Transform to2dTransform(const gfx::Transform&); |
| 135 static gfx::Transform toGfxTransform(const WebKit::WebTransformationMatrix&)
; |
| 136 // Note carefully: the args here are labeled as per Webcore indexing convent
ions. |
| 137 static gfx::Transform createGfxTransform(double m11, double m12, double m13,
double m14, |
| 138 double m21, double m22, double m23,
double m24, |
| 139 double m31, double m32, double m33,
double m34, |
| 140 double m41, double m42, double m43,
double m44); |
| 141 |
| 142 static gfx::Transform createGfxTransform(double a, double b, double c, |
| 143 double d, double e, double f); |
118 }; | 144 }; |
119 | 145 |
| 146 // TODO(shawnsingh, vollick) this is a temporary home, should eventually |
| 147 // be phased out in favor of gfx::Transform API. |
| 148 gfx::Transform operator*(const gfx::Transform&, const gfx::Transform&); |
| 149 |
120 } // namespace cc | 150 } // namespace cc |
121 | 151 |
122 #endif // CC_MATH_UTIL_H_ | 152 #endif // CC_MATH_UTIL_H_ |
OLD | NEW |