OLD | NEW |
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 #include "SkOperandInterpolator.h" | 10 #include "SkOperandInterpolator.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 const SkOperand* prevSrc = nextSrc - fElemCount; | 75 const SkOperand* prevSrc = nextSrc - fElemCount; |
76 | 76 |
77 if (fType == SkType_Float || fType == SkType_3D_Point) { | 77 if (fType == SkType_Float || fType == SkType_3D_Point) { |
78 for (int i = fElemCount - 1; i >= 0; --i) | 78 for (int i = fElemCount - 1; i >= 0; --i) |
79 values[i].fScalar = SkScalarInterp(prevSrc[i].fScalar, nextS
rc[i].fScalar, T); | 79 values[i].fScalar = SkScalarInterp(prevSrc[i].fScalar, nextS
rc[i].fScalar, T); |
80 } else if (fType == SkType_Int || fType == SkType_MSec) { | 80 } else if (fType == SkType_Int || fType == SkType_MSec) { |
81 for (int i = fElemCount - 1; i >= 0; --i) { | 81 for (int i = fElemCount - 1; i >= 0; --i) { |
82 int32_t a = prevSrc[i].fS32; | 82 int32_t a = prevSrc[i].fS32; |
83 int32_t b = nextSrc[i].fS32; | 83 int32_t b = nextSrc[i].fS32; |
84 values[i].fS32 = a + SkScalarRound((b - a) * T); | 84 values[i].fS32 = a + SkScalarRoundToInt((b - a) * T); |
85 } | 85 } |
86 } else | 86 } else |
87 memcpy(values, prevSrc, sizeof(SkOperand) * fElemCount); | 87 memcpy(values, prevSrc, sizeof(SkOperand) * fElemCount); |
88 } | 88 } |
89 } | 89 } |
90 return result; | 90 return result; |
91 } | 91 } |
92 | 92 |
93 ////////////////////////////////////////////////////////////////////////////////
/////// | 93 ////////////////////////////////////////////////////////////////////////////////
/////// |
94 ////////////////////////////////////////////////////////////////////////////////
/////// | 94 ////////////////////////////////////////////////////////////////////////////////
/////// |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 SkASSERT(memcmp(v, iset(vv, 60, 120, 180), sizeof(v)) == 0); | 140 SkASSERT(memcmp(v, iset(vv, 60, 120, 180), sizeof(v)) == 0); |
141 | 141 |
142 result = inter.timeToValues(125, v); | 142 result = inter.timeToValues(125, v); |
143 SkASSERT(result == kNormal_Result); | 143 SkASSERT(result == kNormal_Result); |
144 result = inter.timeToValues(175, v); | 144 result = inter.timeToValues(175, v); |
145 SkASSERT(result == kNormal_Result); | 145 SkASSERT(result == kNormal_Result); |
146 #endif | 146 #endif |
147 } | 147 } |
148 | 148 |
149 #endif | 149 #endif |
OLD | NEW |