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 13 matching lines...) Expand all Loading... |
24 | 24 |
25 void SkActive::init() | 25 void SkActive::init() |
26 { | 26 { |
27 fAnimators = fApply.fAnimators; | 27 fAnimators = fApply.fAnimators; |
28 int animators = fAnimators.count(); | 28 int animators = fAnimators.count(); |
29 fInterpolators.setCount(animators); | 29 fInterpolators.setCount(animators); |
30 memset(fInterpolators.begin(), 0, animators * sizeof(SkOperandInterpolator*)
); | 30 memset(fInterpolators.begin(), 0, animators * sizeof(SkOperandInterpolator*)
); |
31 fState.setCount(animators); | 31 fState.setCount(animators); |
32 int index; | 32 int index; |
33 for (index = 0; index < animators; index++) | 33 for (index = 0; index < animators; index++) |
34 fInterpolators[index] = SkNEW(SkOperandInterpolator); | 34 fInterpolators[index] = new SkOperandInterpolator; |
35 initState(&fApply, 0); | 35 initState(&fApply, 0); |
36 // for (index = 0; index < animators; index++) | 36 // for (index = 0; index < animators; index++) |
37 // fState[index].bumpSave(); | 37 // fState[index].bumpSave(); |
38 SkASSERT(fInterpolators.count() == fAnimators.count()); | 38 SkASSERT(fInterpolators.count() == fAnimators.count()); |
39 } | 39 } |
40 | 40 |
41 SkActive::~SkActive() { | 41 SkActive::~SkActive() { |
42 int index; | 42 int index; |
43 for (index = 0; index < fSaveRestore.count(); index++) | 43 for (index = 0; index < fSaveRestore.count(); index++) |
44 delete[] fSaveRestore[index]; | 44 delete[] fSaveRestore[index]; |
(...skipping 13 matching lines...) Expand all Loading... |
58 int oldCount = fAnimators.count(); | 58 int oldCount = fAnimators.count(); |
59 SkTDAnimateArray& animates = apply->fAnimators; | 59 SkTDAnimateArray& animates = apply->fAnimators; |
60 int newCount = animates.count(); | 60 int newCount = animates.count(); |
61 int index; | 61 int index; |
62 int total = oldCount + newCount; | 62 int total = oldCount + newCount; |
63 if (total == 0) | 63 if (total == 0) |
64 return; | 64 return; |
65 fInterpolators.setCount(total); | 65 fInterpolators.setCount(total); |
66 memset(&fInterpolators.begin()[oldCount], 0, newCount * sizeof(SkOperandInte
rpolator*)); | 66 memset(&fInterpolators.begin()[oldCount], 0, newCount * sizeof(SkOperandInte
rpolator*)); |
67 for (index = oldCount; index < total; index++) | 67 for (index = oldCount; index < total; index++) |
68 fInterpolators[index] = SkNEW(SkOperandInterpolator); | 68 fInterpolators[index] = new SkOperandInterpolator; |
69 fAnimators.setCount(total); | 69 fAnimators.setCount(total); |
70 memcpy(&fAnimators[oldCount], animates.begin(), sizeof(fAnimators[0]) * | 70 memcpy(&fAnimators[oldCount], animates.begin(), sizeof(fAnimators[0]) * |
71 newCount); | 71 newCount); |
72 fState.setCount(total); | 72 fState.setCount(total); |
73 initState(apply, oldCount); | 73 initState(apply, oldCount); |
74 SkASSERT(fApply.scope == apply->scope); | 74 SkASSERT(fApply.scope == apply->scope); |
75 for (index = 0; index < newCount; index++) { | 75 for (index = 0; index < newCount; index++) { |
76 SkAnimateBase* test = animates[index]; | 76 SkAnimateBase* test = animates[index]; |
77 // SkASSERT(fApply.scope == test->fTarget || fApply.scope->contains(test->f
Target)); | 77 // SkASSERT(fApply.scope == test->fTarget || fApply.scope->contains(test->f
Target)); |
78 SkActive::SkState& testState = fState[oldCount + index]; | 78 SkActive::SkState& testState = fState[oldCount + index]; |
(...skipping 416 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 |