epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2006 The Android Open Source Project |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 9 | |
| 10 | #ifndef SkAnimateBase_DEFINED |
| 11 | #define SkAnimateBase_DEFINED |
| 12 | |
| 13 | #include "SkDisplayable.h" |
| 14 | #include "SkMath.h" |
| 15 | #include "SkMemberInfo.h" |
| 16 | #include "SkTypedArray.h" |
| 17 | |
| 18 | class SkApply; |
reed | 986ca61 | 2014-11-26 08:50:45 -0800 | [diff] [blame] | 19 | class SkADrawable; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 20 | |
| 21 | class SkAnimateBase : public SkDisplayable { |
| 22 | public: |
| 23 | DECLARE_MEMBER_INFO(AnimateBase); |
| 24 | SkAnimateBase(); |
| 25 | virtual ~SkAnimateBase(); |
| 26 | virtual int components(); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 27 | SkDisplayable* deepCopy(SkAnimateMaker* ) override; |
| 28 | void dirty() override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 29 | #ifdef SK_DUMP_ENABLED |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 30 | void dump(SkAnimateMaker* ) override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 31 | #endif |
| 32 | int entries() { return fValues.count() / components(); } |
| 33 | virtual bool hasExecute() const; |
| 34 | bool isDynamic() const { return SkToBool(fDynamic); } |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 35 | SkDisplayable* getParent() const override; |
| 36 | bool getProperty(int index, SkScriptValue* value) const override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 37 | SkMSec getStart() const { return fStart; } |
| 38 | SkOperand* getValues() { return fValues.begin(); } |
| 39 | SkDisplayTypes getValuesType() { return fValues.getType(); } |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 40 | void onEndElement(SkAnimateMaker& ) override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 41 | void packARGB(SkScalar [], int count, SkTDOperandArray* ); |
| 42 | virtual void refresh(SkAnimateMaker& ); |
| 43 | void setChanged(bool changed) { fChanged = changed; } |
| 44 | void setHasEndEvent() { fHasEndEvent = true; } |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 45 | bool setParent(SkDisplayable* ) override; |
| 46 | bool setProperty(int index, SkScriptValue& value) override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 47 | void setTarget(SkAnimateMaker& ); |
| 48 | virtual bool targetNeedsInitialization() const; |
| 49 | protected: |
| 50 | SkMSec begin; |
| 51 | SkTDScalarArray blend; |
| 52 | SkMSec dur; |
| 53 | // !!! make field part of a union with fFieldInfo, or fValues, something known later? |
| 54 | SkString field; // temporary; once target is known, this is reset |
| 55 | SkString formula; |
| 56 | SkString from; |
| 57 | SkString lval; |
| 58 | SkScalar repeat; |
| 59 | SkString target; // temporary; once target is known, this is reset |
| 60 | SkString to; |
| 61 | SkApply* fApply; |
| 62 | const SkMemberInfo* fFieldInfo; |
| 63 | int fFieldOffset; |
| 64 | SkMSec fStart; // corrected time when this apply was enabled |
reed | 986ca61 | 2014-11-26 08:50:45 -0800 | [diff] [blame] | 65 | SkADrawable* fTarget; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 66 | SkTypedArray fValues; |
| 67 | unsigned fChanged : 1; // true when value referenced by script has changed |
| 68 | unsigned fDelayed : 1; // enabled, but undrawn pending delay |
| 69 | unsigned fDynamic : 1; |
| 70 | unsigned fHasEndEvent : 1; |
| 71 | unsigned fHasValues : 1; // set if 'values' passed instead of 'to' |
| 72 | unsigned fMirror : 1; |
| 73 | unsigned fReset : 1; |
| 74 | unsigned fResetPending : 1; |
| 75 | unsigned fTargetIsScope : 1; |
| 76 | private: |
| 77 | typedef SkDisplayable INHERITED; |
| 78 | friend class SkActive; |
| 79 | friend class SkApply; |
| 80 | friend class SkDisplayList; |
| 81 | }; |
| 82 | |
| 83 | #endif // SkAnimateBase_DEFINED |