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 "SkAnimateBase.h" | 10 #include "SkAnimateBase.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 SK_MEMBER(target, DynamicString), | 32 SK_MEMBER(target, DynamicString), |
33 SK_MEMBER(to, DynamicString), | 33 SK_MEMBER(to, DynamicString), |
34 SK_MEMBER_PROPERTY(values, DynamicString) | 34 SK_MEMBER_PROPERTY(values, DynamicString) |
35 }; | 35 }; |
36 | 36 |
37 #endif | 37 #endif |
38 | 38 |
39 DEFINE_GET_MEMBER(SkAnimateBase); | 39 DEFINE_GET_MEMBER(SkAnimateBase); |
40 | 40 |
41 SkAnimateBase::SkAnimateBase() : begin(0), dur(1), repeat(SK_Scalar1), | 41 SkAnimateBase::SkAnimateBase() : begin(0), dur(1), repeat(SK_Scalar1), |
42 fApply(NULL), fFieldInfo(NULL), fFieldOffset(0), fStart((SkMSec) -1), fT
arget(NULL), | 42 fApply(nullptr), fFieldInfo(nullptr), fFieldOffset(0), fStart((SkMSec) -
1), fTarget(nullptr), |
43 fChanged(0), fDelayed(0), fDynamic(0), fHasEndEvent(0), fHasValues(0), | 43 fChanged(0), fDelayed(0), fDynamic(0), fHasEndEvent(0), fHasValues(0), |
44 fMirror(0), fReset(0), fResetPending(0), fTargetIsScope(0) { | 44 fMirror(0), fReset(0), fResetPending(0), fTargetIsScope(0) { |
45 blend.setCount(1); | 45 blend.setCount(1); |
46 blend[0] = SK_Scalar1; | 46 blend[0] = SK_Scalar1; |
47 } | 47 } |
48 | 48 |
49 SkAnimateBase::~SkAnimateBase() { | 49 SkAnimateBase::~SkAnimateBase() { |
50 SkDisplayTypes type = fValues.getType(); | 50 SkDisplayTypes type = fValues.getType(); |
51 if (type == SkType_String || type == SkType_DynamicString) { | 51 if (type == SkType_String || type == SkType_DynamicString) { |
52 SkASSERT(fValues.count() == 1); | 52 SkASSERT(fValues.count() == 1); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 case SK_PROPERTY(mirror): | 109 case SK_PROPERTY(mirror): |
110 boolResult = fMirror; | 110 boolResult = fMirror; |
111 goto returnBool; | 111 goto returnBool; |
112 case SK_PROPERTY(reset): | 112 case SK_PROPERTY(reset): |
113 boolResult = fReset; | 113 boolResult = fReset; |
114 returnBool: | 114 returnBool: |
115 value->fOperand.fS32 = SkToBool(boolResult); | 115 value->fOperand.fS32 = SkToBool(boolResult); |
116 value->fType = SkType_Boolean; | 116 value->fType = SkType_Boolean; |
117 break; | 117 break; |
118 case SK_PROPERTY(step): | 118 case SK_PROPERTY(step): |
119 if (fApply == NULL) | 119 if (fApply == nullptr) |
120 return false; // !!! notify there's an error? | 120 return false; // !!! notify there's an error? |
121 fApply->getStep(value); | 121 fApply->getStep(value); |
122 break; | 122 break; |
123 case SK_PROPERTY(values): | 123 case SK_PROPERTY(values): |
124 value->fOperand.fString = (SkString*) &to; | 124 value->fOperand.fString = (SkString*) &to; |
125 value->fType = SkType_String; | 125 value->fType = SkType_String; |
126 break; | 126 break; |
127 default: | 127 default: |
128 SkASSERT(0); | 128 SkASSERT(0); |
129 return false; | 129 return false; |
(...skipping 11 matching lines...) Expand all Loading... |
141 setTarget(maker); | 141 setTarget(maker); |
142 if (field.size()) { | 142 if (field.size()) { |
143 SkASSERT(fTarget); | 143 SkASSERT(fTarget); |
144 fFieldInfo = fTarget->getMember(field.c_str()); | 144 fFieldInfo = fTarget->getMember(field.c_str()); |
145 field.reset(); | 145 field.reset(); |
146 } | 146 } |
147 if (lval.size()) { | 147 if (lval.size()) { |
148 // lval must be of the form x[y] | 148 // lval must be of the form x[y] |
149 const char* lvalStr = lval.c_str(); | 149 const char* lvalStr = lval.c_str(); |
150 const char* arrayEnd = strchr(lvalStr, '['); | 150 const char* arrayEnd = strchr(lvalStr, '['); |
151 if (arrayEnd == NULL) | 151 if (arrayEnd == nullptr) |
152 return; //should this return an error? | 152 return; //should this return an error? |
153 size_t arrayNameLen = arrayEnd - lvalStr; | 153 size_t arrayNameLen = arrayEnd - lvalStr; |
154 SkString arrayStr(lvalStr, arrayNameLen); | 154 SkString arrayStr(lvalStr, arrayNameLen); |
155 SkASSERT(fTarget); //this return an error? | 155 SkASSERT(fTarget); //this return an error? |
156 fFieldInfo = fTarget->getMember(arrayStr.c_str()); | 156 fFieldInfo = fTarget->getMember(arrayStr.c_str()); |
157 SkString scriptStr(arrayEnd + 1, lval.size() - arrayNameLen - 2); | 157 SkString scriptStr(arrayEnd + 1, lval.size() - arrayNameLen - 2); |
158 SkAnimatorScript::EvaluateInt(maker, this, scriptStr.c_str(), &fFieldOff
set); | 158 SkAnimatorScript::EvaluateInt(maker, this, scriptStr.c_str(), &fFieldOff
set); |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 return; | 226 return; |
227 } | 227 } |
228 if (fApply && fApply->getMode() != SkApply::kMode_create) | 228 if (fApply && fApply->getMode() != SkApply::kMode_create) |
229 target.reset(); | 229 target.reset(); |
230 } | 230 } |
231 } | 231 } |
232 | 232 |
233 bool SkAnimateBase::targetNeedsInitialization() const { | 233 bool SkAnimateBase::targetNeedsInitialization() const { |
234 return false; | 234 return false; |
235 } | 235 } |
OLD | NEW |