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 9 10 #ifndef SkDisplayApply_DEFINED 11 #define SkDisplayApply_DEFINED 12 13 #include "SkAnimateBase.h" 14 #include "SkADrawable.h" 15 #include "SkIntArray.h" 16 17 class SkActive; 18 19 class SkApply : public SkADrawable { 20 DECLARE_MEMBER_INFO(Apply); 21 public: 22 23 SkApply(); 24 virtual ~SkApply(); 25 26 enum Transition { 27 kTransition_normal, 28 kTransition_reverse 29 }; 30 31 enum Mode { 32 kMode_create, 33 kMode_immediate, 34 //kMode_once 35 }; 36 void activate(SkAnimateMaker& ); 37 void append(SkApply* apply); 38 void appendActive(SkActive* ); 39 void applyValues(int animatorIndex, SkOperand* values, int count, 40 SkDisplayTypes , SkMSec time); 41 bool contains(SkDisplayable*) override; 42 // void createActive(SkAnimateMaker& ); 43 SkDisplayable* deepCopy(SkAnimateMaker* ) override; 44 void disable(); 45 bool draw(SkAnimateMaker& ) override; 46 #ifdef SK_DUMP_ENABLED 47 void dump(SkAnimateMaker* ) override; 48 #endif 49 bool enable(SkAnimateMaker& ) override; 50 void enableCreate(SkAnimateMaker& ); 51 void enableDynamic(SkAnimateMaker& ); 52 void endSave(int index); getMode()53 Mode getMode() { return mode; } 54 bool getProperty(int index, SkScriptValue* value) const override; getScope()55 SkADrawable* getScope() { return scope; } 56 void getStep(SkScriptValue* ); 57 SkADrawable* getTarget(SkAnimateBase* ); 58 bool hasDelayedAnimator() const; 59 bool hasEnable() const override; 60 bool inactivate(SkAnimateMaker& maker); 61 void initialize() override; 62 bool interpolate(SkAnimateMaker& , SkMSec time); 63 void onEndElement(SkAnimateMaker& ) override; 64 const SkMemberInfo* preferredChild(SkDisplayTypes type) override; 65 void refresh(SkAnimateMaker& ); 66 void reset(); 67 bool resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, SkApply* ) override; 68 bool resolveField(SkAnimateMaker& , SkDisplayable* parent, SkString* str); 69 void save(int index); setEmbedded()70 void setEmbedded() { fEmbedded = true; } 71 bool setProperty(int index, SkScriptValue& ) override; 72 void setSteps(int _steps) override; 73 // virtual void setTime(SkMSec time); 74 #ifdef SK_DEBUG 75 void validate() override; 76 #endif 77 private: 78 SkMSec begin; 79 SkBool dontDraw; 80 SkString dynamicScope; 81 SkMSec interval; 82 Mode mode; 83 #if 0 84 SkBool pickup; 85 #endif 86 SkBool restore; 87 SkADrawable* scope; 88 int32_t steps; 89 Transition transition; 90 SkActive* fActive; 91 SkTDAnimateArray fAnimators; 92 // SkADrawable* fCurrentScope; 93 SkMSec fLastTime; // used only to return script property time 94 SkTDDrawableArray fScopes; 95 SkBool fAppended : 1; 96 SkBool fContainsScope : 1; 97 SkBool fDeleteScope : 1; 98 SkBool fEmbedded : 1; 99 SkBool fEnabled : 1; 100 SkBool fEnabling : 1; // set if calling interpolate from enable 101 friend class SkActive; 102 friend class SkDisplayList; 103 typedef SkADrawable INHERITED; 104 }; 105 106 #endif // SkDisplayApply_DEFINED 107