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

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

Issue 117053002: remove SK_SCALAR_IS_[FLOAT,FIXED] and assume floats (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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
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 21 matching lines...) Expand all
32 #define SkFDot6Round(x) (((x) + 32) >> 6) 32 #define SkFDot6Round(x) (((x) + 32) >> 6)
33 33
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 #define SkScalarToFDot6(x) (SkFDot6)((x) * 64)
43 #define SkScalarToFDot6(x) (SkFDot6)((x) * 64) 43 #define SkFDot6ToScalar(x) ((SkScalar)(x) * 0.015625f)
44 #define SkFDot6ToScalar(x) ((SkScalar)(x) * 0.015625f)
45 #else
46 #define SkScalarToFDot6(x) ((x) >> 10)
47 #define SkFDot6ToScalar(x) ((x) << 10)
48 #endif
49 44
50 inline SkFixed SkFDot6Div(SkFDot6 a, SkFDot6 b) { 45 inline SkFixed SkFDot6Div(SkFDot6 a, SkFDot6 b) {
51 SkASSERT(b != 0); 46 SkASSERT(b != 0);
52 47
53 if (a == (int16_t)a) { 48 if (a == (int16_t)a) {
54 return (a << 16) / b; 49 return (a << 16) / b;
55 } else { 50 } else {
56 return SkFixedDiv(a, b); 51 return SkFixedDiv(a, b);
57 } 52 }
58 } 53 }
59 54
60 #endif 55 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698