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

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

Issue 1724283003: Revert of Simple cleanups related to SkFixed. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 10 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/SkRect.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 SkFixed_DEFINED 8 #ifndef SkFixed_DEFINED
9 #define SkFixed_DEFINED 9 #define SkFixed_DEFINED
10 10
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 12
13 /** \file SkFixed.h 13 /** \file SkFixed.h
14 14
15 Types and macros for 16.16 fixed point 15 Types and macros for 16.16 fixed point
16 */ 16 */
17 17
18 /** 32 bit signed integer used to represent fractions values with 16 bits to the right of the decimal point 18 /** 32 bit signed integer used to represent fractions values with 16 bits to the right of the decimal point
19 */ 19 */
20 typedef int32_t SkFixed; 20 typedef int32_t SkFixed;
21 #define SK_Fixed1 (1 << 16) 21 #define SK_Fixed1 (1 << 16)
22 #define SK_FixedHalf (1 << 15) 22 #define SK_FixedHalf (1 << 15)
23 #define SK_FixedMax (0x7FFFFFFF) 23 #define SK_FixedMax (0x7FFFFFFF)
24 #define SK_FixedMin (-SK_FixedMax) 24 #define SK_FixedMin (-SK_FixedMax)
25 #define SK_FixedNaN ((int) 0x80000000)
25 #define SK_FixedPI (0x3243F) 26 #define SK_FixedPI (0x3243F)
26 #define SK_FixedSqrt2 (92682) 27 #define SK_FixedSqrt2 (92682)
27 #define SK_FixedTanPIOver8 (0x6A0A) 28 #define SK_FixedTanPIOver8 (0x6A0A)
28 #define SK_FixedRoot2Over2 (0xB505) 29 #define SK_FixedRoot2Over2 (0xB505)
29 30
30 #define SkFixedToFloat(x) ((x) * 1.52587890625e-5f) 31 #define SkFixedToFloat(x) ((x) * 1.52587890625e-5f)
31 #if 1 32 #if 1
32 #define SkFloatToFixed(x) ((SkFixed)((x) * SK_Fixed1)) 33 #define SkFloatToFixed(x) ((SkFixed)((x) * SK_Fixed1))
33 #else 34 #else
34 // pins over/under flows to max/min int32 (slower than just a cast) 35 // pins over/under flows to max/min int32 (slower than just a cast)
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 #define Sk48Dot16FloorToInt(x) static_cast<int>((x) >> 16) 162 #define Sk48Dot16FloorToInt(x) static_cast<int>((x) >> 16)
162 163
163 static inline float Sk48Dot16ToScalar(Sk48Dot16 x) { 164 static inline float Sk48Dot16ToScalar(Sk48Dot16 x) {
164 return static_cast<float>(x * 1.5258789e-5); // x * (1.0f / (1 << 16)) 165 return static_cast<float>(x * 1.5258789e-5); // x * (1.0f / (1 << 16))
165 } 166 }
166 #define SkFloatTo48Dot16(x) (static_cast<Sk48Dot16>((x) * (1 << 16))) 167 #define SkFloatTo48Dot16(x) (static_cast<Sk48Dot16>((x) * (1 << 16)))
167 168
168 #define SkScalarTo48Dot16(x) SkFloatTo48Dot16(x) 169 #define SkScalarTo48Dot16(x) SkFloatTo48Dot16(x)
169 170
170 #endif 171 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkRect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698