reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame^] | 1 | /* libs/graphics/animator/SkDisplayTypes.h |
| 2 | ** |
| 3 | ** Copyright 2006, The Android Open Source Project |
| 4 | ** |
| 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
| 8 | ** |
| 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | ** |
| 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
| 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #ifndef SkDisplayTypes_DEFINED |
| 19 | #define SkDisplayTypes_DEFINED |
| 20 | |
| 21 | #include "SkDisplayable.h" |
| 22 | #include "SkMemberInfo.h" |
| 23 | #include "SkTypedArray.h" |
| 24 | |
| 25 | class SkOpArray; // compiled script experiment |
| 26 | |
| 27 | |
| 28 | class SkDisplayDepend : public SkDisplayable { |
| 29 | public: |
| 30 | virtual bool canContainDependents() const; |
| 31 | void addDependent(SkDisplayable* displayable) { |
| 32 | if (fDependents.find(displayable) < 0) |
| 33 | *fDependents.append() = displayable; |
| 34 | } |
| 35 | virtual void dirty(); |
| 36 | private: |
| 37 | SkTDDisplayableArray fDependents; |
| 38 | typedef SkDisplayable INHERITED; |
| 39 | }; |
| 40 | |
| 41 | class SkDisplayBoolean : public SkDisplayDepend { |
| 42 | DECLARE_DISPLAY_MEMBER_INFO(Boolean); |
| 43 | SkDisplayBoolean(); |
| 44 | #ifdef SK_DUMP_ENABLED |
| 45 | virtual void dump(SkAnimateMaker* ); |
| 46 | #endif |
| 47 | SkBool value; |
| 48 | friend class SkAnimatorScript; |
| 49 | friend class SkAnimatorScript_Box; |
| 50 | friend class SkAnimatorScript_Unbox; |
| 51 | typedef SkDisplayDepend INHERITED; |
| 52 | }; |
| 53 | |
| 54 | class SkDisplayInt : public SkDisplayDepend { |
| 55 | DECLARE_DISPLAY_MEMBER_INFO(Int); |
| 56 | SkDisplayInt(); |
| 57 | #ifdef SK_DUMP_ENABLED |
| 58 | virtual void dump(SkAnimateMaker* ); |
| 59 | #endif |
| 60 | private: |
| 61 | int32_t value; |
| 62 | friend class SkAnimatorScript; |
| 63 | friend class SkAnimatorScript_Box; |
| 64 | friend class SkAnimatorScript_Unbox; |
| 65 | typedef SkDisplayDepend INHERITED; |
| 66 | }; |
| 67 | |
| 68 | class SkDisplayFloat : public SkDisplayDepend { |
| 69 | DECLARE_DISPLAY_MEMBER_INFO(Float); |
| 70 | SkDisplayFloat(); |
| 71 | #ifdef SK_DUMP_ENABLED |
| 72 | virtual void dump(SkAnimateMaker* ); |
| 73 | #endif |
| 74 | private: |
| 75 | SkScalar value; |
| 76 | friend class SkAnimatorScript; |
| 77 | friend class SkAnimatorScript_Box; |
| 78 | friend class SkAnimatorScript_Unbox; |
| 79 | typedef SkDisplayDepend INHERITED; |
| 80 | }; |
| 81 | |
| 82 | class SkDisplayString : public SkDisplayDepend { |
| 83 | DECLARE_DISPLAY_MEMBER_INFO(String); |
| 84 | SkDisplayString(); |
| 85 | SkDisplayString(SkString& ); |
| 86 | virtual void executeFunction(SkDisplayable* , int index, |
| 87 | SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type, |
| 88 | SkScriptValue* ); |
| 89 | virtual const SkFunctionParamType* getFunctionsParameters(); |
| 90 | virtual bool getProperty(int index, SkScriptValue* ) const; |
| 91 | SkString value; |
| 92 | private: |
| 93 | static const SkFunctionParamType fFunctionParameters[]; |
| 94 | }; |
| 95 | |
| 96 | class SkDisplayArray : public SkDisplayDepend { |
| 97 | DECLARE_DISPLAY_MEMBER_INFO(Array); |
| 98 | SkDisplayArray(); |
| 99 | SkDisplayArray(SkTypedArray& ); |
| 100 | SkDisplayArray(SkOpArray& ); // compiled script experiment |
| 101 | virtual ~SkDisplayArray(); |
| 102 | virtual bool getProperty(int index, SkScriptValue* ) const; |
| 103 | private: |
| 104 | SkTypedArray values; |
| 105 | friend class SkAnimator; |
| 106 | friend class SkAnimatorScript; |
| 107 | friend class SkAnimatorScript2; |
| 108 | friend class SkAnimatorScript_Unbox; |
| 109 | friend class SkDisplayable; |
| 110 | friend struct SkMemberInfo; |
| 111 | friend class SkScriptEngine; |
| 112 | }; |
| 113 | |
| 114 | #endif // SkDisplayTypes_DEFINED |
| 115 | |