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 "base/logging.h" |
| 9 #include "cc/cc_export.h" |
9 #include "ui/gfx/point_f.h" | 10 #include "ui/gfx/point_f.h" |
10 #include "ui/gfx/point3_f.h" | 11 #include "ui/gfx/point3_f.h" |
11 | 12 |
12 namespace WebKit { | 13 namespace WebKit { |
13 class WebTransformationMatrix; | 14 class WebTransformationMatrix; |
14 } | 15 } |
15 | 16 |
16 namespace gfx { | 17 namespace gfx { |
17 class Rect; | 18 class Rect; |
18 class RectF; | 19 class RectF; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 double invW = 1.0 / w; | 59 double invW = 1.0 / w; |
59 return gfx::Point3F(x * invW, y * invW, z * invW); | 60 return gfx::Point3F(x * invW, y * invW, z * invW); |
60 } | 61 } |
61 | 62 |
62 double x; | 63 double x; |
63 double y; | 64 double y; |
64 double z; | 65 double z; |
65 double w; | 66 double w; |
66 }; | 67 }; |
67 | 68 |
68 class MathUtil { | 69 class CC_EXPORT MathUtil { |
69 public: | 70 public: |
70 | 71 |
71 // Background: WebTransformationMatrix code in WebCore does not do the right
thing in | 72 // Background: WebTransformationMatrix code in WebCore does not do the right
thing in |
72 // mapRect / mapQuad / projectQuad when there is a perspective projection th
at causes | 73 // mapRect / mapQuad / projectQuad when there is a perspective projection th
at causes |
73 // one of the transformed vertices to go to w < 0. In those cases, it is nec
essary to | 74 // one of the transformed vertices to go to w < 0. In those cases, it is nec
essary to |
74 // perform clipping in homogeneous coordinates, after applying the transform
, before | 75 // perform clipping in homogeneous coordinates, after applying the transform
, before |
75 // dividing-by-w to convert to cartesian coordinates. | 76 // dividing-by-w to convert to cartesian coordinates. |
76 // | 77 // |
77 // These functions return the axis-aligned rect that encloses the correctly
clipped, | 78 // These functions return the axis-aligned rect that encloses the correctly
clipped, |
78 // transformed polygon. | 79 // transformed polygon. |
(...skipping 26 matching lines...) Expand all Loading... |
105 // assumed to be normalized. | 106 // assumed to be normalized. |
106 static float smallestAngleBetweenVectors(const FloatSize&, const FloatSize&)
; | 107 static float smallestAngleBetweenVectors(const FloatSize&, const FloatSize&)
; |
107 | 108 |
108 // Projects the |source| vector onto |destination|. Neither vector is assume
d to be normalized. | 109 // Projects the |source| vector onto |destination|. Neither vector is assume
d to be normalized. |
109 static FloatSize projectVector(const FloatSize& source, const FloatSize& des
tination); | 110 static FloatSize projectVector(const FloatSize& source, const FloatSize& des
tination); |
110 }; | 111 }; |
111 | 112 |
112 } // namespace cc | 113 } // namespace cc |
113 | 114 |
114 #endif // #define CCMathUtil_h | 115 #endif // #define CCMathUtil_h |
OLD | NEW |