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

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

Issue 21112004: one more thing to try before rebaselining android (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: sync Created 7 years, 4 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 | Annotate | Revision Log
« 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 /* 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 SkFixed_DEFINED 10 #ifndef SkFixed_DEFINED
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 inline SkFixed SkFixedSquare_longlong(SkFixed value) 184 inline SkFixed SkFixedSquare_longlong(SkFixed value)
185 { 185 {
186 return (SkFixed)((SkLONGLONG)value * value >> 16); 186 return (SkFixed)((SkLONGLONG)value * value >> 16);
187 } 187 }
188 #define SkFixedMul(a,b) SkFixedMul_longlong(a,b) 188 #define SkFixedMul(a,b) SkFixedMul_longlong(a,b)
189 #define SkFractMul(a,b) SkFractMul_longlong(a,b) 189 #define SkFractMul(a,b) SkFractMul_longlong(a,b)
190 #define SkFixedSquare(a) SkFixedSquare_longlong(a) 190 #define SkFixedSquare(a) SkFixedSquare_longlong(a)
191 #endif 191 #endif
192 192
193 #if defined(SK_CPU_ARM) && !defined(__thumb__) 193 #if defined(SK_CPU_ARM)
194 /* This guy does not handle NaN or other obscurities, but is faster than 194 /* This guy does not handle NaN or other obscurities, but is faster than
195 than (int)(x*65536) 195 than (int)(x*65536)
196 */ 196 */
197 inline SkFixed SkFloatToFixed_arm(float x) 197 inline SkFixed SkFloatToFixed_arm(float x)
198 { 198 {
199 register int32_t y, z; 199 register int32_t y, z;
200 asm("movs %1, %3, lsl #1 \n" 200 asm("movs %1, %3, lsl #1 \n"
201 "mov %2, #0x8E \n" 201 "mov %2, #0x8E \n"
202 "sub %1, %2, %1, lsr #24 \n" 202 "sub %1, %2, %1, lsr #24 \n"
203 "mov %2, %3, lsl #8 \n" 203 "mov %2, %3, lsl #8 \n"
204 "orr %2, %2, #0x80000000 \n" 204 "orr %2, %2, #0x80000000 \n"
205 "mov %1, %2, lsr %1 \n" 205 "mov %1, %2, lsr %1 \n"
206 "it cs \n"
206 "rsbcs %1, %1, #0 \n" 207 "rsbcs %1, %1, #0 \n"
207 : "=r"(x), "=&r"(y), "=&r"(z) 208 : "=r"(x), "=&r"(y), "=&r"(z)
208 : "r"(x) 209 : "r"(x)
209 : "cc" 210 : "cc"
210 ); 211 );
211 return y; 212 return y;
212 } 213 }
213 inline SkFixed SkFixedMul_arm(SkFixed x, SkFixed y) 214 inline SkFixed SkFixedMul_arm(SkFixed x, SkFixed y)
214 { 215 {
215 register int32_t t; 216 register int32_t t;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 #define SkFixed48ToFixed(x) ((SkFixed)((x) >> 32)) 282 #define SkFixed48ToFixed(x) ((SkFixed)((x) >> 32))
282 #define SkFloatToFixed48(x) ((SkFixed48)((x) * (65536.0f * 65536.0f * 65536. 0f))) 283 #define SkFloatToFixed48(x) ((SkFixed48)((x) * (65536.0f * 65536.0f * 65536. 0f)))
283 284
284 #ifdef SK_SCALAR_IS_FLOAT 285 #ifdef SK_SCALAR_IS_FLOAT
285 #define SkScalarToFixed48(x) SkFloatToFixed48(x) 286 #define SkScalarToFixed48(x) SkFloatToFixed48(x)
286 #else 287 #else
287 #define SkScalarToFixed48(x) SkFixedToFixed48(x) 288 #define SkScalarToFixed48(x) SkFixedToFixed48(x)
288 #endif 289 #endif
289 290
290 #endif 291 #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