1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/animator/SkAnimateBase.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,83 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2006 The Android Open Source Project 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 + 1.12 + 1.13 +#ifndef SkAnimateBase_DEFINED 1.14 +#define SkAnimateBase_DEFINED 1.15 + 1.16 +#include "SkDisplayable.h" 1.17 +#include "SkMath.h" 1.18 +#include "SkMemberInfo.h" 1.19 +#include "SkTypedArray.h" 1.20 + 1.21 +class SkApply; 1.22 +class SkDrawable; 1.23 + 1.24 +class SkAnimateBase : public SkDisplayable { 1.25 +public: 1.26 + DECLARE_MEMBER_INFO(AnimateBase); 1.27 + SkAnimateBase(); 1.28 + virtual ~SkAnimateBase(); 1.29 + virtual int components(); 1.30 + virtual SkDisplayable* deepCopy(SkAnimateMaker* ); 1.31 + virtual void dirty(); 1.32 +#ifdef SK_DUMP_ENABLED 1.33 + virtual void dump(SkAnimateMaker* ); 1.34 +#endif 1.35 + int entries() { return fValues.count() / components(); } 1.36 + virtual bool hasExecute() const; 1.37 + bool isDynamic() const { return SkToBool(fDynamic); } 1.38 + virtual SkDisplayable* getParent() const; 1.39 + virtual bool getProperty(int index, SkScriptValue* value) const; 1.40 + SkMSec getStart() const { return fStart; } 1.41 + SkOperand* getValues() { return fValues.begin(); } 1.42 + SkDisplayTypes getValuesType() { return fValues.getType(); } 1.43 + virtual void onEndElement(SkAnimateMaker& ); 1.44 + void packARGB(SkScalar [], int count, SkTDOperandArray* ); 1.45 + virtual void refresh(SkAnimateMaker& ); 1.46 + void setChanged(bool changed) { fChanged = changed; } 1.47 + void setHasEndEvent() { fHasEndEvent = true; } 1.48 + virtual bool setParent(SkDisplayable* ); 1.49 + virtual bool setProperty(int index, SkScriptValue& value); 1.50 + void setTarget(SkAnimateMaker& ); 1.51 + virtual bool targetNeedsInitialization() const; 1.52 +protected: 1.53 + SkMSec begin; 1.54 + SkTDScalarArray blend; 1.55 + SkMSec dur; 1.56 + // !!! make field part of a union with fFieldInfo, or fValues, something known later? 1.57 + SkString field; // temporary; once target is known, this is reset 1.58 + SkString formula; 1.59 + SkString from; 1.60 + SkString lval; 1.61 + SkScalar repeat; 1.62 + SkString target; // temporary; once target is known, this is reset 1.63 + SkString to; 1.64 + SkApply* fApply; 1.65 + const SkMemberInfo* fFieldInfo; 1.66 + int fFieldOffset; 1.67 + SkMSec fStart; // corrected time when this apply was enabled 1.68 + SkDrawable* fTarget; 1.69 + SkTypedArray fValues; 1.70 + unsigned fChanged : 1; // true when value referenced by script has changed 1.71 + unsigned fDelayed : 1; // enabled, but undrawn pending delay 1.72 + unsigned fDynamic : 1; 1.73 + unsigned fHasEndEvent : 1; 1.74 + unsigned fHasValues : 1; // set if 'values' passed instead of 'to' 1.75 + unsigned fMirror : 1; 1.76 + unsigned fReset : 1; 1.77 + unsigned fResetPending : 1; 1.78 + unsigned fTargetIsScope : 1; 1.79 +private: 1.80 + typedef SkDisplayable INHERITED; 1.81 + friend class SkActive; 1.82 + friend class SkApply; 1.83 + friend class SkDisplayList; 1.84 +}; 1.85 + 1.86 +#endif // SkAnimateBase_DEFINED