aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/animator/SkAnimatorScript2.h
blob: c3995f6fd8122b01b2fc81f7e809e907006637cd (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

/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SkAnimatorScript2_DEFINED
#define SkAnimatorScript2_DEFINED

#include "SkDisplayable.h"
#include "SkScript2.h"
#include "SkTypedArray.h"

class SkAnimateMaker;
struct SkMemberInfo;

#ifndef SkAnimatorScript_DEFINED
struct SkDisplayEnumMap {
    SkDisplayTypes fType;
    const char* fValues;
};
#endif

class SkAnimatorScript2 : public SkScriptEngine2 {
public:
    SkAnimatorScript2(SkAnimateMaker& , SkDisplayable* working, SkDisplayTypes type);
    ~SkAnimatorScript2();
    bool evalMemberCommon(const SkMemberInfo* info,
        SkDisplayable* displayable, SkOperand2* value);
    SkAnimateMaker& getMaker() { return fMaker; }
    SkDisplayable* getWorking() { return fWorking; }
    static bool MapEnums(const char* ptr, const char* match, size_t len, int* value);
    static const SkDisplayEnumMap& GetEnumValues(SkDisplayTypes type);
    static SkDisplayTypes ToDisplayType(SkOperand2::OpType type);
    static SkOperand2::OpType ToOpType(SkDisplayTypes type);
private:
    SkAnimateMaker& fMaker;
    SkDisplayable* fWorking;
    friend class SkDump;
    friend struct SkScriptNAnswer;
    // illegal
    SkAnimatorScript2& operator=(const SkAnimatorScript2&);
#ifdef SK_DEBUG
public:
    static void UnitTest();
#endif
};

#endif // SkAnimatorScript2_DEFINED