1 /*
2  * Copyright 2006 The Android Open Source Project
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkDisplayList_DEFINED
9 #define SkDisplayList_DEFINED
10 
11 #include "SkOperand.h"
12 #include "SkIntArray.h"
13 #include "SkRect.h"
14 #include "SkRefCnt.h"
15 
16 class SkAnimateMaker;
17 class SkActive;
18 class SkApply;
19 class SkADrawable;
20 class SkGroup;
21 
22 class SkDisplayList : public SkRefCnt {
23 public:
24     SkDisplayList();
25     virtual ~SkDisplayList();
26     void append(SkActive* );
clear()27     void clear() { fDrawList.reset(); }
count()28     int count() { return fDrawList.count(); }
29     bool draw(SkAnimateMaker& , SkMSec time);
30 #ifdef SK_DUMP_ENABLED
31     void dump(SkAnimateMaker* maker);
32     void dumpInner(SkAnimateMaker* maker);
33     static int fIndent;
34     static int fDumpIndex;
35 #endif
36     int findGroup(SkADrawable* match, SkTDDrawableArray** list,
37         SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList);
get(int index)38     SkADrawable* get(int index) { return fDrawList[index]; }
getTime()39     SkMSec getTime() { return fInTime; }
getDrawList()40     SkTDDrawableArray* getDrawList() { return &fDrawList; }
41     void hardReset();
42     virtual bool onIRect(const SkIRect& r);
43     void reset();
44     void remove(SkActive* );
45 #ifdef SK_DEBUG
46     void validate();
47 #else
validate()48     void validate() {}
49 #endif
50     static int SearchForMatch(SkADrawable* match, SkTDDrawableArray** list,
51         SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList);
52     static bool SearchGroupForMatch(SkADrawable* draw, SkADrawable* match,
53         SkTDDrawableArray** list, SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList,
54         int &index);
55 public:
56     SkIRect fBounds;
57     SkIRect fInvalBounds;
58     bool fDrawBounds;
59     bool fHasUnion;
60     bool fUnionBounds;
61 private:
62     SkTDDrawableArray fDrawList;
63     SkTDActiveArray fActiveList;
64     SkMSec fInTime;
65     friend class SkEvents;
66 };
67 
68 #endif // SkDisplayList_DEFINED
69