blob: c3995f6fd8122b01b2fc81f7e809e907006637cd [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
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 */
reed@android.com8a1c16f2008-12-17 15:59:43 +00008#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 {
rmistry@google.comd6176b02012-08-23 18:14:13 +000020 SkDisplayTypes fType;
21 const char* fValues;
reed@android.com8a1c16f2008-12-17 15:59:43 +000022};
23#endif
24
25class SkAnimatorScript2 : public SkScriptEngine2 {
26public:
rmistry@google.comd6176b02012-08-23 18:14:13 +000027 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);
reed@android.com8a1c16f2008-12-17 15:59:43 +000037private:
rmistry@google.comd6176b02012-08-23 18:14:13 +000038 SkAnimateMaker& fMaker;
39 SkDisplayable* fWorking;
40 friend class SkDump;
41 friend struct SkScriptNAnswer;
42 // illegal
43 SkAnimatorScript2& operator=(const SkAnimatorScript2&);
reed@android.com8a1c16f2008-12-17 15:59:43 +000044#ifdef SK_DEBUG
45public:
rmistry@google.comd6176b02012-08-23 18:14:13 +000046 static void UnitTest();
reed@android.com8a1c16f2008-12-17 15:59:43 +000047#endif
48};
49
50#endif // SkAnimatorScript2_DEFINED