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