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

Side by Side Diff: cc/base/math_util.h

Issue 416273002: BSP Tree perf tests to match LayerSorter perf tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit test issue. Created 6 years, 4 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
« no previous file with comments | « cc/BUILD.gn ('k') | cc/base/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 CC_BASE_MATH_UTIL_H_ 5 #ifndef CC_BASE_MATH_UTIL_H_
6 #define CC_BASE_MATH_UTIL_H_ 6 #define CC_BASE_MATH_UTIL_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <cmath> 9 #include <cmath>
10 #include <vector>
10 11
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "cc/base/cc_export.h" 14 #include "cc/base/cc_export.h"
14 #include "ui/gfx/box_f.h" 15 #include "ui/gfx/box_f.h"
15 #include "ui/gfx/point3_f.h" 16 #include "ui/gfx/point3_f.h"
16 #include "ui/gfx/point_f.h" 17 #include "ui/gfx/point_f.h"
17 #include "ui/gfx/size.h" 18 #include "ui/gfx/size.h"
18 #include "ui/gfx/transform.h" 19 #include "ui/gfx/transform.h"
19 20
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 112
112 // Returns an array of vertices that represent the clipped polygon. After 113 // Returns an array of vertices that represent the clipped polygon. After
113 // returning, indexes from 0 to num_vertices_in_clipped_quad are valid in the 114 // returning, indexes from 0 to num_vertices_in_clipped_quad are valid in the
114 // clipped_quad array. Note that num_vertices_in_clipped_quad may be zero, 115 // clipped_quad array. Note that num_vertices_in_clipped_quad may be zero,
115 // which means the entire quad was clipped, and none of the vertices in the 116 // which means the entire quad was clipped, and none of the vertices in the
116 // array are valid. 117 // array are valid.
117 static void MapClippedQuad(const gfx::Transform& transform, 118 static void MapClippedQuad(const gfx::Transform& transform,
118 const gfx::QuadF& src_quad, 119 const gfx::QuadF& src_quad,
119 gfx::PointF clipped_quad[8], 120 gfx::PointF clipped_quad[8],
120 int* num_vertices_in_clipped_quad); 121 int* num_vertices_in_clipped_quad);
122 static bool MapClippedQuad3d(const gfx::Transform& transform,
123 const gfx::QuadF& src_quad,
124 gfx::Point3F clipped_quad[8],
125 int* num_vertices_in_clipped_quad);
121 126
122 static gfx::RectF ComputeEnclosingRectOfVertices(const gfx::PointF vertices[], 127 static gfx::RectF ComputeEnclosingRectOfVertices(const gfx::PointF vertices[],
123 int num_vertices); 128 int num_vertices);
124 static gfx::RectF ComputeEnclosingClippedRect( 129 static gfx::RectF ComputeEnclosingClippedRect(
125 const HomogeneousCoordinate& h1, 130 const HomogeneousCoordinate& h1,
126 const HomogeneousCoordinate& h2, 131 const HomogeneousCoordinate& h2,
127 const HomogeneousCoordinate& h3, 132 const HomogeneousCoordinate& h3,
128 const HomogeneousCoordinate& h4); 133 const HomogeneousCoordinate& h4);
129 134
130 // NOTE: These functions do not do correct clipping against w = 0 plane, but 135 // NOTE: These functions do not do correct clipping against w = 0 plane, but
131 // they correctly detect the clipped condition via the boolean clipped. 136 // they correctly detect the clipped condition via the boolean clipped.
132 static gfx::QuadF MapQuad(const gfx::Transform& transform, 137 static gfx::QuadF MapQuad(const gfx::Transform& transform,
133 const gfx::QuadF& quad, 138 const gfx::QuadF& quad,
134 bool* clipped); 139 bool* clipped);
140 static gfx::QuadF MapQuad3d(const gfx::Transform& transform,
141 const gfx::QuadF& q,
142 gfx::Point3F* p,
143 bool* clipped);
135 static gfx::PointF MapPoint(const gfx::Transform& transform, 144 static gfx::PointF MapPoint(const gfx::Transform& transform,
136 const gfx::PointF& point, 145 const gfx::PointF& point,
137 bool* clipped); 146 bool* clipped);
138 static gfx::Point3F MapPoint(const gfx::Transform&, 147 static gfx::Point3F MapPoint(const gfx::Transform&,
139 const gfx::Point3F&, 148 const gfx::Point3F&,
140 bool* clipped); 149 bool* clipped);
141 static gfx::QuadF ProjectQuad(const gfx::Transform& transform, 150 static gfx::QuadF ProjectQuad(const gfx::Transform& transform,
142 const gfx::QuadF& quad, 151 const gfx::QuadF& quad,
143 bool* clipped); 152 bool* clipped);
144 static gfx::PointF ProjectPoint(const gfx::Transform& transform, 153 static gfx::PointF ProjectPoint(const gfx::Transform& transform,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 196
188 // Returns a base::Value representation of the floating point value. 197 // Returns a base::Value representation of the floating point value.
189 // If the value is inf, returns max double/float representation. 198 // If the value is inf, returns max double/float representation.
190 static scoped_ptr<base::Value> AsValueSafely(double value); 199 static scoped_ptr<base::Value> AsValueSafely(double value);
191 static scoped_ptr<base::Value> AsValueSafely(float value); 200 static scoped_ptr<base::Value> AsValueSafely(float value);
192 }; 201 };
193 202
194 } // namespace cc 203 } // namespace cc
195 204
196 #endif // CC_BASE_MATH_UTIL_H_ 205 #endif // CC_BASE_MATH_UTIL_H_
OLDNEW
« no previous file with comments | « cc/BUILD.gn ('k') | cc/base/math_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698