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

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

Issue 772933002: Remove SK_SUPPORT_DEPRECATED_SCALARROUND. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 | no next file » | 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
11 #include "SkFixed.h" 11 #include "SkFixed.h"
12 #include "SkFloatingPoint.h" 12 #include "SkFloatingPoint.h"
13 13
14 //#define SK_SUPPORT_DEPRECATED_SCALARROUND
15
16 // TODO: move this sort of check into SkPostConfig.h 14 // TODO: move this sort of check into SkPostConfig.h
17 #define SK_SCALAR_IS_DOUBLE 0 15 #define SK_SCALAR_IS_DOUBLE 0
18 #undef SK_SCALAR_IS_FLOAT 16 #undef SK_SCALAR_IS_FLOAT
19 #define SK_SCALAR_IS_FLOAT 1 17 #define SK_SCALAR_IS_FLOAT 1
20 18
21 19
22 #if SK_SCALAR_IS_FLOAT 20 #if SK_SCALAR_IS_FLOAT
23 21
24 typedef float SkScalar; 22 typedef float SkScalar;
25 23
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 #define SkDegreesToRadians(degrees) ((degrees) * (SK_ScalarPI / 180)) 174 #define SkDegreesToRadians(degrees) ((degrees) * (SK_ScalarPI / 180))
177 #define SkRadiansToDegrees(radians) ((radians) * (180 / SK_ScalarPI)) 175 #define SkRadiansToDegrees(radians) ((radians) * (180 / SK_ScalarPI))
178 176
179 static inline SkScalar SkMaxScalar(SkScalar a, SkScalar b) { return a > b ? a : b; } 177 static inline SkScalar SkMaxScalar(SkScalar a, SkScalar b) { return a > b ? a : b; }
180 static inline SkScalar SkMinScalar(SkScalar a, SkScalar b) { return a < b ? a : b; } 178 static inline SkScalar SkMinScalar(SkScalar a, SkScalar b) { return a < b ? a : b; }
181 179
182 static inline bool SkScalarIsInt(SkScalar x) { 180 static inline bool SkScalarIsInt(SkScalar x) {
183 return x == (SkScalar)(int)x; 181 return x == (SkScalar)(int)x;
184 } 182 }
185 183
186 // DEPRECATED : use ToInt or ToScalar variant
187 #ifdef SK_SUPPORT_DEPRECATED_SCALARROUND
188 # define SkScalarFloor(x) SkScalarFloorToInt(x)
189 # define SkScalarCeil(x) SkScalarCeilToInt(x)
190 # define SkScalarRound(x) SkScalarRoundToInt(x)
191 #endif
192
193 /** 184 /**
194 * Returns -1 || 0 || 1 depending on the sign of value: 185 * Returns -1 || 0 || 1 depending on the sign of value:
195 * -1 if x < 0 186 * -1 if x < 0
196 * 0 if x == 0 187 * 0 if x == 0
197 * 1 if x > 0 188 * 1 if x > 0
198 */ 189 */
199 static inline int SkScalarSignAsInt(SkScalar x) { 190 static inline int SkScalarSignAsInt(SkScalar x) {
200 return x < 0 ? -1 : (x > 0); 191 return x < 0 ? -1 : (x > 0);
201 } 192 }
202 193
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 SkASSERT(n >= 0); 241 SkASSERT(n >= 0);
251 for (int i = 0; i < n; ++i) { 242 for (int i = 0; i < n; ++i) {
252 if (a[i] != b[i]) { 243 if (a[i] != b[i]) {
253 return false; 244 return false;
254 } 245 }
255 } 246 }
256 return true; 247 return true;
257 } 248 }
258 249
259 #endif 250 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698