mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 03:44:06 +00:00
Change the devPrivates API to require dixRegisterPrivateKey
This patch only changes the API, not the implementation of the devPrivates infrastructure. This will permit a new devPrivates implementation to be layed into the server without requiring simultaneous changes in every devPrivates user. Signed-off-by: Keith Packard <keithp@keithp.com> Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com>
This commit is contained in:
17
dix/pixmap.c
17
dix/pixmap.c
@@ -91,6 +91,11 @@ FreeScratchPixmapHeader(PixmapPtr pPixmap)
|
||||
Bool
|
||||
CreateScratchPixmapsForScreen(int scrnum)
|
||||
{
|
||||
unsigned int pixmap_size;
|
||||
|
||||
pixmap_size = sizeof(PixmapRec) + dixPrivatesSize(PRIVATE_PIXMAP);
|
||||
screenInfo.screens[scrnum]->totalPixmapSize = BitmapBytePad(pixmap_size * 8);
|
||||
|
||||
/* let it be created on first use */
|
||||
screenInfo.screens[scrnum]->pScratchPixmap = NULL;
|
||||
return TRUE;
|
||||
@@ -110,6 +115,8 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
|
||||
{
|
||||
PixmapPtr pPixmap;
|
||||
|
||||
assert(pScreen->totalPixmapSize > 0);
|
||||
|
||||
if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize)
|
||||
return NullPixmap;
|
||||
|
||||
@@ -117,6 +124,14 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
|
||||
if (!pPixmap)
|
||||
return NullPixmap;
|
||||
|
||||
pPixmap->devPrivates = NULL;
|
||||
dixInitPrivates(pPixmap, pPixmap + 1, PRIVATE_PIXMAP);
|
||||
return pPixmap;
|
||||
}
|
||||
|
||||
/* callable by ddx */
|
||||
void
|
||||
FreePixmap(PixmapPtr pPixmap)
|
||||
{
|
||||
dixFiniPrivates(pPixmap, PRIVATE_PIXMAP);
|
||||
free(pPixmap);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user