Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(945)

Side by Side Diff: cc/math_util.h

Issue 11189043: cc: Rename cc classes and members to match filenames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "FloatPoint.h" 8 #include "FloatPoint.h"
9 #include "FloatPoint3D.h" 9 #include "FloatPoint3D.h"
10 10
(...skipping 19 matching lines...) Expand all
30 bool shouldBeClipped() const 30 bool shouldBeClipped() const
31 { 31 {
32 return w <= 0; 32 return w <= 0;
33 } 33 }
34 34
35 FloatPoint cartesianPoint2d() const 35 FloatPoint cartesianPoint2d() const
36 { 36 {
37 if (w == 1) 37 if (w == 1)
38 return FloatPoint(x, y); 38 return FloatPoint(x, y);
39 39
40 // For now, because this code is used privately only by CCMathUtil, it s hould never be called when w == 0, and we do not yet need to handle that case. 40 // For now, because this code is used privately only by MathUtil, it sho uld never be called when w == 0, and we do not yet need to handle that case.
41 ASSERT(w); 41 ASSERT(w);
42 double invW = 1.0 / w; 42 double invW = 1.0 / w;
43 return FloatPoint(x * invW, y * invW); 43 return FloatPoint(x * invW, y * invW);
44 } 44 }
45 45
46 FloatPoint3D cartesianPoint3d() const 46 FloatPoint3D cartesianPoint3d() const
47 { 47 {
48 if (w == 1) 48 if (w == 1)
49 return FloatPoint3D(x, y, z); 49 return FloatPoint3D(x, y, z);
50 50
51 // For now, because this code is used privately only by CCMathUtil, it s hould never be called when w == 0, and we do not yet need to handle that case. 51 // For now, because this code is used privately only by MathUtil, it sho uld never be called when w == 0, and we do not yet need to handle that case.
52 ASSERT(w); 52 ASSERT(w);
53 double invW = 1.0 / w; 53 double invW = 1.0 / w;
54 return FloatPoint3D(x * invW, y * invW, z * invW); 54 return FloatPoint3D(x * invW, y * invW, z * invW);
55 } 55 }
56 56
57 double x; 57 double x;
58 double y; 58 double y;
59 double z; 59 double z;
60 double w; 60 double w;
61 }; 61 };
62 62
63 class CCMathUtil { 63 class MathUtil {
64 public: 64 public:
65 65
66 // Background: WebTransformationMatrix code in WebCore does not do the right thing in 66 // Background: WebTransformationMatrix code in WebCore does not do the right thing in
67 // mapRect / mapQuad / projectQuad when there is a perspective projection th at causes 67 // mapRect / mapQuad / projectQuad when there is a perspective projection th at causes
68 // one of the transformed vertices to go to w < 0. In those cases, it is nec essary to 68 // one of the transformed vertices to go to w < 0. In those cases, it is nec essary to
69 // perform clipping in homogeneous coordinates, after applying the transform , before 69 // perform clipping in homogeneous coordinates, after applying the transform , before
70 // dividing-by-w to convert to cartesian coordinates. 70 // dividing-by-w to convert to cartesian coordinates.
71 // 71 //
72 // These functions return the axis-aligned rect that encloses the correctly clipped, 72 // These functions return the axis-aligned rect that encloses the correctly clipped,
73 // transformed polygon. 73 // transformed polygon.
(...skipping 24 matching lines...) Expand all
98 // assumed to be normalized. 98 // assumed to be normalized.
99 static float smallestAngleBetweenVectors(const FloatSize&, const FloatSize&) ; 99 static float smallestAngleBetweenVectors(const FloatSize&, const FloatSize&) ;
100 100
101 // Projects the |source| vector onto |destination|. Neither vector is assume d to be normalized. 101 // Projects the |source| vector onto |destination|. Neither vector is assume d to be normalized.
102 static FloatSize projectVector(const FloatSize& source, const FloatSize& des tination); 102 static FloatSize projectVector(const FloatSize& source, const FloatSize& des tination);
103 }; 103 };
104 104
105 } // namespace cc 105 } // namespace cc
106 106
107 #endif // #define CCMathUtil_h 107 #endif // #define CCMathUtil_h
OLDNEW
« cc/active_animation.h ('K') | « cc/layer_unittest.cc ('k') | cc/math_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698