blob: 0009a4c3768640b99e4c82201a42fbdad4d8f6df [file] [log] [blame]
reed@android.com8a1c16f2008-12-17 15:59:43 +00001/* libs/graphics/animator/SkDrawGroup.h
2**
3** Copyright 2006, The Android Open Source Project
4**
5** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
8**
9** http://www.apache.org/licenses/LICENSE-2.0
10**
11** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and
15** limitations under the License.
16*/
17
18#ifndef SkDrawGroup_DEFINED
19#define SkDrawGroup_DEFINED
20
21#include "SkDrawable.h"
22#include "SkIntArray.h"
23#include "SkMemberInfo.h"
24
25class SkGroup : public SkDrawable { //interface for schema element <g>
26public:
27 DECLARE_MEMBER_INFO(Group);
28 SkGroup();
29 virtual ~SkGroup();
30 virtual bool add(SkAnimateMaker& , SkDisplayable* child);
31 virtual bool contains(SkDisplayable* );
32 SkGroup* copy();
33 SkBool copySet(int index);
34 virtual SkDisplayable* deepCopy(SkAnimateMaker* );
35 virtual bool doEvent(SkDisplayEvent::Kind , SkEventState* state );
36 virtual bool draw(SkAnimateMaker& );
37#ifdef SK_DUMP_ENABLED
38 virtual void dump(SkAnimateMaker* );
39 virtual void dumpDrawables(SkAnimateMaker* );
40 virtual void dumpEvents();
41#endif
42 int findGroup(SkDrawable* drawable, SkTDDrawableArray** list,
43 SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList);
44 virtual bool enable(SkAnimateMaker& );
45 SkTDDrawableArray* getChildren() { return &fChildren; }
46 SkGroup* getOriginal() { return fOriginal; }
47 virtual bool hasEnable() const;
48 virtual void initialize();
49 SkBool isACopy() { return fOriginal != NULL; }
50 void markCopyClear(int index);
51 void markCopySet(int index);
52 void markCopySize(int index);
53 bool markedForDelete(int index) const { return (fCopies[index >> 5] & 1 << (index & 0x1f)) == 0; }
54 void reset();
55 bool resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, SkApply* );
56 virtual void setSteps(int steps);
57#ifdef SK_DEBUG
58 virtual void validate();
59#endif
60protected:
61 bool ifCondition(SkAnimateMaker& maker, SkDrawable* drawable,
62 SkString& conditionString);
63 SkString condition;
64 SkString enableCondition;
65 SkTDDrawableArray fChildren;
66 SkTDDrawableArray* fParentList;
67 SkTDIntArray fCopies;
68 SkGroup* fOriginal;
69private:
70 typedef SkDrawable INHERITED;
71};
72
73class SkSave: public SkGroup {
74 DECLARE_MEMBER_INFO(Save);
75 virtual bool draw(SkAnimateMaker& );
76private:
77 typedef SkGroup INHERITED;
78};
79
80#endif // SkDrawGroup_DEFINED