damagestr.h revision 6747b715
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# include "picturestr.h"
34
35typedef struct _damage {
36    DamagePtr		pNext;
37    DamagePtr		pNextWin;
38    RegionRec		damage;
39
40    DamageReportLevel	damageLevel;
41    Bool		isInternal;
42    void		*closure;
43    Bool		isWindow;
44    DrawablePtr		pDrawable;
45
46    DamageReportFunc	damageReport;
47    DamageReportFunc	damageReportPostRendering;
48    DamageDestroyFunc	damageDestroy;
49    DamageMarkerFunc	damageMarker;
50
51    Bool		reportAfter;
52    RegionRec		pendingDamage; /* will be flushed post submission at the latest */
53    RegionRec		backupDamage; /* for use with damageMarker */
54    ScreenPtr		pScreen;
55    PrivateRec		*devPrivates;
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    CompositeProcPtr		Composite;
74    GlyphsProcPtr		Glyphs;
75    AddTrapsProcPtr		AddTraps;
76
77    /* Table of wrappable function pointers */
78    DamageScreenFuncsRec	funcs;
79} DamageScrPrivRec, *DamageScrPrivPtr;
80
81typedef struct _damageGCPriv {
82    GCOps   *ops;
83    GCFuncs *funcs;
84} DamageGCPrivRec, *DamageGCPrivPtr;
85
86/* XXX should move these into damage.c, damageScrPrivateIndex is static */
87#define damageGetScrPriv(pScr) ((DamageScrPrivPtr) \
88    dixLookupPrivate(&(pScr)->devPrivates, damageScrPrivateKey))
89
90#define damageScrPriv(pScr) \
91    DamageScrPrivPtr    pScrPriv = damageGetScrPriv(pScr)
92
93#define damageGetPixPriv(pPix) \
94    dixLookupPrivate(&(pPix)->devPrivates, damagePixPrivateKey)
95
96#define damgeSetPixPriv(pPix,v) \
97    dixSetPrivate(&(pPix)->devPrivates, damagePixPrivateKey, v)
98
99#define damagePixPriv(pPix) \
100    DamagePtr	    pDamage = damageGetPixPriv(pPix)
101
102#define damageGetGCPriv(pGC) \
103    dixLookupPrivate(&(pGC)->devPrivates, damageGCPrivateKey)
104
105#define damageGCPriv(pGC) \
106    DamageGCPrivPtr  pGCPriv = damageGetGCPriv(pGC)
107
108#define damageGetWinPriv(pWin) \
109    ((DamagePtr)dixLookupPrivate(&(pWin)->devPrivates, damageWinPrivateKey))
110
111#define damageSetWinPriv(pWin,d) \
112    dixSetPrivate(&(pWin)->devPrivates, damageWinPrivateKey, d)
113
114#endif /* _DAMAGESTR_H_ */
115