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

Unified Diff: cc/base/math_util.cc

Issue 139233002: [#4] Pass gfx structs by const ref (gfx::PointF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Corrected as per review comments! Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/base/math_util.h ('k') | cc/debug/overdraw_metrics.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/math_util.cc
diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc
index 0cc120d89094c818e72f6480711c6e3a5ed1e99a..0a370d333aa214ba7a171f3d145ca5773b960a0d 100644
--- a/cc/base/math_util.cc
+++ b/cc/base/math_util.cc
@@ -23,7 +23,7 @@ const float MathUtil::kPiFloat = 3.14159265358979323846f;
static HomogeneousCoordinate ProjectHomogeneousPoint(
const gfx::Transform& transform,
- gfx::PointF p) {
+ const gfx::PointF& p) {
// In this case, the layer we are trying to project onto is perpendicular to
// ray (point p and z-axis direction) that we are trying to project. This
// happens when the layer is rotated so that it is infinitesimally thin, or
@@ -87,14 +87,14 @@ static inline void ExpandBoundsToIncludePoint(float* xmin,
float* xmax,
float* ymin,
float* ymax,
- gfx::PointF p) {
+ const gfx::PointF& p) {
*xmin = std::min(p.x(), *xmin);
*xmax = std::max(p.x(), *xmax);
*ymin = std::min(p.y(), *ymin);
*ymax = std::max(p.y(), *ymax);
}
-static inline void AddVertexToClippedQuad(gfx::PointF new_vertex,
+static inline void AddVertexToClippedQuad(const gfx::PointF& new_vertex,
gfx::PointF clipped_quad[8],
int* num_vertices_in_clipped_quad) {
clipped_quad[*num_vertices_in_clipped_quad] = new_vertex;
@@ -223,8 +223,9 @@ void MathUtil::MapClippedQuad(const gfx::Transform& transform,
DCHECK_LE(*num_vertices_in_clipped_quad, 8);
}
-gfx::RectF MathUtil::ComputeEnclosingRectOfVertices(gfx::PointF vertices[],
- int num_vertices) {
+gfx::RectF MathUtil::ComputeEnclosingRectOfVertices(
+ const gfx::PointF vertices[],
+ int num_vertices) {
if (num_vertices < 2)
return gfx::RectF();
@@ -356,7 +357,7 @@ gfx::QuadF MathUtil::MapQuad(const gfx::Transform& transform,
}
gfx::PointF MathUtil::MapPoint(const gfx::Transform& transform,
- gfx::PointF p,
+ const gfx::PointF& p,
bool* clipped) {
HomogeneousCoordinate h = MapHomogeneousPoint(transform, gfx::Point3F(p));
@@ -421,7 +422,7 @@ gfx::QuadF MathUtil::ProjectQuad(const gfx::Transform& transform,
}
gfx::PointF MathUtil::ProjectPoint(const gfx::Transform& transform,
- gfx::PointF p,
+ const gfx::PointF& p,
bool* clipped) {
HomogeneousCoordinate h = ProjectHomogeneousPoint(transform, p);
@@ -551,7 +552,7 @@ bool MathUtil::FromValue(const base::Value* raw_value, gfx::Rect* out_rect) {
return true;
}
-scoped_ptr<base::Value> MathUtil::AsValue(gfx::PointF pt) {
+scoped_ptr<base::Value> MathUtil::AsValue(const gfx::PointF& pt) {
scoped_ptr<base::ListValue> res(new base::ListValue());
res->AppendDouble(pt.x());
res->AppendDouble(pt.y());
« no previous file with comments | « cc/base/math_util.h ('k') | cc/debug/overdraw_metrics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698