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,
|
---|
41 | void *closure);
|
---|
42 | typedef void (*DamageDestroyFunc) (DamagePtr pDamage, void *closure);
|
---|
43 |
|
---|
44 | /* It's the responsibility of the driver to duplicate both regions. */
|
---|
45 | /* At some point DamageRegionRendered() must be called. */
|
---|
46 | typedef void (*DamageMarkerFunc) (DrawablePtr pDrawable, DamagePtr pDamage,
|
---|
47 | RegionPtr pOldDamage, RegionPtr pRegion,
|
---|
48 | void *closure);
|
---|
49 |
|
---|
50 | typedef void (*DamageScreenCreateFunc) (DamagePtr);
|
---|
51 | typedef void (*DamageScreenRegisterFunc) (DrawablePtr, DamagePtr);
|
---|
52 | typedef void (*DamageScreenUnregisterFunc) (DrawablePtr, DamagePtr);
|
---|
53 | typedef void (*DamageScreenDestroyFunc) (DamagePtr);
|
---|
54 |
|
---|
55 | typedef struct _damageScreenFuncs {
|
---|
56 | DamageScreenCreateFunc Create;
|
---|
57 | DamageScreenRegisterFunc Register;
|
---|
58 | DamageScreenUnregisterFunc Unregister;
|
---|
59 | DamageScreenDestroyFunc Destroy;
|
---|
60 | } DamageScreenFuncsRec, *DamageScreenFuncsPtr;
|
---|
61 |
|
---|
62 | extern _X_EXPORT void miDamageCreate(DamagePtr);
|
---|
63 | extern _X_EXPORT void miDamageRegister(DrawablePtr, DamagePtr);
|
---|
64 | extern _X_EXPORT void miDamageUnregister(DrawablePtr, DamagePtr);
|
---|
65 | extern _X_EXPORT void miDamageDestroy(DamagePtr);
|
---|
66 |
|
---|
67 | extern _X_EXPORT Bool
|
---|
68 | DamageSetup(ScreenPtr pScreen);
|
---|
69 |
|
---|
70 | extern _X_EXPORT DamagePtr
|
---|
71 | DamageCreate(DamageReportFunc damageReport,
|
---|
72 | DamageDestroyFunc damageDestroy,
|
---|
73 | DamageReportLevel damageLevel,
|
---|
74 | Bool isInternal, ScreenPtr pScreen, void *closure);
|
---|
75 |
|
---|
76 | extern _X_EXPORT void
|
---|
77 | DamageDrawInternal(ScreenPtr pScreen, Bool enable);
|
---|
78 |
|
---|
79 | extern _X_EXPORT void
|
---|
80 | DamageRegister(DrawablePtr pDrawable, DamagePtr pDamage);
|
---|
81 |
|
---|
82 | extern _X_EXPORT void
|
---|
83 | DamageUnregister(DrawablePtr pDrawable, DamagePtr pDamage);
|
---|
84 |
|
---|
85 | extern _X_EXPORT void
|
---|
86 | DamageDestroy(DamagePtr pDamage);
|
---|
87 |
|
---|
88 | extern _X_EXPORT Bool
|
---|
89 | DamageSubtract(DamagePtr pDamage, const RegionPtr pRegion);
|
---|
90 |
|
---|
91 | extern _X_EXPORT void
|
---|
92 | DamageEmpty(DamagePtr pDamage);
|
---|
93 |
|
---|
94 | extern _X_EXPORT RegionPtr
|
---|
95 | DamageRegion(DamagePtr pDamage);
|
---|
96 |
|
---|
97 | extern _X_EXPORT RegionPtr
|
---|
98 | DamagePendingRegion(DamagePtr pDamage);
|
---|
99 |
|
---|
100 | /* In case of rendering, call this before the submitting the commands. */
|
---|
101 | extern _X_EXPORT void
|
---|
102 | DamageRegionAppend(DrawablePtr pDrawable, RegionPtr pRegion);
|
---|
103 |
|
---|
104 | /* Call this directly after the rendering operation has been submitted. */
|
---|
105 | extern _X_EXPORT void
|
---|
106 | DamageRegionProcessPending(DrawablePtr pDrawable);
|
---|
107 |
|
---|
108 | /* Call this some time after rendering is done, only relevant when a damageMarker is provided. */
|
---|
109 | extern _X_EXPORT void
|
---|
110 |
|
---|
111 | DamageRegionRendered(DrawablePtr pDrawable, DamagePtr pDamage,
|
---|
112 | RegionPtr pOldDamage, RegionPtr pRegion);
|
---|
113 |
|
---|
114 | /* Call this when you create a new Damage and you wish to send an initial damage message (to it). */
|
---|
115 | extern _X_EXPORT void
|
---|
116 | DamageReportDamage(DamagePtr pDamage, RegionPtr pDamageRegion);
|
---|
117 |
|
---|
118 | /* Avoid using this call, it only exists for API compatibility. */
|
---|
119 | extern _X_EXPORT void
|
---|
120 | DamageDamageRegion(DrawablePtr pDrawable, const RegionPtr pRegion);
|
---|
121 |
|
---|
122 | extern _X_EXPORT void
|
---|
123 | DamageSetReportAfterOp(DamagePtr pDamage, Bool reportAfter);
|
---|
124 |
|
---|
125 | extern _X_EXPORT void
|
---|
126 |
|
---|
127 | DamageSetPostRenderingFunctions(DamagePtr pDamage,
|
---|
128 | DamageReportFunc damageReportPostRendering,
|
---|
129 | DamageMarkerFunc damageMarker);
|
---|
130 |
|
---|
131 | extern _X_EXPORT DamageScreenFuncsPtr DamageGetScreenFuncs(ScreenPtr);
|
---|
132 |
|
---|
133 | #endif /* _DAMAGE_H_ */
|
---|