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

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

Issue 113873008: remove unused SkFixed and SkFract functions (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 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
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 SkMathPriv_DEFINED 8 #ifndef SkMathPriv_DEFINED
9 #define SkMathPriv_DEFINED 9 #define SkMathPriv_DEFINED
10 10
(...skipping 21 matching lines...) Expand all
32 Note: only works as long as max - value doesn't wrap around 32 Note: only works as long as max - value doesn't wrap around
33 @return max if value >= max, else value 33 @return max if value >= max, else value
34 */ 34 */
35 static inline unsigned SkClampUMax(unsigned value, unsigned max) { 35 static inline unsigned SkClampUMax(unsigned value, unsigned max) {
36 if (value > max) { 36 if (value > max) {
37 value = max; 37 value = max;
38 } 38 }
39 return value; 39 return value;
40 } 40 }
41 41
42 /** Computes the 64bit product of a * b, and then shifts the answer down by
43 shift bits, returning the low 32bits. shift must be [0..63]
44 e.g. to perform a fixedmul, call SkMulShift(a, b, 16)
45 */
46 int32_t SkMulShift(int32_t a, int32_t b, unsigned shift);
47
48 /** Return the integer cube root of value, with a bias of bitBias
49 */
50 int32_t SkCubeRootBits(int32_t value, int bitBias);
51
52 /////////////////////////////////////////////////////////////////////////////// 42 ///////////////////////////////////////////////////////////////////////////////
53 43
54 /** Return a*b/255, truncating away any fractional bits. Only valid if both 44 /** Return a*b/255, truncating away any fractional bits. Only valid if both
55 a and b are 0..255 45 a and b are 0..255
56 */ 46 */
57 static inline U8CPU SkMulDiv255Trunc(U8CPU a, U8CPU b) { 47 static inline U8CPU SkMulDiv255Trunc(U8CPU a, U8CPU b) {
58 SkASSERT((uint8_t)a == a); 48 SkASSERT((uint8_t)a == a);
59 SkASSERT((uint8_t)b == b); 49 SkASSERT((uint8_t)b == b);
60 unsigned prod = SkMulS16(a, b) + 1; 50 unsigned prod = SkMulS16(a, b) + 1;
61 return (prod + (prod >> 8)) >> 8; 51 return (prod + (prod >> 8)) >> 8;
(...skipping 10 matching lines...) Expand all
72 } 62 }
73 63
74 /** Just the rounding step in SkDiv255Round: round(value / 255) 64 /** Just the rounding step in SkDiv255Round: round(value / 255)
75 */ 65 */
76 static inline unsigned SkDiv255Round(unsigned prod) { 66 static inline unsigned SkDiv255Round(unsigned prod) {
77 prod += 128; 67 prod += 128;
78 return (prod + (prod >> 8)) >> 8; 68 return (prod + (prod >> 8)) >> 8;
79 } 69 }
80 70
81 #endif 71 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698