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
16class SkAnimateMaker;
17class SkActive;
18class SkApply;
19class SkDrawable;
20class SkGroup;
21
22class SkDisplayList : public SkRefCnt {
23public:
24    SkDisplayList();
25    virtual ~SkDisplayList();
26    void append(SkActive* );
27    void clear() { fDrawList.reset(); }
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(SkDrawable* match, SkTDDrawableArray** list,
37        SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList);
38    SkDrawable* get(int index) { return fDrawList[index]; }
39    SkMSec getTime() { return fInTime; }
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
48    void validate() {}
49#endif
50    static int SearchForMatch(SkDrawable* match, SkTDDrawableArray** list,
51        SkGroup** parent, SkGroup** found, SkTDDrawableArray**grandList);
52    static bool SearchGroupForMatch(SkDrawable* draw, SkDrawable* match,
53        SkTDDrawableArray** list, SkGroup** parent, SkGroup** found, SkTDDrawableArray** grandList,
54        int &index);
55public:
56    SkIRect fBounds;
57    SkIRect fInvalBounds;
58    bool fDrawBounds;
59    bool fHasUnion;
60    bool fUnionBounds;
61private:
62    SkTDDrawableArray fDrawList;
63    SkTDActiveArray fActiveList;
64    SkMSec fInTime;
65    friend class SkEvents;
66};
67
68#endif // SkDisplayList_DEFINED
69