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

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

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 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/base/list_container_helper.cc ('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 <memory>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "cc/base/cc_export.h" 14 #include "cc/base/cc_export.h"
15 #include "ui/gfx/geometry/box_f.h" 15 #include "ui/gfx/geometry/box_f.h"
16 #include "ui/gfx/geometry/point3_f.h" 16 #include "ui/gfx/geometry/point3_f.h"
17 #include "ui/gfx/geometry/point_f.h" 17 #include "ui/gfx/geometry/point_f.h"
18 #include "ui/gfx/geometry/scroll_offset.h" 18 #include "ui/gfx/geometry/scroll_offset.h"
19 #include "ui/gfx/geometry/size.h" 19 #include "ui/gfx/geometry/size.h"
20 #include "ui/gfx/transform.h" 20 #include "ui/gfx/transform.h"
21 21
22 namespace base { 22 namespace base {
23 class Value; 23 class Value;
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // Neither vector is assumed to be normalized. 247 // Neither vector is assumed to be normalized.
248 static float SmallestAngleBetweenVectors(const gfx::Vector2dF& v1, 248 static float SmallestAngleBetweenVectors(const gfx::Vector2dF& v1,
249 const gfx::Vector2dF& v2); 249 const gfx::Vector2dF& v2);
250 250
251 // Projects the |source| vector onto |destination|. Neither vector is assumed 251 // Projects the |source| vector onto |destination|. Neither vector is assumed
252 // to be normalized. 252 // to be normalized.
253 static gfx::Vector2dF ProjectVector(const gfx::Vector2dF& source, 253 static gfx::Vector2dF ProjectVector(const gfx::Vector2dF& source,
254 const gfx::Vector2dF& destination); 254 const gfx::Vector2dF& destination);
255 255
256 // Conversion to value. 256 // Conversion to value.
257 static scoped_ptr<base::Value> AsValue(const gfx::Size& s); 257 static std::unique_ptr<base::Value> AsValue(const gfx::Size& s);
258 static scoped_ptr<base::Value> AsValue(const gfx::Rect& r); 258 static std::unique_ptr<base::Value> AsValue(const gfx::Rect& r);
259 static bool FromValue(const base::Value*, gfx::Rect* out_rect); 259 static bool FromValue(const base::Value*, gfx::Rect* out_rect);
260 static scoped_ptr<base::Value> AsValue(const gfx::PointF& q); 260 static std::unique_ptr<base::Value> AsValue(const gfx::PointF& q);
261 261
262 static void AddToTracedValue(const char* name, 262 static void AddToTracedValue(const char* name,
263 const gfx::Size& s, 263 const gfx::Size& s,
264 base::trace_event::TracedValue* res); 264 base::trace_event::TracedValue* res);
265 static void AddToTracedValue(const char* name, 265 static void AddToTracedValue(const char* name,
266 const gfx::SizeF& s, 266 const gfx::SizeF& s,
267 base::trace_event::TracedValue* res); 267 base::trace_event::TracedValue* res);
268 static void AddToTracedValue(const char* name, 268 static void AddToTracedValue(const char* name,
269 const gfx::Rect& r, 269 const gfx::Rect& r,
270 base::trace_event::TracedValue* res); 270 base::trace_event::TracedValue* res);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 template <typename T> 319 template <typename T>
320 static T RoundDownInternal(T n, T mul) { 320 static T RoundDownInternal(T n, T mul) {
321 return (n > 0) ? (n / mul) * mul : (n == 0) ? 0 321 return (n > 0) ? (n / mul) * mul : (n == 0) ? 0
322 : ((n - mul + 1) / mul) * mul; 322 : ((n - mul + 1) / mul) * mul;
323 } 323 }
324 }; 324 };
325 325
326 } // namespace cc 326 } // namespace cc
327 327
328 #endif // CC_BASE_MATH_UTIL_H_ 328 #endif // CC_BASE_MATH_UTIL_H_
OLDNEW
« no previous file with comments | « cc/base/list_container_helper.cc ('k') | cc/base/math_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698