1
2/*
3 * Copyright 2011 Google Inc.
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#ifndef SkAnimatorScript2_DEFINED
9#define SkAnimatorScript2_DEFINED
10
11#include "SkDisplayable.h"
12#include "SkScript2.h"
13#include "SkTypedArray.h"
14
15class SkAnimateMaker;
16struct SkMemberInfo;
17
18#ifndef SkAnimatorScript_DEFINED
19struct SkDisplayEnumMap {
20	SkDisplayTypes fType;
21	const char* fValues;
22};
23#endif
24
25class SkAnimatorScript2 : public SkScriptEngine2 {
26public:
27	SkAnimatorScript2(SkAnimateMaker& , SkDisplayable* working, SkDisplayTypes type);
28	~SkAnimatorScript2();
29	bool evalMemberCommon(const SkMemberInfo* info,
30		SkDisplayable* displayable, SkOperand2* value);
31	SkAnimateMaker& getMaker() { return fMaker; }
32	SkDisplayable* getWorking() { return fWorking; }
33	static bool MapEnums(const char* ptr, const char* match, size_t len, int* value);
34	static const SkDisplayEnumMap& GetEnumValues(SkDisplayTypes type);
35	static SkDisplayTypes ToDisplayType(SkOperand2::OpType type);
36	static SkOperand2::OpType ToOpType(SkDisplayTypes type);
37private:
38	SkAnimateMaker& fMaker;
39	SkDisplayable* fWorking;
40	friend class SkDump;
41	friend struct SkScriptNAnswer;
42	// illegal
43	SkAnimatorScript2& operator=(const SkAnimatorScript2&);
44#ifdef SK_DEBUG
45public:
46	static void UnitTest();
47#endif
48};
49
50#endif // SkAnimatorScript2_DEFINED
51