damagestr.h revision 4642e01f
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 _DAMAGESTR_H_
28#define _DAMAGESTR_H_
29
30#include "damage.h"
31#include "gcstruct.h"
32#include "privates.h"
33#ifdef RENDER
34# include "picturestr.h"
35#endif
36
37typedef struct _damage {
38    DamagePtr		pNext;
39    DamagePtr		pNextWin;
40    RegionRec		damage;
41
42    DamageReportLevel	damageLevel;
43    Bool		isInternal;
44    void		*closure;
45    Bool		isWindow;
46    DrawablePtr		pDrawable;
47
48    DamageReportFunc	damageReport;
49    DamageReportFunc	damageReportPostRendering;
50    DamageDestroyFunc	damageDestroy;
51    DamageMarkerFunc	damageMarker;
52
53    Bool		reportAfter;
54    RegionRec		pendingDamage; /* will be flushed post submission at the latest */
55    RegionRec		backupDamage; /* for use with damageMarker */
56} DamageRec;
57
58typedef struct _damageScrPriv {
59    int				internalLevel;
60
61    /*
62     * For DDXen which don't provide GetScreenPixmap, this provides
63     * a place to hook damage for windows on the screen
64     */
65    DamagePtr			pScreenDamage;
66
67    CopyWindowProcPtr		CopyWindow;
68    CloseScreenProcPtr		CloseScreen;
69    CreateGCProcPtr		CreateGC;
70    DestroyPixmapProcPtr	DestroyPixmap;
71    SetWindowPixmapProcPtr	SetWindowPixmap;
72    DestroyWindowProcPtr	DestroyWindow;
73#ifdef RENDER
74    CompositeProcPtr		Composite;
75    GlyphsProcPtr		Glyphs;
76    AddTrapsProcPtr		AddTraps;
77#endif
78} DamageScrPrivRec, *DamageScrPrivPtr;
79
80typedef struct _damageGCPriv {
81    GCOps   *ops;
82    GCFuncs *funcs;
83} DamageGCPrivRec, *DamageGCPrivPtr;
84
85/* XXX should move these into damage.c, damageScrPrivateIndex is static */
86#define damageGetScrPriv(pScr) ((DamageScrPrivPtr) \
87    dixLookupPrivate(&(pScr)->devPrivates, damageScrPrivateKey))
88
89#define damageScrPriv(pScr) \
90    DamageScrPrivPtr    pScrPriv = damageGetScrPriv(pScr)
91
92#define damageGetPixPriv(pPix) \
93    dixLookupPrivate(&(pPix)->devPrivates, damagePixPrivateKey)
94
95#define damgeSetPixPriv(pPix,v) \
96    dixSetPrivate(&(pPix)->devPrivates, damagePixPrivateKey, v)
97
98#define damagePixPriv(pPix) \
99    DamagePtr	    pDamage = damageGetPixPriv(pPix)
100
101#define damageGetGCPriv(pGC) \
102    dixLookupPrivate(&(pGC)->devPrivates, damageGCPrivateKey)
103
104#define damageGCPriv(pGC) \
105    DamageGCPrivPtr  pGCPriv = damageGetGCPriv(pGC)
106
107#define damageGetWinPriv(pWin) \
108    ((DamagePtr)dixLookupPrivate(&(pWin)->devPrivates, damageWinPrivateKey))
109
110#define damageSetWinPriv(pWin,d) \
111    dixSetPrivate(&(pWin)->devPrivates, damageWinPrivateKey, d)
112
113#endif /* _DAMAGESTR_H_ */
114