| 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 |
typedef void (*DamageScreenCreateFunc) (DamagePtr); |
| 45 |
typedef void (*DamageScreenRegisterFunc) (DrawablePtr, DamagePtr); |
| 46 |
typedef void (*DamageScreenUnregisterFunc) (DrawablePtr, DamagePtr); |
| 47 |
typedef void (*DamageScreenDestroyFunc) (DamagePtr); |
| 48 |
|
| 49 |
typedef struct _damageScreenFuncs { |
| 50 |
DamageScreenCreateFunc Create; |
| 51 |
DamageScreenRegisterFunc Register; |
| 52 |
DamageScreenUnregisterFunc Unregister; |
| 53 |
DamageScreenDestroyFunc Destroy; |
| 54 |
} DamageScreenFuncsRec, *DamageScreenFuncsPtr; |
| 55 |
|
| 56 |
extern _X_EXPORT void miDamageCreate(DamagePtr); |
| 57 |
extern _X_EXPORT void miDamageRegister(DrawablePtr, DamagePtr); |
| 58 |
extern _X_EXPORT void miDamageUnregister(DrawablePtr, DamagePtr); |
| 59 |
extern _X_EXPORT void miDamageDestroy(DamagePtr); |
| 60 |
|
| 61 |
extern _X_EXPORT Bool |
| 62 |
DamageSetup(ScreenPtr pScreen); |
| 63 |
|
| 64 |
extern _X_EXPORT DamagePtr |
| 65 |
DamageCreate(DamageReportFunc damageReport, |
| 66 |
DamageDestroyFunc damageDestroy, |
| 67 |
DamageReportLevel damageLevel, |
| 68 |
Bool isInternal, ScreenPtr pScreen, void *closure); |
| 69 |
|
| 70 |
extern _X_EXPORT void |
| 71 |
DamageDrawInternal(ScreenPtr pScreen, Bool enable); |
| 72 |
|
| 73 |
extern _X_EXPORT void |
| 74 |
DamageRegister(DrawablePtr pDrawable, DamagePtr pDamage); |
| 75 |
|
| 76 |
extern _X_EXPORT void |
| 77 |
DamageUnregister(DamagePtr pDamage); |
| 78 |
|
| 79 |
extern _X_EXPORT void |
| 80 |
DamageDestroy(DamagePtr pDamage); |
| 81 |
|
| 82 |
extern _X_EXPORT Bool |
| 83 |
DamageSubtract(DamagePtr pDamage, const RegionPtr pRegion); |
| 84 |
|
| 85 |
extern _X_EXPORT void |
| 86 |
DamageEmpty(DamagePtr pDamage); |
| 87 |
|
| 88 |
extern _X_EXPORT RegionPtr |
| 89 |
DamageRegion(DamagePtr pDamage); |
| 90 |
|
| 91 |
extern _X_EXPORT RegionPtr |
| 92 |
DamagePendingRegion(DamagePtr pDamage); |
| 93 |
|
| 94 |
/* In case of rendering, call this before the submitting the commands. */ |
| 95 |
extern _X_EXPORT void |
| 96 |
DamageRegionAppend(DrawablePtr pDrawable, RegionPtr pRegion); |
| 97 |
|
| 98 |
/* Call this directly after the rendering operation has been submitted. */ |
| 99 |
extern _X_EXPORT void |
| 100 |
DamageRegionProcessPending(DrawablePtr pDrawable); |
| 101 |
|
| 102 |
/* Call this when you create a new Damage and you wish to send an initial damage message (to it). */ |
| 103 |
extern _X_EXPORT void |
| 104 |
DamageReportDamage(DamagePtr pDamage, RegionPtr pDamageRegion); |
| 105 |
|
| 106 |
/* Avoid using this call, it only exists for API compatibility. */ |
| 107 |
extern _X_EXPORT void |
| 108 |
DamageDamageRegion(DrawablePtr pDrawable, const RegionPtr pRegion); |
| 109 |
|
| 110 |
extern _X_EXPORT void |
| 111 |
DamageSetReportAfterOp(DamagePtr pDamage, Bool reportAfter); |
| 112 |
|
| 113 |
extern _X_EXPORT DamageScreenFuncsPtr DamageGetScreenFuncs(ScreenPtr); |
| 114 |
|
| 115 |
#endif /* _DAMAGE_H_ */ |