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

Side by Side Diff: src/core/SkFDot6.h

Issue 85463005: remove SkFloatToScalar macro (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add flag to expose SkFloatToScalar to chromium Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkBitmapProcState.cpp ('k') | src/core/SkGeometry.cpp » ('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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkFDot6_DEFINED 10 #ifndef SkFDot6_DEFINED
(...skipping 23 matching lines...) Expand all
34 #define SkFixedToFDot6(x) ((x) >> 10) 34 #define SkFixedToFDot6(x) ((x) >> 10)
35 35
36 inline SkFixed SkFDot6ToFixed(SkFDot6 x) { 36 inline SkFixed SkFDot6ToFixed(SkFDot6 x) {
37 SkASSERT((x << 10 >> 10) == x); 37 SkASSERT((x << 10 >> 10) == x);
38 38
39 return x << 10; 39 return x << 10;
40 } 40 }
41 41
42 #ifdef SK_SCALAR_IS_FLOAT 42 #ifdef SK_SCALAR_IS_FLOAT
43 #define SkScalarToFDot6(x) (SkFDot6)((x) * 64) 43 #define SkScalarToFDot6(x) (SkFDot6)((x) * 64)
44 #define SkFDot6ToScalar(x) ((SkScalar)(x) * SkFloatToScalar(0.015625f)) 44 #define SkFDot6ToScalar(x) ((SkScalar)(x) * 0.015625f)
45 #else 45 #else
46 #define SkScalarToFDot6(x) ((x) >> 10) 46 #define SkScalarToFDot6(x) ((x) >> 10)
47 #define SkFDot6ToScalar(x) ((x) << 10) 47 #define SkFDot6ToScalar(x) ((x) << 10)
48 #endif 48 #endif
49 49
50 inline SkFixed SkFDot6Div(SkFDot6 a, SkFDot6 b) { 50 inline SkFixed SkFDot6Div(SkFDot6 a, SkFDot6 b) {
51 SkASSERT(b != 0); 51 SkASSERT(b != 0);
52 52
53 if (a == (int16_t)a) { 53 if (a == (int16_t)a) {
54 return (a << 16) / b; 54 return (a << 16) / b;
55 } else { 55 } else {
56 return SkFixedDiv(a, b); 56 return SkFixedDiv(a, b);
57 } 57 }
58 } 58 }
59 59
60 #endif 60 #endif
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState.cpp ('k') | src/core/SkGeometry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698