aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/animator/SkDisplayTypes.h
blob: c24091f39895ab3c8b786616fa83786b64dfe49f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
 * Copyright 2006 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkDisplayTypes_DEFINED
#define SkDisplayTypes_DEFINED

#include "SkDisplayable.h"
#include "SkMemberInfo.h"
#include "SkTypedArray.h"

class SkOpArray; // compiled script experiment


class SkDisplayDepend : public SkDisplayable {
public:
    virtual bool canContainDependents() const;
    void addDependent(SkDisplayable* displayable) {
        if (fDependents.find(displayable) < 0)
            *fDependents.append() = displayable;
    }
    virtual void dirty();
private:
    SkTDDisplayableArray fDependents;
    typedef SkDisplayable INHERITED;
};

class SkDisplayBoolean : public SkDisplayDepend {
    DECLARE_DISPLAY_MEMBER_INFO(Boolean);
    SkDisplayBoolean();
#ifdef SK_DUMP_ENABLED
    void dump(SkAnimateMaker* ) override;
#endif
    SkBool value;
    friend class SkAnimatorScript;
    friend class SkAnimatorScript_Box;
    friend class SkAnimatorScript_Unbox;
    typedef SkDisplayDepend INHERITED;
};

class SkDisplayInt : public SkDisplayDepend {
    DECLARE_DISPLAY_MEMBER_INFO(Int);
    SkDisplayInt();
#ifdef SK_DUMP_ENABLED
    void dump(SkAnimateMaker* ) override;
#endif
private:
    int32_t value;
    friend class SkAnimatorScript;
    friend class SkAnimatorScript_Box;
    friend class SkAnimatorScript_Unbox;
    typedef SkDisplayDepend INHERITED;
};

class SkDisplayFloat : public SkDisplayDepend {
    DECLARE_DISPLAY_MEMBER_INFO(Float);
    SkDisplayFloat();
#ifdef SK_DUMP_ENABLED
    void dump(SkAnimateMaker* ) override;
#endif
private:
    SkScalar value;
    friend class SkAnimatorScript;
    friend class SkAnimatorScript_Box;
    friend class SkAnimatorScript_Unbox;
    typedef SkDisplayDepend INHERITED;
};

class SkDisplayString : public SkDisplayDepend {
    DECLARE_DISPLAY_MEMBER_INFO(String);
    SkDisplayString();
    SkDisplayString(SkString& );
    void executeFunction(SkDisplayable* , int index,
        SkTDArray<SkScriptValue>& parameters, SkDisplayTypes type,
        SkScriptValue* ) override;
    const SkFunctionParamType* getFunctionsParameters() override;
    bool getProperty(int index, SkScriptValue* ) const override;
    SkString value;
private:
    static const SkFunctionParamType fFunctionParameters[];
};

class SkDisplayArray : public SkDisplayDepend {
    DECLARE_DISPLAY_MEMBER_INFO(Array);
    SkDisplayArray();
    SkDisplayArray(SkTypedArray& );
    SkDisplayArray(SkOpArray& ); // compiled script experiment
    virtual ~SkDisplayArray();
    bool getProperty(int index, SkScriptValue* ) const override;
private:
    SkTypedArray values;
    friend class SkAnimator;
    friend class SkAnimatorScript;
    friend class SkAnimatorScript2;
    friend class SkAnimatorScript_Unbox;
    friend class SkDisplayable;
    friend struct SkMemberInfo;
    friend class SkScriptEngine;
};

#endif // SkDisplayTypes_DEFINED