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

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

Issue 12676029: cc: Fix capitalization style in chromified files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
« no previous file with comments | « cc/base/hash_pair.h ('k') | cc/base/region_unittest.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 <cmath> 8 #include <cmath>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 static float Rad2Deg(float rad) { return rad * 180.0f / kPiFloat; } 73 static float Rad2Deg(float rad) { return rad * 180.0f / kPiFloat; }
74 74
75 static float Round(float f) { 75 static float Round(float f) {
76 return (f > 0.f) ? std::floor(f + 0.5f) : std::ceil(f - 0.5f); 76 return (f > 0.f) ? std::floor(f + 0.5f) : std::ceil(f - 0.5f);
77 } 77 }
78 static double Round(double d) { 78 static double Round(double d) {
79 return (d > 0.0) ? std::floor(d + 0.5) : std::ceil(d - 0.5); 79 return (d > 0.0) ? std::floor(d + 0.5) : std::ceil(d - 0.5);
80 } 80 }
81 81
82 // Background: Existing transform code does not do the right thing in 82 // Background: Existing transform code does not do the right thing in
83 // mapRect / mapQuad / projectQuad when there is a perspective projection that 83 // MapRect / MapQuad / ProjectQuad when there is a perspective projection that
84 // causes one of the transformed vertices to go to w < 0. In those cases, it 84 // causes one of the transformed vertices to go to w < 0. In those cases, it
85 // is necessary to perform clipping in homogeneous coordinates, after applying 85 // is necessary to perform clipping in homogeneous coordinates, after applying
86 // the transform, before dividing-by-w to convert to cartesian coordinates. 86 // the transform, before dividing-by-w to convert to cartesian coordinates.
87 // 87 //
88 // These functions return the axis-aligned rect that encloses the correctly 88 // These functions return the axis-aligned rect that encloses the correctly
89 // clipped, transformed polygon. 89 // clipped, transformed polygon.
90 static gfx::Rect MapClippedRect(const gfx::Transform& transform, 90 static gfx::Rect MapClippedRect(const gfx::Transform& transform,
91 gfx::Rect rect); 91 gfx::Rect rect);
92 static gfx::RectF MapClippedRect(const gfx::Transform& transform, 92 static gfx::RectF MapClippedRect(const gfx::Transform& transform,
93 const gfx::RectF& rect); 93 const gfx::RectF& rect);
94 static gfx::RectF ProjectClippedRect(const gfx::Transform& transform, 94 static gfx::RectF ProjectClippedRect(const gfx::Transform& transform,
95 const gfx::RectF& rect); 95 const gfx::RectF& rect);
96 96
97 // Returns an array of vertices that represent the clipped polygon. After 97 // Returns an array of vertices that represent the clipped polygon. After
98 // returning, indexes from 0 to numVerticesInClippedQuad are valid in the 98 // returning, indexes from 0 to num_vertices_in_clipped_quad are valid in the
99 // clippedQuad array. Note that numVerticesInClippedQuad may be zero, which 99 // clipped_quad array. Note that num_vertices_in_clipped_quad may be zero,
100 // means the entire quad was clipped, and none of the vertices in the array 100 // which means the entire quad was clipped, and none of the vertices in the
101 // are valid. 101 // array are valid.
102 static void MapClippedQuad(const gfx::Transform& transform, 102 static void MapClippedQuad(const gfx::Transform& transform,
103 const gfx::QuadF& src_quad, 103 const gfx::QuadF& src_quad,
104 gfx::PointF clippedQuad[8], 104 gfx::PointF clipped_quad[8],
105 int& numVerticesInClippedQuad); 105 int& num_vertices_in_clipped_quad);
106 106
107 static gfx::RectF ComputeEnclosingRectOfVertices(gfx::PointF vertices[], 107 static gfx::RectF ComputeEnclosingRectOfVertices(gfx::PointF vertices[],
108 int num_vertices); 108 int num_vertices);
109 static gfx::RectF ComputeEnclosingClippedRect( 109 static gfx::RectF ComputeEnclosingClippedRect(
110 const HomogeneousCoordinate& h1, 110 const HomogeneousCoordinate& h1,
111 const HomogeneousCoordinate& h2, 111 const HomogeneousCoordinate& h2,
112 const HomogeneousCoordinate& h3, 112 const HomogeneousCoordinate& h3,
113 const HomogeneousCoordinate& h4); 113 const HomogeneousCoordinate& h4);
114 114
115 // NOTE: These functions do not do correct clipping against w = 0 plane, but 115 // NOTE: These functions do not do correct clipping against w = 0 plane, but
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // Returns a base::Value representation of the floating point value. 151 // Returns a base::Value representation of the floating point value.
152 // If the value is inf, returns max double/float representation. 152 // If the value is inf, returns max double/float representation.
153 static scoped_ptr<base::Value> AsValueSafely(double value); 153 static scoped_ptr<base::Value> AsValueSafely(double value);
154 static scoped_ptr<base::Value> AsValueSafely(float value); 154 static scoped_ptr<base::Value> AsValueSafely(float value);
155 155
156 }; 156 };
157 157
158 } // namespace cc 158 } // namespace cc
159 159
160 #endif // CC_BASE_MATH_UTIL_H_ 160 #endif // CC_BASE_MATH_UTIL_H_
OLDNEW
« no previous file with comments | « cc/base/hash_pair.h ('k') | cc/base/region_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698