1 /* 2 * Copyright 2006 The Android Open Source Project 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkDisplayTypes_DEFINED 9 #define SkDisplayTypes_DEFINED 10 11 #include "SkDisplayable.h" 12 #include "SkMemberInfo.h" 13 #include "SkTypedArray.h" 14 15 class SkOpArray; // compiled script experiment 16 17 18 class SkDisplayDepend : public SkDisplayable { 19 public: 20 virtual bool canContainDependents() const; addDependent(SkDisplayable * displayable)21 void addDependent(SkDisplayable* displayable) { 22 if (fDependents.find(displayable) < 0) 23 *fDependents.append() = displayable; 24 } 25 virtual void dirty(); 26 private: 27 SkTDDisplayableArray fDependents; 28 typedef SkDisplayable INHERITED; 29 }; 30 31 class SkDisplayBoolean : public SkDisplayDepend { 32 DECLARE_DISPLAY_MEMBER_INFO(Boolean); 33 SkDisplayBoolean(); 34 #ifdef SK_DUMP_ENABLED 35 void dump(SkAnimateMaker* ) override; 36 #endif 37 SkBool value; 38 friend class SkAnimatorScript; 39 friend class SkAnimatorScript_Box; 40 friend class SkAnimatorScript_Unbox; 41 typedef SkDisplayDepend INHERITED; 42 }; 43 44 class SkDisplayInt : public SkDisplayDepend { 45 DECLARE_DISPLAY_MEMBER_INFO(Int); 46 SkDisplayInt(); 47 #ifdef SK_DUMP_ENABLED 48 void dump(SkAnimateMaker* ) override; 49 #endif 50 private: 51 int32_t value; 52 friend class SkAnimatorScript; 53 friend class SkAnimatorScript_Box; 54 friend class SkAnimatorScript_Unbox; 55 typedef SkDisplayDepend INHERITED; 56 }; 57 58 class SkDisplayFloat : public SkDisplayDepend { 59 DECLARE_DISPLAY_MEMBER_INFO(Float); 60 SkDisplayFloat(); 61 #ifdef SK_DUMP_ENABLED 62 void dump(SkAnimateMaker* ) override; 63 #endif 64 private: 65 SkScalar value; 66 friend class SkAnimatorScript; 67 friend class SkAnimatorScript_Box; 68 friend class SkAnimatorScript_Unbox; 69 typedef SkDisplayDepend INHERITED; 70 }; 71 72 class SkDisplayString : public SkDisplayDepend { 73 DECLARE_DISPLAY_MEMBER_INFO(String); 74 SkDisplayString(); 75 SkDisplayString(SkString& ); 76 void executeFunction(SkDisplayable* , int index, 77 SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type, 78 SkScriptValue* ) override; 79 const SkFunctionParamType* getFunctionsParameters() override; 80 bool getProperty(int index, SkScriptValue* ) const override; 81 SkString value; 82 private: 83 static const SkFunctionParamType fFunctionParameters[]; 84 }; 85 86 class SkDisplayArray : public SkDisplayDepend { 87 DECLARE_DISPLAY_MEMBER_INFO(Array); 88 SkDisplayArray(); 89 SkDisplayArray(SkTypedArray& ); 90 SkDisplayArray(SkOpArray& ); // compiled script experiment 91 virtual ~SkDisplayArray(); 92 bool getProperty(int index, SkScriptValue* ) const override; 93 private: 94 SkTypedArray values; 95 friend class SkAnimator; 96 friend class SkAnimatorScript; 97 friend class SkAnimatorScript2; 98 friend class SkAnimatorScript_Unbox; 99 friend class SkDisplayable; 100 friend struct SkMemberInfo; 101 friend class SkScriptEngine; 102 }; 103 104 #endif // SkDisplayTypes_DEFINED 105