| 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 20 matching lines...) Expand all Loading... |
| 31 fTimes = (SkTimeCode*) fStorage; | 31 fTimes = (SkTimeCode*) fStorage; |
| 32 fValues = (SkOperand*) ((char*) fStorage + sizeof(SkTimeCode) * frameCount); | 32 fValues = (SkOperand*) ((char*) fStorage + sizeof(SkTimeCode) * frameCount); |
| 33 #ifdef SK_DEBUG | 33 #ifdef SK_DEBUG |
| 34 fTimesArray = (SkTimeCode(*)[10]) fTimes; | 34 fTimesArray = (SkTimeCode(*)[10]) fTimes; |
| 35 fValuesArray = (SkOperand(*)[10]) fValues; | 35 fValuesArray = (SkOperand(*)[10]) fValues; |
| 36 #endif | 36 #endif |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool SkOperandInterpolator::setKeyFrame(int index, SkMSec time, const SkOperand
values[], SkScalar blend) | 39 bool SkOperandInterpolator::setKeyFrame(int index, SkMSec time, const SkOperand
values[], SkScalar blend) |
| 40 { | 40 { |
| 41 SkASSERT(values != NULL); | 41 SkASSERT(values != nullptr); |
| 42 blend = SkScalarPin(blend, 0, SK_Scalar1); | 42 blend = SkScalarPin(blend, 0, SK_Scalar1); |
| 43 | 43 |
| 44 bool success = ~index == SkTSearch<SkMSec>(&fTimes->fTime, index, time, size
of(SkTimeCode)); | 44 bool success = ~index == SkTSearch<SkMSec>(&fTimes->fTime, index, time, size
of(SkTimeCode)); |
| 45 SkASSERT(success); | 45 SkASSERT(success); |
| 46 if (success) { | 46 if (success) { |
| 47 SkTimeCode* timeCode = &fTimes[index]; | 47 SkTimeCode* timeCode = &fTimes[index]; |
| 48 timeCode->fTime = time; | 48 timeCode->fTime = time; |
| 49 timeCode->fBlend[0] = SK_Scalar1 - blend; | 49 timeCode->fBlend[0] = SK_Scalar1 - blend; |
| 50 timeCode->fBlend[1] = 0; | 50 timeCode->fBlend[1] = 0; |
| 51 timeCode->fBlend[2] = 0; | 51 timeCode->fBlend[2] = 0; |
| (...skipping 88 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 |