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 "SkAnimateActive.h" | 10 #include "SkAnimateActive.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // duration = value.fOperand.fS32 * SK_MSec1; | 157 // duration = value.fOperand.fS32 * SK_MSec1; |
158 // break; | 158 // break; |
159 // } | 159 // } |
160 } | 160 } |
161 state.fDuration = duration; | 161 state.fDuration = duration; |
162 SkMSec maxTime = state.fBegin + duration; | 162 SkMSec maxTime = state.fBegin + duration; |
163 if (fMaxTime < maxTime) | 163 if (fMaxTime < maxTime) |
164 fMaxTime = maxTime; | 164 fMaxTime = maxTime; |
165 } | 165 } |
166 | 166 |
167 void SkActive::create(SkDrawable* drawable, SkMSec time) { | 167 void SkActive::create(SkADrawable* drawable, SkMSec time) { |
168 fApply.fLastTime = time; | 168 fApply.fLastTime = time; |
169 fApply.refresh(fMaker); | 169 fApply.refresh(fMaker); |
170 for (int index = 0; index < fAnimators.count(); index++) { | 170 for (int index = 0; index < fAnimators.count(); index++) { |
171 SkAnimateBase* animate = fAnimators[index]; | 171 SkAnimateBase* animate = fAnimators[index]; |
172 SkOperandInterpolator& interpolator = *fInterpolators[index]; | 172 SkOperandInterpolator& interpolator = *fInterpolators[index]; |
173 int count = animate->components(); | 173 int count = animate->components(); |
174 if (animate->formula.size() > 0) { | 174 if (animate->formula.size() > 0) { |
175 SkTDOperandArray values; | 175 SkTDOperandArray values; |
176 values.setCount(count); | 176 values.setCount(count); |
177 SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMaker, &
values, 0, 0, NULL, | 177 SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMaker, &
values, 0, 0, NULL, |
178 animate->getValuesType(), animate->formula); | 178 animate->getValuesType(), animate->formula); |
179 SkASSERT(success); | 179 SkASSERT(success); |
180 fApply.applyValues(index, values.begin(), count, animate->getValuesT
ype(), time); | 180 fApply.applyValues(index, values.begin(), count, animate->getValuesT
ype(), time); |
181 } else { | 181 } else { |
182 SkAutoSTMalloc<16, SkOperand> values(count); | 182 SkAutoSTMalloc<16, SkOperand> values(count); |
183 interpolator.timeToValues(time, values.get()); | 183 interpolator.timeToValues(time, values.get()); |
184 fApply.applyValues(index, values.get(), count, animate->getValuesTyp
e(), time); | 184 fApply.applyValues(index, values.get(), count, animate->getValuesTyp
e(), time); |
185 } | 185 } |
186 } | 186 } |
187 drawable->enable(fMaker); | 187 drawable->enable(fMaker); |
188 SkASSERT(fAnimators.count() == fInterpolators.count()); | 188 SkASSERT(fAnimators.count() == fInterpolators.count()); |
189 } | 189 } |
190 | 190 |
191 bool SkActive::immediate(bool enable) { | 191 bool SkActive::immediate(bool enable) { |
192 SkMSec time = 0; | 192 SkMSec time = 0; |
193 bool result = false; | 193 bool result = false; |
194 SkDrawable* drawable = fApply.scope; | 194 SkADrawable* drawable = fApply.scope; |
195 SkMSec final = fMaxTime; | 195 SkMSec final = fMaxTime; |
196 do { | 196 do { |
197 bool applied = fAnimators.count() == 0; | 197 bool applied = fAnimators.count() == 0; |
198 fApply.fLastTime = time; | 198 fApply.fLastTime = time; |
199 fApply.refresh(fMaker); | 199 fApply.refresh(fMaker); |
200 for (int index = 0; index < fAnimators.count(); index++) { | 200 for (int index = 0; index < fAnimators.count(); index++) { |
201 SkAnimateBase* animate = fAnimators[index]; | 201 SkAnimateBase* animate = fAnimators[index]; |
202 SkState& state = fState[index]; | 202 SkState& state = fState[index]; |
203 if (state.fMode != SkApply::kMode_immediate) | 203 if (state.fMode != SkApply::kMode_immediate) |
204 continue; | 204 continue; |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 // result = fSave; | 495 // result = fSave; |
496 // else | 496 // else |
497 if (fTransition == SkApply::kTransition_reverse) { | 497 if (fTransition == SkApply::kTransition_reverse) { |
498 if (SkMSec_LT(fDuration, time)) | 498 if (SkMSec_LT(fDuration, time)) |
499 result = 0; | 499 result = 0; |
500 else | 500 else |
501 result = fDuration - time; | 501 result = fDuration - time; |
502 } | 502 } |
503 return result; | 503 return result; |
504 } | 504 } |
OLD | NEW |