2009-12-07 Rolf Bjarne Kvinge <RKvinge@novell.com>
[moon.git] / src / dirty.h
blob89e4accaa738dc5e0488d75fcf88107b5d69828b
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * dirty.h:
5 * Contact:
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2007 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
13 #ifndef __DIRTY_H__
14 #define __DIRTY_H__
16 class DirtyList;
18 class DirtyLists {
19 public:
20 DirtyLists (bool ascending);
21 ~DirtyLists ();
23 DirtyList* GetList (int level, bool create = false);
24 void RemoveList (int level);
26 void AddDirtyNode (int level, List::Node *node);
27 void RemoveDirtyNode (int level, List::Node *node);
29 List::Node *GetFirst ();
31 bool IsEmpty ();
33 void Clear (bool freeNodes);
35 private:
36 bool ascending;
37 List *lists;
40 enum DirtyType {
41 // DirtyTransform
43 // This node needs to communicate its transform to its
44 // children. this can happen either when the parent's
45 // transform changes or when this node's transform changes.
46 DirtyTransform = 0x00000001,
48 // DirtyLocalTransform
50 // This node needs to update its local transform (relative to
51 // its parent). This implies DirtyTransform.
52 DirtyLocalTransform = 0x00000002,
54 // DirtyClip
56 // This node needs to communicate its clip to its children.
57 // this can happen either when the parent's clip changes or
58 // when this node's clip changes.
59 DirtyClip = 0x00000004,
61 // DirtyLocalClip
63 // This node needs to update its local clip (relative to
64 // its parent). This implies DirtyClip.
65 DirtyLocalClip = 0x00000008,
67 // Dirty*Visibility
69 // The visibility (either render or hit-test) of this node has
70 // changed, and we need to communicate this change to all its
71 // children.
72 DirtyRenderVisibility = 0x00000010,
73 DirtyHitTestVisibility = 0x00000020,
75 // DirtyMeasure
77 // InvalidateMeasure was called on this element.
78 DirtyMeasure = 0x00000040,
80 // DirtyMeasure
82 // InvalidateMeasure was called on this element.
83 DirtyArrange = 0x00000080,
85 // DirtyChildrenZIndices
87 // This isn't really a downward pass, as it doesn't propagate
88 // anything to children. It's just so we can delay resorting
89 // by ZIndex until the dirty passes run.
91 DirtyChildrenZIndices = 0x00000100,
93 DownDirtyState = (DirtyLocalTransform |
94 DirtyTransform |
95 DirtyRenderVisibility |
96 DirtyHitTestVisibility |
97 DirtyLocalClip |
98 DirtyClip |
99 DirtyChildrenZIndices),
101 // DirtyBounds
103 // The bounds of this element need to be recomputed. If
104 // they're found to be different, invalidate the node and set
105 // DirtyBounds on the parent.
106 DirtyBounds = 0x00100000,
107 DirtyNewBounds = 0x00200000,
109 // DirtyInvalidate
111 // element->dirty_rect contains the area needing repaint. If
112 // we're the toplevel surface, we generate an expose event on
113 // the surface. Otherwise we pass the rect up to our parent
114 // (and union it in with the parent's dirty_rect), and set
115 // DirtyInvalidate on the parent.
116 DirtyInvalidate = 0x00400000,
118 UpDirtyState = (DirtyBounds |
119 DirtyInvalidate),
121 DirtyState = DownDirtyState | UpDirtyState,
122 DirtyInUpDirtyList = 0x40000000,
123 DirtyInDownDirtyList = 0x80000000
126 #endif // __DIRTY_H__