3 * Copyright 2006 The Android Open Source Project
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
10 #include "SkAnimateSet.h"
11 #include "SkAnimateMaker.h"
12 #include "SkAnimateProperties.h"
15 #if SK_USE_CONDENSED_INFO == 0
17 const SkMemberInfo SkSet::fInfo[] = {
18 SK_MEMBER(begin, MSec),
20 SK_MEMBER_PROPERTY(dynamic, Boolean),
21 SK_MEMBER(field, String),
22 // SK_MEMBER(formula, DynamicString),
23 SK_MEMBER(lval, DynamicString),
24 // SK_MEMBER_PROPERTY(reset, Boolean),
25 SK_MEMBER_PROPERTY(step, Int),
26 SK_MEMBER(target, DynamicString),
27 SK_MEMBER(to, DynamicString)
32 DEFINE_GET_MEMBER(SkSet);
38 #ifdef SK_DUMP_ENABLED
39 void SkSet::dump(SkAnimateMaker* maker) {
40 INHERITED::dump(maker);
42 SkDebugf("dur=\"%g\" ", SkScalarToFloat(SkScalarDiv(dur,1000)));
44 //don't want double />\n's
50 void SkSet::refresh(SkAnimateMaker& maker) {
51 fFieldInfo->setValue(maker, &fValues, 0, fFieldInfo->fCount, NULL,
52 fFieldInfo->getType(), to);
55 void SkSet::onEndElement(SkAnimateMaker& maker) {
56 if (resolveCommon(maker) == false)
58 if (fFieldInfo == NULL) {
59 maker.setErrorCode(SkDisplayXMLParserError::kFieldNotInTarget);
63 SkDisplayTypes outType = fFieldInfo->getType();
64 int comps = outType == SkType_String || outType == SkType_DynamicString ? 1 :
65 (int)fFieldInfo->getSize((const SkDisplayable*) fTarget) / sizeof(int);
66 if (fValues.getType() == SkType_Unknown) {
67 fValues.setType(outType);
68 fValues.setCount(comps);
69 if (outType == SkType_String || outType == SkType_DynamicString)
70 fValues[0].fString = SkNEW(SkString);
72 memset(fValues.begin(), 0, fValues.count() * sizeof(fValues.begin()[0]));
74 SkASSERT(fValues.getType() == outType);
75 if (fFieldInfo->fType == SkType_Array)
76 comps = fValues.count();
78 SkASSERT(fValues.count() == comps);
81 if (formula.size() > 0) {
83 outType = SkType_MSec;
85 fFieldInfo->setValue(maker, &fValues, fFieldOffset, comps, this, outType, formula.size() > 0 ? formula : to);
86 fComponents = fValues.count();