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

Side by Side Diff: cc/math_util.h

Issue 11364044: cc: Replace WebCore::FloatQuad with gfx::QuadF. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reeebase. Created 8 years, 1 month 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
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/math_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/logging.h" 8 #include "base/logging.h"
9 #include "ui/gfx/point_f.h" 9 #include "ui/gfx/point_f.h"
10 #include "ui/gfx/point3_f.h" 10 #include "ui/gfx/point3_f.h"
11 11
12 namespace WebKit { 12 namespace WebKit {
13 class WebTransformationMatrix; 13 class WebTransformationMatrix;
14 } 14 }
15 15
16 namespace gfx { 16 namespace gfx {
17 class QuadF;
17 class Rect; 18 class Rect;
18 class RectF; 19 class RectF;
19 } 20 }
20 21
21 namespace cc { 22 namespace cc {
22 23
23 class FloatQuad;
24 class FloatSize; 24 class FloatSize;
25 25
26 struct HomogeneousCoordinate { 26 struct HomogeneousCoordinate {
27 HomogeneousCoordinate(double newX, double newY, double newZ, double newW) 27 HomogeneousCoordinate(double newX, double newY, double newZ, double newW)
28 : x(newX) 28 : x(newX)
29 , y(newY) 29 , y(newY)
30 , z(newZ) 30 , z(newZ)
31 , w(newW) 31 , w(newW)
32 { 32 {
33 } 33 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // These functions return the axis-aligned rect that encloses the correctly clipped, 77 // These functions return the axis-aligned rect that encloses the correctly clipped,
78 // transformed polygon. 78 // transformed polygon.
79 static gfx::Rect mapClippedRect(const WebKit::WebTransformationMatrix&, cons t gfx::Rect&); 79 static gfx::Rect mapClippedRect(const WebKit::WebTransformationMatrix&, cons t gfx::Rect&);
80 static gfx::RectF mapClippedRect(const WebKit::WebTransformationMatrix&, con st gfx::RectF&); 80 static gfx::RectF mapClippedRect(const WebKit::WebTransformationMatrix&, con st gfx::RectF&);
81 static gfx::RectF projectClippedRect(const WebKit::WebTransformationMatrix&, const gfx::RectF&); 81 static gfx::RectF projectClippedRect(const WebKit::WebTransformationMatrix&, const gfx::RectF&);
82 82
83 // Returns an array of vertices that represent the clipped polygon. After re turning, indexes from 83 // Returns an array of vertices that represent the clipped polygon. After re turning, indexes from
84 // 0 to numVerticesInClippedQuad are valid in the clippedQuad array. Note th at 84 // 0 to numVerticesInClippedQuad are valid in the clippedQuad array. Note th at
85 // numVerticesInClippedQuad may be zero, which means the entire quad was cli pped, and 85 // numVerticesInClippedQuad may be zero, which means the entire quad was cli pped, and
86 // none of the vertices in the array are valid. 86 // none of the vertices in the array are valid.
87 static void mapClippedQuad(const WebKit::WebTransformationMatrix&, const Flo atQuad& srcQuad, gfx::PointF clippedQuad[8], int& numVerticesInClippedQuad); 87 static void mapClippedQuad(const WebKit::WebTransformationMatrix&, const gfx ::QuadF& srcQuad, gfx::PointF clippedQuad[8], int& numVerticesInClippedQuad);
88 88
89 static gfx::RectF computeEnclosingRectOfVertices(gfx::PointF vertices[], int numVertices); 89 static gfx::RectF computeEnclosingRectOfVertices(gfx::PointF vertices[], int numVertices);
90 static gfx::RectF computeEnclosingClippedRect(const HomogeneousCoordinate& h 1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const Homog eneousCoordinate& h4); 90 static gfx::RectF computeEnclosingClippedRect(const HomogeneousCoordinate& h 1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const Homog eneousCoordinate& h4);
91 91
92 // NOTE: These functions do not do correct clipping against w = 0 plane, but they 92 // NOTE: These functions do not do correct clipping against w = 0 plane, but they
93 // correctly detect the clipped condition via the boolean clipped. 93 // correctly detect the clipped condition via the boolean clipped.
94 static FloatQuad mapQuad(const WebKit::WebTransformationMatrix&, const Float Quad&, bool& clipped); 94 static gfx::QuadF mapQuad(const WebKit::WebTransformationMatrix&, const gfx: :QuadF&, bool& clipped);
95 static gfx::PointF mapPoint(const WebKit::WebTransformationMatrix&, const gf x::PointF&, bool& clipped); 95 static gfx::PointF mapPoint(const WebKit::WebTransformationMatrix&, const gf x::PointF&, bool& clipped);
96 static gfx::Point3F mapPoint(const WebKit::WebTransformationMatrix&, const g fx::Point3F&, bool& clipped); 96 static gfx::Point3F mapPoint(const WebKit::WebTransformationMatrix&, const g fx::Point3F&, bool& clipped);
97 static FloatQuad projectQuad(const WebKit::WebTransformationMatrix&, const F loatQuad&, bool& clipped); 97 static gfx::QuadF projectQuad(const WebKit::WebTransformationMatrix&, const gfx::QuadF&, bool& clipped);
98 static gfx::PointF projectPoint(const WebKit::WebTransformationMatrix&, cons t gfx::PointF&, bool& clipped); 98 static gfx::PointF projectPoint(const WebKit::WebTransformationMatrix&, cons t gfx::PointF&, bool& clipped);
99 99
100 static void flattenTransformTo2d(WebKit::WebTransformationMatrix&); 100 static void flattenTransformTo2d(WebKit::WebTransformationMatrix&);
101 101
102 static gfx::Vector2dF computeTransform2dScaleComponents(const WebKit::WebTra nsformationMatrix&); 102 static gfx::Vector2dF computeTransform2dScaleComponents(const WebKit::WebTra nsformationMatrix&);
103 103
104 // Returns the smallest angle between the given two vectors in degrees. Neit her vector is 104 // Returns the smallest angle between the given two vectors in degrees. Neit her vector is
105 // assumed to be normalized. 105 // assumed to be normalized.
106 static float smallestAngleBetweenVectors(const FloatSize&, const FloatSize&) ; 106 static float smallestAngleBetweenVectors(const FloatSize&, const FloatSize&) ;
107 107
108 // Projects the |source| vector onto |destination|. Neither vector is assume d to be normalized. 108 // 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); 109 static FloatSize projectVector(const FloatSize& source, const FloatSize& des tination);
110 }; 110 };
111 111
112 } // namespace cc 112 } // namespace cc
113 113
114 #endif // #define CCMathUtil_h 114 #endif // #define CCMathUtil_h
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/math_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698