OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
4 * | 3 * |
5 * 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 |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 | 7 |
9 | |
10 #include "SkOperandInterpolator.h" | 8 #include "SkOperandInterpolator.h" |
11 #include "SkScript.h" | 9 #include "SkScript.h" |
12 | 10 |
13 SkOperandInterpolator::SkOperandInterpolator() { | 11 SkOperandInterpolator::SkOperandInterpolator() { |
14 INHERITED::reset(0, 0); | 12 INHERITED::reset(0, 0); |
15 fType = SkType_Unknown; | 13 fType = SkType_Unknown; |
16 } | 14 } |
17 | 15 |
18 SkOperandInterpolator::SkOperandInterpolator(int elemCount, int frameCount, | 16 SkOperandInterpolator::SkOperandInterpolator(int elemCount, int frameCount, |
19 SkDisplayTypes type) | 17 SkDisplayTypes type) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 SkOperand* dst = &fValues[fElemCount * index]; | 51 SkOperand* dst = &fValues[fElemCount * index]; |
54 memcpy(dst, values, fElemCount * sizeof(SkOperand)); | 52 memcpy(dst, values, fElemCount * sizeof(SkOperand)); |
55 } | 53 } |
56 return success; | 54 return success; |
57 } | 55 } |
58 | 56 |
59 SkInterpolatorBase::Result SkOperandInterpolator::timeToValues(SkMSec time, SkOp
erand values[]) const | 57 SkInterpolatorBase::Result SkOperandInterpolator::timeToValues(SkMSec time, SkOp
erand values[]) const |
60 { | 58 { |
61 SkScalar T; | 59 SkScalar T; |
62 int index; | 60 int index; |
63 SkBool exact; | 61 bool exact; |
64 Result result = timeToT(time, &T, &index, &exact); | 62 Result result = timeToT(time, &T, &index, &exact); |
65 if (values) | 63 if (values) |
66 { | 64 { |
67 const SkOperand* nextSrc = &fValues[index * fElemCount]; | 65 const SkOperand* nextSrc = &fValues[index * fElemCount]; |
68 | 66 |
69 if (exact) | 67 if (exact) |
70 memcpy(values, nextSrc, fElemCount * sizeof(SkScalar)); | 68 memcpy(values, nextSrc, fElemCount * sizeof(SkScalar)); |
71 else | 69 else |
72 { | 70 { |
73 SkASSERT(index > 0); | 71 SkASSERT(index > 0); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 SkASSERT(memcmp(v, iset(vv, 60, 120, 180), sizeof(v)) == 0); | 138 SkASSERT(memcmp(v, iset(vv, 60, 120, 180), sizeof(v)) == 0); |
141 | 139 |
142 result = inter.timeToValues(125, v); | 140 result = inter.timeToValues(125, v); |
143 SkASSERT(result == kNormal_Result); | 141 SkASSERT(result == kNormal_Result); |
144 result = inter.timeToValues(175, v); | 142 result = inter.timeToValues(175, v); |
145 SkASSERT(result == kNormal_Result); | 143 SkASSERT(result == kNormal_Result); |
146 #endif | 144 #endif |
147 } | 145 } |
148 | 146 |
149 #endif | 147 #endif |
OLD | NEW |