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

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

Issue 632613002: [C++11 Allowed Features] Declares a type-safe null pointer converting from NULL to nullptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/latency_info_swap_promise_monitor.cc ('k') | cc/base/scoped_ptr_vector.h » ('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 #include "cc/base/math_util.h" 5 #include "cc/base/math_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 10
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 scoped_ptr<base::Value> MathUtil::AsValue(const gfx::Rect& r) { 699 scoped_ptr<base::Value> MathUtil::AsValue(const gfx::Rect& r) {
700 scoped_ptr<base::ListValue> res(new base::ListValue()); 700 scoped_ptr<base::ListValue> res(new base::ListValue());
701 res->AppendInteger(r.x()); 701 res->AppendInteger(r.x());
702 res->AppendInteger(r.y()); 702 res->AppendInteger(r.y());
703 res->AppendInteger(r.width()); 703 res->AppendInteger(r.width());
704 res->AppendInteger(r.height()); 704 res->AppendInteger(r.height());
705 return res.Pass(); 705 return res.Pass();
706 } 706 }
707 707
708 bool MathUtil::FromValue(const base::Value* raw_value, gfx::Rect* out_rect) { 708 bool MathUtil::FromValue(const base::Value* raw_value, gfx::Rect* out_rect) {
709 const base::ListValue* value = NULL; 709 const base::ListValue* value = nullptr;
710 if (!raw_value->GetAsList(&value)) 710 if (!raw_value->GetAsList(&value))
711 return false; 711 return false;
712 712
713 if (value->GetSize() != 4) 713 if (value->GetSize() != 4)
714 return false; 714 return false;
715 715
716 int x, y, w, h; 716 int x, y, w, h;
717 bool ok = true; 717 bool ok = true;
718 ok &= value->GetInteger(0, &x); 718 ok &= value->GetInteger(0, &x);
719 ok &= value->GetInteger(1, &y); 719 ok &= value->GetInteger(1, &y);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 819
820 double MathUtil::AsDoubleSafely(double value) { 820 double MathUtil::AsDoubleSafely(double value) {
821 return std::min(value, std::numeric_limits<double>::max()); 821 return std::min(value, std::numeric_limits<double>::max());
822 } 822 }
823 823
824 float MathUtil::AsFloatSafely(float value) { 824 float MathUtil::AsFloatSafely(float value) {
825 return std::min(value, std::numeric_limits<float>::max()); 825 return std::min(value, std::numeric_limits<float>::max());
826 } 826 }
827 827
828 } // namespace cc 828 } // namespace cc
OLDNEW
« no previous file with comments | « cc/base/latency_info_swap_promise_monitor.cc ('k') | cc/base/scoped_ptr_vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698