1 | /*
|
---|
2 | * Copyright © 2003 Keith Packard
|
---|
3 | *
|
---|
4 | * Permission to use, copy, modify, distribute, and sell this software and its
|
---|
5 | * documentation for any purpose is hereby granted without fee, provided that
|
---|
6 | * the above copyright notice appear in all copies and that both that
|
---|
7 | * copyright notice and this permission notice appear in supporting
|
---|
8 | * documentation, and that the name of Keith Packard not be used in
|
---|
9 | * advertising or publicity pertaining to distribution of the software without
|
---|
10 | * specific, written prior permission. Keith Packard makes no
|
---|
11 | * representations about the suitability of this software for any purpose. It
|
---|
12 | * is provided "as is" without express or implied warranty.
|
---|
13 | *
|
---|
14 | * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
---|
15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
---|
16 | * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
---|
17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
---|
18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
---|
19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
---|
20 | * PERFORMANCE OF THIS SOFTWARE.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifdef HAVE_DIX_CONFIG_H
|
---|
24 | #include <dix-config.h>
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | #ifndef _DAMAGE_H_
|
---|
28 | #define _DAMAGE_H_
|
---|
29 |
|
---|
30 | typedef struct _damage *DamagePtr;
|
---|
31 |
|
---|
32 | typedef enum _damageReportLevel {
|
---|
33 | DamageReportRawRegion,
|
---|
34 | DamageReportDeltaRegion,
|
---|
35 | DamageReportBoundingBox,
|
---|
36 | DamageReportNonEmpty,
|
---|
37 | DamageReportNone
|
---|
38 | } DamageReportLevel;
|
---|
39 |
|
---|
40 | typedef void (*DamageReportFunc) (DamagePtr pDamage, RegionPtr pRegion, void *closure);
|
---|
41 | typedef void (*DamageDestroyFunc) (DamagePtr pDamage, void *closure);
|
---|
42 | /* It's the responsibility of the driver to duplicate both regions. */
|
---|
43 | /* At some point DamageRegionRendered() must be called. */
|
---|
44 | typedef void (*DamageMarkerFunc) (DrawablePtr pDrawable, DamagePtr pDamage, RegionPtr pOldDamage, RegionPtr pRegion, void *closure);
|
---|
45 |
|
---|
46 | typedef void (*DamageScreenCreateFunc) (DamagePtr);
|
---|
47 | typedef void (*DamageScreenRegisterFunc) (DrawablePtr, DamagePtr);
|
---|
48 | typedef void (*DamageScreenUnregisterFunc) (DrawablePtr, DamagePtr);
|
---|
49 | typedef void (*DamageScreenDestroyFunc) (DamagePtr);
|
---|
50 |
|
---|
51 | typedef struct _damageScreenFuncs {
|
---|
52 | DamageScreenCreateFunc Create;
|
---|
53 | DamageScreenRegisterFunc Register;
|
---|
54 | DamageScreenUnregisterFunc Unregister;
|
---|
55 | DamageScreenDestroyFunc Destroy;
|
---|
56 | } DamageScreenFuncsRec, *DamageScreenFuncsPtr;
|
---|
57 |
|
---|
58 | extern _X_EXPORT void miDamageCreate (DamagePtr);
|
---|
59 | extern _X_EXPORT void miDamageRegister (DrawablePtr, DamagePtr);
|
---|
60 | extern _X_EXPORT void miDamageUnregister (DrawablePtr, DamagePtr);
|
---|
61 | extern _X_EXPORT void miDamageDestroy (DamagePtr);
|
---|
62 |
|
---|
63 | extern _X_EXPORT Bool
|
---|
64 | DamageSetup (ScreenPtr pScreen);
|
---|
65 |
|
---|
66 | extern _X_EXPORT DamagePtr
|
---|
67 | DamageCreate (DamageReportFunc damageReport,
|
---|
68 | DamageDestroyFunc damageDestroy,
|
---|
69 | DamageReportLevel damageLevel,
|
---|
70 | Bool isInternal,
|
---|
71 | ScreenPtr pScreen,
|
---|
72 | void * closure);
|
---|
73 |
|
---|
74 | extern _X_EXPORT void
|
---|
75 | DamageDrawInternal (ScreenPtr pScreen, Bool enable);
|
---|
76 |
|
---|
77 | extern _X_EXPORT void
|
---|
78 | DamageRegister (DrawablePtr pDrawable,
|
---|
79 | DamagePtr pDamage);
|
---|
80 |
|
---|
81 | extern _X_EXPORT void
|
---|
82 | DamageUnregister (DrawablePtr pDrawable,
|
---|
83 | DamagePtr pDamage);
|
---|
84 |
|
---|
85 | extern _X_EXPORT void
|
---|
86 | DamageDestroy (DamagePtr pDamage);
|
---|
87 |
|
---|
88 | extern _X_EXPORT Bool
|
---|
89 | DamageSubtract (DamagePtr pDamage,
|
---|
90 | const RegionPtr pRegion);
|
---|
91 |
|
---|
92 | extern _X_EXPORT void
|
---|
93 | DamageEmpty (DamagePtr pDamage);
|
---|
94 |
|
---|
95 | extern _X_EXPORT RegionPtr
|
---|
96 | DamageRegion (DamagePtr pDamage);
|
---|
97 |
|
---|
98 | extern _X_EXPORT RegionPtr
|
---|
99 | DamagePendingRegion (DamagePtr pDamage);
|
---|
100 |
|
---|
101 | /* In case of rendering, call this before the submitting the commands. */
|
---|
102 | extern _X_EXPORT void
|
---|
103 | DamageRegionAppend (DrawablePtr pDrawable, RegionPtr pRegion);
|
---|
104 |
|
---|
105 | /* Call this directly after the rendering operation has been submitted. */
|
---|
106 | extern _X_EXPORT void
|
---|
107 | DamageRegionProcessPending (DrawablePtr pDrawable);
|
---|
108 |
|
---|
109 | /* Call this some time after rendering is done, only relevant when a damageMarker is provided. */
|
---|
110 | extern _X_EXPORT void
|
---|
111 | DamageRegionRendered (DrawablePtr pDrawable, DamagePtr pDamage, RegionPtr pOldDamage, RegionPtr pRegion);
|
---|
112 |
|
---|
113 | /* Call this when you create a new Damage and you wish to send an initial damage message (to it). */
|
---|
114 | extern _X_EXPORT void
|
---|
115 | DamageReportDamage (DamagePtr pDamage, RegionPtr pDamageRegion);
|
---|
116 |
|
---|
117 | /* Avoid using this call, it only exists for API compatibility. */
|
---|
118 | extern _X_EXPORT void
|
---|
119 | DamageDamageRegion (DrawablePtr pDrawable,
|
---|
120 | const RegionPtr pRegion);
|
---|
121 |
|
---|
122 | extern _X_EXPORT void
|
---|
123 | DamageSetReportAfterOp (DamagePtr pDamage, Bool reportAfter);
|
---|
124 |
|
---|
125 | extern _X_EXPORT void
|
---|
126 | DamageSetPostRenderingFunctions(DamagePtr pDamage, DamageReportFunc damageReportPostRendering,
|
---|
127 | DamageMarkerFunc damageMarker);
|
---|
128 |
|
---|
129 | extern _X_EXPORT DamageScreenFuncsPtr
|
---|
130 | DamageGetScreenFuncs (ScreenPtr);
|
---|
131 |
|
---|
132 | #endif /* _DAMAGE_H_ */
|
---|