• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SkDisplayTypes_DEFINED
11 #define SkDisplayTypes_DEFINED
12 
13 #include "SkDisplayable.h"
14 #include "SkMemberInfo.h"
15 #include "SkTypedArray.h"
16 
17 class SkOpArray; // compiled script experiment
18 
19 
20 class SkDisplayDepend : public SkDisplayable {
21 public:
22     virtual bool canContainDependents() const;
addDependent(SkDisplayable * displayable)23     void addDependent(SkDisplayable* displayable) {
24         if (fDependents.find(displayable) < 0)
25             *fDependents.append() = displayable;
26     }
27     virtual void dirty();
28 private:
29     SkTDDisplayableArray fDependents;
30     typedef SkDisplayable INHERITED;
31 };
32 
33 class SkDisplayBoolean : public SkDisplayDepend {
34     DECLARE_DISPLAY_MEMBER_INFO(Boolean);
35     SkDisplayBoolean();
36 #ifdef SK_DUMP_ENABLED
37     virtual void dump(SkAnimateMaker* );
38 #endif
39     SkBool value;
40     friend class SkAnimatorScript;
41     friend class SkAnimatorScript_Box;
42     friend class SkAnimatorScript_Unbox;
43     typedef SkDisplayDepend INHERITED;
44 };
45 
46 class SkDisplayInt : public SkDisplayDepend {
47     DECLARE_DISPLAY_MEMBER_INFO(Int);
48     SkDisplayInt();
49 #ifdef SK_DUMP_ENABLED
50     virtual void dump(SkAnimateMaker* );
51 #endif
52 private:
53     int32_t value;
54     friend class SkAnimatorScript;
55     friend class SkAnimatorScript_Box;
56     friend class SkAnimatorScript_Unbox;
57     typedef SkDisplayDepend INHERITED;
58 };
59 
60 class SkDisplayFloat : public SkDisplayDepend {
61     DECLARE_DISPLAY_MEMBER_INFO(Float);
62     SkDisplayFloat();
63 #ifdef SK_DUMP_ENABLED
64     virtual void dump(SkAnimateMaker* );
65 #endif
66 private:
67     SkScalar value;
68     friend class SkAnimatorScript;
69     friend class SkAnimatorScript_Box;
70     friend class SkAnimatorScript_Unbox;
71     typedef SkDisplayDepend INHERITED;
72 };
73 
74 class SkDisplayString : public SkDisplayDepend {
75     DECLARE_DISPLAY_MEMBER_INFO(String);
76     SkDisplayString();
77     SkDisplayString(SkString& );
78     virtual void executeFunction(SkDisplayable* , int index,
79         SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
80         SkScriptValue* );
81     virtual const SkFunctionParamType* getFunctionsParameters();
82     virtual bool getProperty(int index, SkScriptValue* ) const;
83     SkString value;
84 private:
85     static const SkFunctionParamType fFunctionParameters[];
86 };
87 
88 class SkDisplayArray : public SkDisplayDepend {
89     DECLARE_DISPLAY_MEMBER_INFO(Array);
90     SkDisplayArray();
91     SkDisplayArray(SkTypedArray& );
92     SkDisplayArray(SkOpArray& ); // compiled script experiment
93     virtual ~SkDisplayArray();
94     virtual bool getProperty(int index, SkScriptValue* ) const;
95 private:
96     SkTypedArray values;
97     friend class SkAnimator;
98     friend class SkAnimatorScript;
99     friend class SkAnimatorScript2;
100     friend class SkAnimatorScript_Unbox;
101     friend class SkDisplayable;
102     friend struct SkMemberInfo;
103     friend class SkScriptEngine;
104 };
105 
106 #endif // SkDisplayTypes_DEFINED
107 
108