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

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: 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
Index: cc/base/math_util.cc
diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc
index 0cc120d89094c818e72f6480711c6e3a5ed1e99a..35da33ab74235cb84af2270923f0a20310cb7ffe 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,15 +87,15 @@ 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,
- gfx::PointF clipped_quad[8],
+static inline void AddVertexToClippedQuad(const gfx::PointF& new_vertex,
+ gfx::PointF (&clipped_quad)[8],
danakj 2014/01/15 16:54:46 This change seems unrelated?
r.kasibhatla 2014/01/16 05:05:39 Agree. No need for the change. Reverted the change
int* num_vertices_in_clipped_quad) {
clipped_quad[*num_vertices_in_clipped_quad] = new_vertex;
(*num_vertices_in_clipped_quad)++;
@@ -156,7 +156,7 @@ gfx::RectF MathUtil::ProjectClippedRect(const gfx::Transform& transform,
void MathUtil::MapClippedQuad(const gfx::Transform& transform,
const gfx::QuadF& src_quad,
- gfx::PointF clipped_quad[8],
+ gfx::PointF (&clipped_quad)[8],
danakj 2014/01/15 16:54:46 This change seems unrelated?
r.kasibhatla 2014/01/16 05:05:39 Agree. No need for the change. Reverted the change
int* num_vertices_in_clipped_quad) {
HomogeneousCoordinate h1 =
MapHomogeneousPoint(transform, gfx::Point3F(src_quad.p1()));
@@ -223,7 +223,7 @@ void MathUtil::MapClippedQuad(const gfx::Transform& transform,
DCHECK_LE(*num_vertices_in_clipped_quad, 8);
}
-gfx::RectF MathUtil::ComputeEnclosingRectOfVertices(gfx::PointF vertices[],
+gfx::RectF MathUtil::ComputeEnclosingRectOfVertices(const gfx::PointF* vertices,
danakj 2014/01/15 16:54:46 This change seems unrelated?
r.kasibhatla 2014/01/16 05:05:39 As we are not modifying the 'vertices' array, we s
danakj 2014/01/16 17:46:12 Sure.. won't hurt.
int num_vertices) {
if (num_vertices < 2)
return gfx::RectF();
@@ -356,7 +356,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 +421,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 +551,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());
« cc/base/math_util.h ('K') | « 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