1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com/*
3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2006 The Android Open Source Project
4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com *
5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be
6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file.
7ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com */
8ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SkAnimateBase_DEFINED
118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SkAnimateBase_DEFINED
128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDisplayable.h"
148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkMath.h"
158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkMemberInfo.h"
168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkTypedArray.h"
178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkApply;
198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkDrawable;
208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkAnimateBase : public SkDisplayable {
228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.compublic:
238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    DECLARE_MEMBER_INFO(AnimateBase);
248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkAnimateBase();
258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual ~SkAnimateBase();
268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual int components();
278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual SkDisplayable* deepCopy(SkAnimateMaker* );
288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual void dirty();
298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifdef SK_DUMP_ENABLED
308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual void dump(SkAnimateMaker* );
318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    int entries() { return fValues.count() / components(); }
338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual bool hasExecute() const;
348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    bool isDynamic() const { return SkToBool(fDynamic); }
358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual SkDisplayable* getParent() const;
368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual bool getProperty(int index, SkScriptValue* value) const;
378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkMSec getStart() const { return fStart; }
388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkOperand* getValues() { return fValues.begin(); }
398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkDisplayTypes getValuesType() { return fValues.getType(); }
408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual void onEndElement(SkAnimateMaker& );
418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void packARGB(SkScalar [], int count, SkTDOperandArray* );
428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual void refresh(SkAnimateMaker& );
438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void setChanged(bool changed) { fChanged = changed; }
448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void setHasEndEvent() { fHasEndEvent = true; }
458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual bool setParent(SkDisplayable* );
468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual bool setProperty(int index, SkScriptValue& value);
478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void setTarget(SkAnimateMaker& );
488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual bool targetNeedsInitialization() const;
498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprotected:
508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkMSec begin;
518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkTDScalarArray blend;
528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkMSec dur;
538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // !!! make field part of a union with fFieldInfo, or fValues, something known later?
548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkString field; // temporary; once target is known, this is reset
558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkString formula;
568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkString from;
578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkString lval;
588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkScalar repeat;
598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkString target;    // temporary; once target is known, this is reset
608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkString to;
618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkApply* fApply;
628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    const SkMemberInfo* fFieldInfo;
638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    int fFieldOffset;
648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkMSec fStart;  // corrected time when this apply was enabled
658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkDrawable* fTarget;
668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    SkTypedArray fValues;
678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    unsigned fChanged : 1; // true when value referenced by script has changed
688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    unsigned fDelayed : 1;  // enabled, but undrawn pending delay
698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    unsigned fDynamic : 1;
708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    unsigned fHasEndEvent : 1;
718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    unsigned fHasValues : 1;        // set if 'values' passed instead of 'to'
728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    unsigned fMirror : 1;
738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    unsigned fReset : 1;
748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    unsigned fResetPending : 1;
758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    unsigned fTargetIsScope : 1;
768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprivate:
778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    typedef SkDisplayable INHERITED;
788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    friend class SkActive;
798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    friend class SkApply;
808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    friend class SkDisplayList;
818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com};
828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif // SkAnimateBase_DEFINED
84