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

Side by Side Diff: cc/math/clamp.h

Issue 10984053: cc: Use ui/gfx geometry types for the CCRenderPass and CCDrawQuad classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_MATH_CLAMP_H_
6 #define CC_MATH_CLAMP_H_
7
8 #include "cc/math/clamp.h"
tfarina 2012/09/28 19:39:30 we are self including here?
9 #include "cc/math/int_point.h"
tfarina 2012/09/28 19:39:30 I guess unused in this header file.
10 #include <limits>
11
12 namespace ccmath {
13
14 class Clamp {
15 private:
tfarina 2012/09/28 19:39:30 private sections after public the other we usuall
16 template<typename FromType, typename ToType>
17 static ToType ClampFromTo(FromType value) {
18 ToType min = std::numeric_limits<ToType>::min();
19 ToType max = std::numeric_limits<ToType>::max();
20 if (value >= static_cast<FromType>(max))
21 return max;
22 if (value <= static_cast<FromType>(min))
23 return min;
24 return value;
25 }
26
27 public:
28 static int ToInteger(double d) { return ClampFromTo<double, int>(d); }
29 static int ToInteger(float f) { return ClampFromTo<float, int>(f); }
30 };
tfarina 2012/09/28 19:39:30 DISALLOW_IMPLICIT_CONSTRUCTORS
31
32 } // namespace ccmath
33
34 #endif // CC_MATH_CLAMP_H_
OLDNEW
« no previous file with comments | « cc/cc.gyp ('k') | cc/math/float_point.h » ('j') | cc/math/int_point.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698