summaryrefslogtreecommitdiff
path: root/miext/damage
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2007-08-28 09:28:25 -0400
committerEamon Walsh <ewalsh@moss-charon.epoch.ncsc.mil>2007-08-28 09:28:25 -0400
commit4017d3190234e189a0bbd33193a148d4d3c7556b (patch)
tree2ab228113d410386afde50c893f137d95974b8f3 /miext/damage
parent85547073265ae9bc4ae3af920a6d3214fd1ca0c5 (diff)
devPrivates rework: since API is already broken, switch everything
over to new system. Need to update documentation and address some remaining vestiges of old system such as CursorRec structure, fb "offman" structure, and FontRec privates.
Diffstat (limited to 'miext/damage')
-rwxr-xr-xmiext/damage/damage.c41
-rwxr-xr-xmiext/damage/damagestr.h15
2 files changed, 18 insertions, 38 deletions
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index 65314d8a9..b7f6fb550 100755
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -65,16 +65,15 @@
#define DAMAGE_DEBUG(x)
#endif
-#define getPixmapDamageRef(pPixmap) \
- ((DamagePtr *) &(pPixmap->devPrivates[damagePixPrivateIndex].ptr))
+#define getPixmapDamageRef(pPixmap) ((DamagePtr *) \
+ dixLookupPrivateAddr(&(pPixmap)->devPrivates, damagePixPrivateKey))
#define pixmapDamage(pPixmap) damagePixPriv(pPixmap)
-static int damageScrPrivateIndex;
-static int damagePixPrivateIndex;
-static int damageGCPrivateIndex;
-static int damageWinPrivateIndex;
-static int damageGeneration;
+static DevPrivateKey damageScrPrivateKey = &damageScrPrivateKey;
+static DevPrivateKey damagePixPrivateKey = &damagePixPrivateKey;
+static DevPrivateKey damageGCPrivateKey = &damageGCPrivateKey;
+static DevPrivateKey damageWinPrivateKey = &damageWinPrivateKey;
static DamagePtr *
getDrawableDamageRef (DrawablePtr pDrawable)
@@ -115,7 +114,7 @@ getDrawableDamageRef (DrawablePtr pDrawable)
#define winDamageRef(pWindow) \
DamagePtr *pPrev = (DamagePtr *) \
- &(pWindow->devPrivates[damageWinPrivateIndex].ptr)
+ dixLookupPrivateAddr(&(pWindow)->devPrivates, damageWinPrivateKey)
static void
DamageReportDamage (DamagePtr pDamage, RegionPtr pDamageRegion)
@@ -1779,30 +1778,10 @@ DamageSetup (ScreenPtr pScreen)
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
- if (damageGeneration != serverGeneration)
- {
- damageScrPrivateIndex = AllocateScreenPrivateIndex ();
- if (damageScrPrivateIndex == -1)
- return FALSE;
- damageGCPrivateIndex = AllocateGCPrivateIndex ();
- if (damageGCPrivateIndex == -1)
- return FALSE;
- damagePixPrivateIndex = AllocatePixmapPrivateIndex ();
- if (damagePixPrivateIndex == -1)
- return FALSE;
- damageWinPrivateIndex = AllocateWindowPrivateIndex ();
- if (damageWinPrivateIndex == -1)
- return FALSE;
- damageGeneration = serverGeneration;
- }
- if (pScreen->devPrivates[damageScrPrivateIndex].ptr)
+ if (dixLookupPrivate(&pScreen->devPrivates, damageScrPrivateKey))
return TRUE;
- if (!AllocateGCPrivate (pScreen, damageGCPrivateIndex, sizeof (DamageGCPrivRec)))
- return FALSE;
- if (!AllocatePixmapPrivate (pScreen, damagePixPrivateIndex, 0))
- return FALSE;
- if (!AllocateWindowPrivate (pScreen, damageWinPrivateIndex, 0))
+ if (!dixRequestPrivate(damageGCPrivateKey, sizeof(DamageGCPrivRec)))
return FALSE;
pScrPriv = (DamageScrPrivPtr) xalloc (sizeof (DamageScrPrivRec));
@@ -1827,7 +1806,7 @@ DamageSetup (ScreenPtr pScreen)
}
#endif
- pScreen->devPrivates[damageScrPrivateIndex].ptr = (pointer) pScrPriv;
+ dixSetPrivate(&pScreen->devPrivates, damageScrPrivateKey, pScrPriv);
return TRUE;
}
diff --git a/miext/damage/damagestr.h b/miext/damage/damagestr.h
index 1e0efad4f..9f3dd6684 100755
--- a/miext/damage/damagestr.h
+++ b/miext/damage/damagestr.h
@@ -29,6 +29,7 @@
#include "damage.h"
#include "gcstruct.h"
+#include "privates.h"
#ifdef RENDER
# include "picturestr.h"
#endif
@@ -80,31 +81,31 @@ typedef struct _damageGCPriv {
} DamageGCPrivRec, *DamageGCPrivPtr;
/* XXX should move these into damage.c, damageScrPrivateIndex is static */
-#define damageGetScrPriv(pScr) \
- ((DamageScrPrivPtr) (pScr)->devPrivates[damageScrPrivateIndex].ptr)
+#define damageGetScrPriv(pScr) ((DamageScrPrivPtr) \
+ dixLookupPrivate(&(pScr)->devPrivates, damageScrPrivateKey))
#define damageScrPriv(pScr) \
DamageScrPrivPtr pScrPriv = damageGetScrPriv(pScr)
#define damageGetPixPriv(pPix) \
- ((DamagePtr) (pPix)->devPrivates[damagePixPrivateIndex].ptr)
+ dixLookupPrivate(&(pPix)->devPrivates, damagePixPrivateKey)
#define damgeSetPixPriv(pPix,v) \
- ((pPix)->devPrivates[damagePixPrivateIndex].ptr = (pointer ) (v))
+ dixSetPrivate(&(pPix)->devPrivates, damagePixPrivateKey, v)
#define damagePixPriv(pPix) \
DamagePtr pDamage = damageGetPixPriv(pPix)
#define damageGetGCPriv(pGC) \
- ((DamageGCPrivPtr) (pGC)->devPrivates[damageGCPrivateIndex].ptr)
+ dixLookupPrivate(&(pGC)->devPrivates, damageGCPrivateKey)
#define damageGCPriv(pGC) \
DamageGCPrivPtr pGCPriv = damageGetGCPriv(pGC)
#define damageGetWinPriv(pWin) \
- ((DamagePtr) (pWin)->devPrivates[damageWinPrivateIndex].ptr)
+ ((DamagePtr)dixLookupPrivate(&(pWin)->devPrivates, damageWinPrivateKey))
#define damageSetWinPriv(pWin,d) \
- ((pWin)->devPrivates[damageWinPrivateIndex].ptr = (d))
+ dixSetPrivate(&(pWin)->devPrivates, damageWinPrivateKey, d)
#endif /* _DAMAGESTR_H_ */