Move the frequently-repeated code to get the pixmap that backs a drawable
to a new function, exaGetDrawablePixmap().
This commit is contained in:
parent
ee3c7ccb17
commit
5e2a7af23b
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2006-02-02 Eric Anholt <anholt@FreeBSD.org>
|
||||||
|
|
||||||
|
* hw/xfree86/exa/exa.c: (exaGetDrawablePixmap), (exaDrawableDirty),
|
||||||
|
(exaDrawableIsOffscreen), (exaPrepareAccess), (exaFinishAccess):
|
||||||
|
* hw/xfree86/exa/exa_migration.c: (exaDrawableUseScreen),
|
||||||
|
(exaDrawableUseMemory):
|
||||||
|
* hw/xfree86/exa/exa_priv.h:
|
||||||
|
* hw/xfree86/exa/exa_render.c: (exaTryDriverSolidFill),
|
||||||
|
(exaTryDriverComposite):
|
||||||
|
Move the frequently-repeated code to get the pixmap that backs a
|
||||||
|
drawable to a new function, exaGetDrawablePixmap().
|
||||||
|
|
||||||
2006-02-02 Eric Anholt <anholt@FreeBSD.org>
|
2006-02-02 Eric Anholt <anholt@FreeBSD.org>
|
||||||
|
|
||||||
* hw/xfree86/exa/exa_accel.c: (exaFillSpans), (exaCopyNtoN),
|
* hw/xfree86/exa/exa_accel.c: (exaFillSpans), (exaCopyNtoN),
|
||||||
|
|
45
exa/exa.c
45
exa/exa.c
|
@ -72,18 +72,21 @@ exaGetPixmapSize(PixmapPtr pPix)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PixmapPtr
|
||||||
|
exaGetDrawablePixmap(DrawablePtr pDrawable)
|
||||||
|
{
|
||||||
|
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||||
|
return pDrawable->pScreen->GetWindowPixmap ((WindowPtr) pDrawable);
|
||||||
|
else
|
||||||
|
return (PixmapPtr) pDrawable;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
exaDrawableDirty (DrawablePtr pDrawable)
|
exaDrawableDirty (DrawablePtr pDrawable)
|
||||||
{
|
{
|
||||||
PixmapPtr pPixmap;
|
|
||||||
ExaPixmapPrivPtr pExaPixmap;
|
ExaPixmapPrivPtr pExaPixmap;
|
||||||
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
pExaPixmap = ExaGetPixmapPriv(exaGetDrawablePixmap (pDrawable));
|
||||||
pPixmap = (*pDrawable->pScreen->GetWindowPixmap)((WindowPtr) pDrawable);
|
|
||||||
else
|
|
||||||
pPixmap = (PixmapPtr)pDrawable;
|
|
||||||
|
|
||||||
pExaPixmap = ExaGetPixmapPriv(pPixmap);
|
|
||||||
if (pExaPixmap != NULL)
|
if (pExaPixmap != NULL)
|
||||||
pExaPixmap->dirty = TRUE;
|
pExaPixmap->dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -166,6 +169,12 @@ exaPixmapIsOffscreen(PixmapPtr p)
|
||||||
pExaScr->info->card.memorySize);
|
pExaScr->info->card.memorySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
exaDrawableIsOffscreen (DrawablePtr pDrawable)
|
||||||
|
{
|
||||||
|
return exaPixmapIsOffscreen (exaGetDrawablePixmap (pDrawable));
|
||||||
|
}
|
||||||
|
|
||||||
PixmapPtr
|
PixmapPtr
|
||||||
exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
|
exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
|
||||||
{
|
{
|
||||||
|
@ -196,18 +205,6 @@ exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
|
||||||
exaDrawableIsOffscreen (DrawablePtr pDrawable)
|
|
||||||
{
|
|
||||||
PixmapPtr pPixmap;
|
|
||||||
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
|
||||||
pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
|
|
||||||
else
|
|
||||||
pPixmap = (PixmapPtr) pDrawable;
|
|
||||||
return exaPixmapIsOffscreen (pPixmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
exaPrepareAccess(DrawablePtr pDrawable, int index)
|
exaPrepareAccess(DrawablePtr pDrawable, int index)
|
||||||
{
|
{
|
||||||
|
@ -215,10 +212,7 @@ exaPrepareAccess(DrawablePtr pDrawable, int index)
|
||||||
ExaScreenPriv (pScreen);
|
ExaScreenPriv (pScreen);
|
||||||
PixmapPtr pPixmap;
|
PixmapPtr pPixmap;
|
||||||
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
pPixmap = exaGetDrawablePixmap (pDrawable);
|
||||||
pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
|
|
||||||
else
|
|
||||||
pPixmap = (PixmapPtr) pDrawable;
|
|
||||||
|
|
||||||
if (index == EXA_PREPARE_DEST)
|
if (index == EXA_PREPARE_DEST)
|
||||||
exaDrawableDirty (pDrawable);
|
exaDrawableDirty (pDrawable);
|
||||||
|
@ -248,10 +242,7 @@ exaFinishAccess(DrawablePtr pDrawable, int index)
|
||||||
if (pExaScr->info->accel.FinishAccess == NULL)
|
if (pExaScr->info->accel.FinishAccess == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
pPixmap = exaGetDrawablePixmap (pDrawable);
|
||||||
pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
|
|
||||||
else
|
|
||||||
pPixmap = (PixmapPtr) pDrawable;
|
|
||||||
if (!exaPixmapIsOffscreen (pPixmap))
|
if (!exaPixmapIsOffscreen (pPixmap))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -235,27 +235,13 @@ exaMoveOutPixmap (PixmapPtr pPixmap)
|
||||||
void
|
void
|
||||||
exaDrawableUseScreen(DrawablePtr pDrawable)
|
exaDrawableUseScreen(DrawablePtr pDrawable)
|
||||||
{
|
{
|
||||||
PixmapPtr pPixmap;
|
exaPixmapUseScreen (exaGetDrawablePixmap (pDrawable));
|
||||||
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
|
||||||
pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
|
|
||||||
else
|
|
||||||
pPixmap = (PixmapPtr) pDrawable;
|
|
||||||
|
|
||||||
exaPixmapUseScreen (pPixmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
exaDrawableUseMemory(DrawablePtr pDrawable)
|
exaDrawableUseMemory(DrawablePtr pDrawable)
|
||||||
{
|
{
|
||||||
PixmapPtr pPixmap;
|
exaPixmapUseMemory (exaGetDrawablePixmap (pDrawable));
|
||||||
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
|
||||||
pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
|
|
||||||
else
|
|
||||||
pPixmap = (PixmapPtr) pDrawable;
|
|
||||||
|
|
||||||
exaPixmapUseMemory (pPixmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -315,6 +315,9 @@ exaPixmapIsOffscreen(PixmapPtr p);
|
||||||
PixmapPtr
|
PixmapPtr
|
||||||
exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp);
|
exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp);
|
||||||
|
|
||||||
|
PixmapPtr
|
||||||
|
exaGetDrawablePixmap(DrawablePtr pDrawable);
|
||||||
|
|
||||||
void
|
void
|
||||||
exaMoveInPixmap (PixmapPtr pPixmap);
|
exaMoveInPixmap (PixmapPtr pPixmap);
|
||||||
|
|
||||||
|
|
|
@ -253,12 +253,7 @@ exaTryDriverSolidFill(PicturePtr pSrc,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
|
pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable);
|
||||||
pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap)(
|
|
||||||
(WindowPtr) (pSrc->pDrawable));
|
|
||||||
else
|
|
||||||
pSrcPix = (PixmapPtr) (pSrc->pDrawable);
|
|
||||||
|
|
||||||
|
|
||||||
exaPrepareAccess(&pSrcPix->drawable, EXA_PREPARE_SRC);
|
exaPrepareAccess(&pSrcPix->drawable, EXA_PREPARE_SRC);
|
||||||
switch (pSrcPix->drawable.bitsPerPixel) {
|
switch (pSrcPix->drawable.bitsPerPixel) {
|
||||||
|
@ -385,19 +380,11 @@ exaTryDriverComposite(CARD8 op,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pSrcPix && (!pMask || pMaskPix) && pExaScr->info->accel.UploadToScratch) {
|
if (!pSrcPix && (!pMask || pMaskPix) && pExaScr->info->accel.UploadToScratch) {
|
||||||
if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
|
pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable);
|
||||||
pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap) (
|
|
||||||
(WindowPtr) pSrc->pDrawable);
|
|
||||||
else
|
|
||||||
pSrcPix = (PixmapPtr) pSrc->pDrawable;
|
|
||||||
if ((*pExaScr->info->accel.UploadToScratch) (pSrcPix, &scratch))
|
if ((*pExaScr->info->accel.UploadToScratch) (pSrcPix, &scratch))
|
||||||
pSrcPix = &scratch;
|
pSrcPix = &scratch;
|
||||||
} else if (pSrcPix && pMask && !pMaskPix && pExaScr->info->accel.UploadToScratch) {
|
} else if (pSrcPix && pMask && !pMaskPix && pExaScr->info->accel.UploadToScratch) {
|
||||||
if (pMask->pDrawable->type == DRAWABLE_WINDOW)
|
pMaskPix = exaGetDrawablePixmap (pMask->pDrawable);
|
||||||
pMaskPix = (*pMask->pDrawable->pScreen->GetWindowPixmap) (
|
|
||||||
(WindowPtr) pMask->pDrawable);
|
|
||||||
else
|
|
||||||
pMaskPix = (PixmapPtr) pMask->pDrawable;
|
|
||||||
if ((*pExaScr->info->accel.UploadToScratch) (pMaskPix, &scratch))
|
if ((*pExaScr->info->accel.UploadToScratch) (pMaskPix, &scratch))
|
||||||
pMaskPix = &scratch;
|
pMaskPix = &scratch;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,18 +72,21 @@ exaGetPixmapSize(PixmapPtr pPix)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PixmapPtr
|
||||||
|
exaGetDrawablePixmap(DrawablePtr pDrawable)
|
||||||
|
{
|
||||||
|
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||||
|
return pDrawable->pScreen->GetWindowPixmap ((WindowPtr) pDrawable);
|
||||||
|
else
|
||||||
|
return (PixmapPtr) pDrawable;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
exaDrawableDirty (DrawablePtr pDrawable)
|
exaDrawableDirty (DrawablePtr pDrawable)
|
||||||
{
|
{
|
||||||
PixmapPtr pPixmap;
|
|
||||||
ExaPixmapPrivPtr pExaPixmap;
|
ExaPixmapPrivPtr pExaPixmap;
|
||||||
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
pExaPixmap = ExaGetPixmapPriv(exaGetDrawablePixmap (pDrawable));
|
||||||
pPixmap = (*pDrawable->pScreen->GetWindowPixmap)((WindowPtr) pDrawable);
|
|
||||||
else
|
|
||||||
pPixmap = (PixmapPtr)pDrawable;
|
|
||||||
|
|
||||||
pExaPixmap = ExaGetPixmapPriv(pPixmap);
|
|
||||||
if (pExaPixmap != NULL)
|
if (pExaPixmap != NULL)
|
||||||
pExaPixmap->dirty = TRUE;
|
pExaPixmap->dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -166,6 +169,12 @@ exaPixmapIsOffscreen(PixmapPtr p)
|
||||||
pExaScr->info->card.memorySize);
|
pExaScr->info->card.memorySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
exaDrawableIsOffscreen (DrawablePtr pDrawable)
|
||||||
|
{
|
||||||
|
return exaPixmapIsOffscreen (exaGetDrawablePixmap (pDrawable));
|
||||||
|
}
|
||||||
|
|
||||||
PixmapPtr
|
PixmapPtr
|
||||||
exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
|
exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
|
||||||
{
|
{
|
||||||
|
@ -196,18 +205,6 @@ exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
|
||||||
exaDrawableIsOffscreen (DrawablePtr pDrawable)
|
|
||||||
{
|
|
||||||
PixmapPtr pPixmap;
|
|
||||||
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
|
||||||
pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
|
|
||||||
else
|
|
||||||
pPixmap = (PixmapPtr) pDrawable;
|
|
||||||
return exaPixmapIsOffscreen (pPixmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
exaPrepareAccess(DrawablePtr pDrawable, int index)
|
exaPrepareAccess(DrawablePtr pDrawable, int index)
|
||||||
{
|
{
|
||||||
|
@ -215,10 +212,7 @@ exaPrepareAccess(DrawablePtr pDrawable, int index)
|
||||||
ExaScreenPriv (pScreen);
|
ExaScreenPriv (pScreen);
|
||||||
PixmapPtr pPixmap;
|
PixmapPtr pPixmap;
|
||||||
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
pPixmap = exaGetDrawablePixmap (pDrawable);
|
||||||
pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
|
|
||||||
else
|
|
||||||
pPixmap = (PixmapPtr) pDrawable;
|
|
||||||
|
|
||||||
if (index == EXA_PREPARE_DEST)
|
if (index == EXA_PREPARE_DEST)
|
||||||
exaDrawableDirty (pDrawable);
|
exaDrawableDirty (pDrawable);
|
||||||
|
@ -248,10 +242,7 @@ exaFinishAccess(DrawablePtr pDrawable, int index)
|
||||||
if (pExaScr->info->accel.FinishAccess == NULL)
|
if (pExaScr->info->accel.FinishAccess == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
pPixmap = exaGetDrawablePixmap (pDrawable);
|
||||||
pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
|
|
||||||
else
|
|
||||||
pPixmap = (PixmapPtr) pDrawable;
|
|
||||||
if (!exaPixmapIsOffscreen (pPixmap))
|
if (!exaPixmapIsOffscreen (pPixmap))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -235,27 +235,13 @@ exaMoveOutPixmap (PixmapPtr pPixmap)
|
||||||
void
|
void
|
||||||
exaDrawableUseScreen(DrawablePtr pDrawable)
|
exaDrawableUseScreen(DrawablePtr pDrawable)
|
||||||
{
|
{
|
||||||
PixmapPtr pPixmap;
|
exaPixmapUseScreen (exaGetDrawablePixmap (pDrawable));
|
||||||
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
|
||||||
pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
|
|
||||||
else
|
|
||||||
pPixmap = (PixmapPtr) pDrawable;
|
|
||||||
|
|
||||||
exaPixmapUseScreen (pPixmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
exaDrawableUseMemory(DrawablePtr pDrawable)
|
exaDrawableUseMemory(DrawablePtr pDrawable)
|
||||||
{
|
{
|
||||||
PixmapPtr pPixmap;
|
exaPixmapUseMemory (exaGetDrawablePixmap (pDrawable));
|
||||||
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
|
||||||
pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
|
|
||||||
else
|
|
||||||
pPixmap = (PixmapPtr) pDrawable;
|
|
||||||
|
|
||||||
exaPixmapUseMemory (pPixmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -315,6 +315,9 @@ exaPixmapIsOffscreen(PixmapPtr p);
|
||||||
PixmapPtr
|
PixmapPtr
|
||||||
exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp);
|
exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp);
|
||||||
|
|
||||||
|
PixmapPtr
|
||||||
|
exaGetDrawablePixmap(DrawablePtr pDrawable);
|
||||||
|
|
||||||
void
|
void
|
||||||
exaMoveInPixmap (PixmapPtr pPixmap);
|
exaMoveInPixmap (PixmapPtr pPixmap);
|
||||||
|
|
||||||
|
|
|
@ -253,12 +253,7 @@ exaTryDriverSolidFill(PicturePtr pSrc,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
|
pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable);
|
||||||
pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap)(
|
|
||||||
(WindowPtr) (pSrc->pDrawable));
|
|
||||||
else
|
|
||||||
pSrcPix = (PixmapPtr) (pSrc->pDrawable);
|
|
||||||
|
|
||||||
|
|
||||||
exaPrepareAccess(&pSrcPix->drawable, EXA_PREPARE_SRC);
|
exaPrepareAccess(&pSrcPix->drawable, EXA_PREPARE_SRC);
|
||||||
switch (pSrcPix->drawable.bitsPerPixel) {
|
switch (pSrcPix->drawable.bitsPerPixel) {
|
||||||
|
@ -385,19 +380,11 @@ exaTryDriverComposite(CARD8 op,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pSrcPix && (!pMask || pMaskPix) && pExaScr->info->accel.UploadToScratch) {
|
if (!pSrcPix && (!pMask || pMaskPix) && pExaScr->info->accel.UploadToScratch) {
|
||||||
if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
|
pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable);
|
||||||
pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap) (
|
|
||||||
(WindowPtr) pSrc->pDrawable);
|
|
||||||
else
|
|
||||||
pSrcPix = (PixmapPtr) pSrc->pDrawable;
|
|
||||||
if ((*pExaScr->info->accel.UploadToScratch) (pSrcPix, &scratch))
|
if ((*pExaScr->info->accel.UploadToScratch) (pSrcPix, &scratch))
|
||||||
pSrcPix = &scratch;
|
pSrcPix = &scratch;
|
||||||
} else if (pSrcPix && pMask && !pMaskPix && pExaScr->info->accel.UploadToScratch) {
|
} else if (pSrcPix && pMask && !pMaskPix && pExaScr->info->accel.UploadToScratch) {
|
||||||
if (pMask->pDrawable->type == DRAWABLE_WINDOW)
|
pMaskPix = exaGetDrawablePixmap (pMask->pDrawable);
|
||||||
pMaskPix = (*pMask->pDrawable->pScreen->GetWindowPixmap) (
|
|
||||||
(WindowPtr) pMask->pDrawable);
|
|
||||||
else
|
|
||||||
pMaskPix = (PixmapPtr) pMask->pDrawable;
|
|
||||||
if ((*pExaScr->info->accel.UploadToScratch) (pMaskPix, &scratch))
|
if ((*pExaScr->info->accel.UploadToScratch) (pMaskPix, &scratch))
|
||||||
pMaskPix = &scratch;
|
pMaskPix = &scratch;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue