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

Side by Side Diff: include/core/SkScalar.h

Issue 1090003002: Add SkTPin. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use &. Created 5 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 | « no previous file | include/core/SkTypes.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 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkScalar_DEFINED 8 #ifndef SkScalar_DEFINED
9 #define SkScalar_DEFINED 9 #define SkScalar_DEFINED
10 10
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 return (int)floor(xx); 168 return (int)floor(xx);
169 } 169 }
170 170
171 static inline SkScalar SkScalarClampMax(SkScalar x, SkScalar max) { 171 static inline SkScalar SkScalarClampMax(SkScalar x, SkScalar max) {
172 x = SkTMin(x, max); 172 x = SkTMin(x, max);
173 x = SkTMax<SkScalar>(x, 0); 173 x = SkTMax<SkScalar>(x, 0);
174 return x; 174 return x;
175 } 175 }
176 176
177 static inline SkScalar SkScalarPin(SkScalar x, SkScalar min, SkScalar max) { 177 static inline SkScalar SkScalarPin(SkScalar x, SkScalar min, SkScalar max) {
178 x = SkTMin(x, max); 178 return SkTPin(x, min, max);
179 x = SkTMax(x, min);
180 return x;
181 } 179 }
182 180
183 SkScalar SkScalarSinCos(SkScalar radians, SkScalar* cosValue); 181 SkScalar SkScalarSinCos(SkScalar radians, SkScalar* cosValue);
184 182
185 static inline SkScalar SkScalarSquare(SkScalar x) { return x * x; } 183 static inline SkScalar SkScalarSquare(SkScalar x) { return x * x; }
186 184
187 #define SkScalarMul(a, b) ((SkScalar)(a) * (b)) 185 #define SkScalarMul(a, b) ((SkScalar)(a) * (b))
188 #define SkScalarMulAdd(a, b, c) ((SkScalar)(a) * (b) + (c)) 186 #define SkScalarMulAdd(a, b, c) ((SkScalar)(a) * (b) + (c))
189 #define SkScalarDiv(a, b) ((SkScalar)(a) / (b)) 187 #define SkScalarDiv(a, b) ((SkScalar)(a) / (b))
190 #define SkScalarMulDiv(a, b, c) ((SkScalar)(a) * (b) / (c)) 188 #define SkScalarMulDiv(a, b, c) ((SkScalar)(a) * (b) / (c))
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 SkASSERT(n >= 0); 261 SkASSERT(n >= 0);
264 for (int i = 0; i < n; ++i) { 262 for (int i = 0; i < n; ++i) {
265 if (a[i] != b[i]) { 263 if (a[i] != b[i]) {
266 return false; 264 return false;
267 } 265 }
268 } 266 }
269 return true; 267 return true;
270 } 268 }
271 269
272 #endif 270 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698