OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 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 "SkInterpolator.h" | 10 #include "SkInterpolator.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 #ifdef SK_DEBUG | 148 #ifdef SK_DEBUG |
149 fTimesArray = (SkTimeCode(*)[10]) fTimes; | 149 fTimesArray = (SkTimeCode(*)[10]) fTimes; |
150 fScalarsArray = (SkScalar(*)[10]) fValues; | 150 fScalarsArray = (SkScalar(*)[10]) fValues; |
151 #endif | 151 #endif |
152 } | 152 } |
153 | 153 |
154 #define SK_Fixed1Third (SK_Fixed1/3) | 154 #define SK_Fixed1Third (SK_Fixed1/3) |
155 #define SK_Fixed2Third (SK_Fixed1*2/3) | 155 #define SK_Fixed2Third (SK_Fixed1*2/3) |
156 | 156 |
157 static const SkScalar gIdentityBlend[4] = { | 157 static const SkScalar gIdentityBlend[4] = { |
158 #ifdef SK_SCALAR_IS_FLOAT | |
159 0.33333333f, 0.33333333f, 0.66666667f, 0.66666667f | 158 0.33333333f, 0.33333333f, 0.66666667f, 0.66666667f |
160 #else | |
161 SK_Fixed1Third, SK_Fixed1Third, SK_Fixed2Third, SK_Fixed2Third | |
162 #endif | |
163 }; | 159 }; |
164 | 160 |
165 bool SkInterpolator::setKeyFrame(int index, SkMSec time, | 161 bool SkInterpolator::setKeyFrame(int index, SkMSec time, |
166 const SkScalar values[], const SkScalar blend[4]) { | 162 const SkScalar values[], const SkScalar blend[4]) { |
167 SkASSERT(values != NULL); | 163 SkASSERT(values != NULL); |
168 | 164 |
169 if (blend == NULL) { | 165 if (blend == NULL) { |
170 blend = gIdentityBlend; | 166 blend = gIdentityBlend; |
171 } | 167 } |
172 | 168 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 SkASSERT(memcmp(v, iset(vv, 60, 120, 180), sizeof(v)) == 0); | 318 SkASSERT(memcmp(v, iset(vv, 60, 120, 180), sizeof(v)) == 0); |
323 | 319 |
324 result = inter.timeToValues(125, v); | 320 result = inter.timeToValues(125, v); |
325 SkASSERT(result == kNormal_Result); | 321 SkASSERT(result == kNormal_Result); |
326 result = inter.timeToValues(175, v); | 322 result = inter.timeToValues(175, v); |
327 SkASSERT(result == kNormal_Result); | 323 SkASSERT(result == kNormal_Result); |
328 #endif | 324 #endif |
329 } | 325 } |
330 | 326 |
331 #endif | 327 #endif |
OLD | NEW |