blob: 336040c115a9976f8b6d2022fb82b25ee5b26776 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
2/*
3 * Copyright 2006 The Android Open Source Project
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
reed@android.com8a1c16f2008-12-17 15:59:43 +00009
10#ifndef SkDrawGroup_DEFINED
11#define SkDrawGroup_DEFINED
12
13#include "SkDrawable.h"
14#include "SkIntArray.h"
15#include "SkMemberInfo.h"
16
17class SkGroup : public SkDrawable { //interface for schema element <g>
18public:
19 DECLARE_MEMBER_INFO(Group);
20 SkGroup();
21 virtual ~SkGroup();
tfarina@chromium.org1d3c4112012-12-03 14:38:08 +000022 virtual bool addChild(SkAnimateMaker& , SkDisplayable* child) SK_OVERRIDE;
reed@android.com8a1c16f2008-12-17 15:59:43 +000023 virtual bool contains(SkDisplayable* );
24 SkGroup* copy();
25 SkBool copySet(int index);
26 virtual SkDisplayable* deepCopy(SkAnimateMaker* );
27 virtual bool doEvent(SkDisplayEvent::Kind , SkEventState* state );
28 virtual bool draw(SkAnimateMaker& );
29#ifdef SK_DUMP_ENABLED
30 virtual void dump(SkAnimateMaker* );
31 virtual void dumpDrawables(SkAnimateMaker* );
32 virtual void dumpEvents();
33#endif
34 int findGroup(SkDrawable* drawable, SkTDDrawableArray** list,
35 SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList);
36 virtual bool enable(SkAnimateMaker& );
37 SkTDDrawableArray* getChildren() { return &fChildren; }
38 SkGroup* getOriginal() { return fOriginal; }
39 virtual bool hasEnable() const;
40 virtual void initialize();
41 SkBool isACopy() { return fOriginal != NULL; }
42 void markCopyClear(int index);
43 void markCopySet(int index);
44 void markCopySize(int index);
45 bool markedForDelete(int index) const { return (fCopies[index >> 5] & 1 << (index & 0x1f)) == 0; }
46 void reset();
47 bool resolveIDs(SkAnimateMaker& maker, SkDisplayable* original, SkApply* );
48 virtual void setSteps(int steps);
49#ifdef SK_DEBUG
50 virtual void validate();
51#endif
52protected:
53 bool ifCondition(SkAnimateMaker& maker, SkDrawable* drawable,
54 SkString& conditionString);
55 SkString condition;
56 SkString enableCondition;
57 SkTDDrawableArray fChildren;
58 SkTDDrawableArray* fParentList;
59 SkTDIntArray fCopies;
60 SkGroup* fOriginal;
61private:
62 typedef SkDrawable INHERITED;
63};
64
65class SkSave: public SkGroup {
66 DECLARE_MEMBER_INFO(Save);
67 virtual bool draw(SkAnimateMaker& );
68private:
69 typedef SkGroup INHERITED;
70};
71
72#endif // SkDrawGroup_DEFINED