diff options
author | Eric Anholt <anholt@freebsd.org> | 2006-02-02 21:07:06 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2006-02-02 21:07:06 +0000 |
commit | 5e2a7af23bd0f46fbddca34098cb297be58b7a55 (patch) | |
tree | f697bfdb546452a96e81f08dc8f53c6288dd85d2 /hw/xfree86/exa | |
parent | ee3c7ccb175752dbeaed6b0113d0819b3fcd2398 (diff) |
Move the frequently-repeated code to get the pixmap that backs a drawable
to a new function, exaGetDrawablePixmap().
Diffstat (limited to 'hw/xfree86/exa')
-rw-r--r-- | hw/xfree86/exa/exa.c | 45 | ||||
-rw-r--r-- | hw/xfree86/exa/exa_migration.c | 18 | ||||
-rw-r--r-- | hw/xfree86/exa/exa_priv.h | 3 | ||||
-rw-r--r-- | hw/xfree86/exa/exa_render.c | 19 |
4 files changed, 26 insertions, 59 deletions
diff --git a/hw/xfree86/exa/exa.c b/hw/xfree86/exa/exa.c index 45de08e53..7c5ef9f7b 100644 --- a/hw/xfree86/exa/exa.c +++ b/hw/xfree86/exa/exa.c @@ -72,18 +72,21 @@ exaGetPixmapSize(PixmapPtr pPix) return 0; } +PixmapPtr +exaGetDrawablePixmap(DrawablePtr pDrawable) +{ + if (pDrawable->type == DRAWABLE_WINDOW) + return pDrawable->pScreen->GetWindowPixmap ((WindowPtr) pDrawable); + else + return (PixmapPtr) pDrawable; +} + void exaDrawableDirty (DrawablePtr pDrawable) { - PixmapPtr pPixmap; ExaPixmapPrivPtr pExaPixmap; - if (pDrawable->type == DRAWABLE_WINDOW) - pPixmap = (*pDrawable->pScreen->GetWindowPixmap)((WindowPtr) pDrawable); - else - pPixmap = (PixmapPtr)pDrawable; - - pExaPixmap = ExaGetPixmapPriv(pPixmap); + pExaPixmap = ExaGetPixmapPriv(exaGetDrawablePixmap (pDrawable)); if (pExaPixmap != NULL) pExaPixmap->dirty = TRUE; } @@ -166,6 +169,12 @@ exaPixmapIsOffscreen(PixmapPtr p) pExaScr->info->card.memorySize); } +Bool +exaDrawableIsOffscreen (DrawablePtr pDrawable) +{ + return exaPixmapIsOffscreen (exaGetDrawablePixmap (pDrawable)); +} + PixmapPtr exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp) { @@ -196,18 +205,6 @@ exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp) 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 exaPrepareAccess(DrawablePtr pDrawable, int index) { @@ -215,10 +212,7 @@ exaPrepareAccess(DrawablePtr pDrawable, int index) ExaScreenPriv (pScreen); PixmapPtr pPixmap; - if (pDrawable->type == DRAWABLE_WINDOW) - pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable); - else - pPixmap = (PixmapPtr) pDrawable; + pPixmap = exaGetDrawablePixmap (pDrawable); if (index == EXA_PREPARE_DEST) exaDrawableDirty (pDrawable); @@ -248,10 +242,7 @@ exaFinishAccess(DrawablePtr pDrawable, int index) if (pExaScr->info->accel.FinishAccess == NULL) return; - if (pDrawable->type == DRAWABLE_WINDOW) - pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable); - else - pPixmap = (PixmapPtr) pDrawable; + pPixmap = exaGetDrawablePixmap (pDrawable); if (!exaPixmapIsOffscreen (pPixmap)) return; diff --git a/hw/xfree86/exa/exa_migration.c b/hw/xfree86/exa/exa_migration.c index 42491247c..2acda24da 100644 --- a/hw/xfree86/exa/exa_migration.c +++ b/hw/xfree86/exa/exa_migration.c @@ -235,27 +235,13 @@ exaMoveOutPixmap (PixmapPtr pPixmap) void exaDrawableUseScreen(DrawablePtr pDrawable) { - PixmapPtr pPixmap; - - if (pDrawable->type == DRAWABLE_WINDOW) - pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable); - else - pPixmap = (PixmapPtr) pDrawable; - - exaPixmapUseScreen (pPixmap); + exaPixmapUseScreen (exaGetDrawablePixmap (pDrawable)); } void exaDrawableUseMemory(DrawablePtr pDrawable) { - PixmapPtr pPixmap; - - if (pDrawable->type == DRAWABLE_WINDOW) - pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable); - else - pPixmap = (PixmapPtr) pDrawable; - - exaPixmapUseMemory (pPixmap); + exaPixmapUseMemory (exaGetDrawablePixmap (pDrawable)); } void diff --git a/hw/xfree86/exa/exa_priv.h b/hw/xfree86/exa/exa_priv.h index 19bd2e79e..460c4da81 100644 --- a/hw/xfree86/exa/exa_priv.h +++ b/hw/xfree86/exa/exa_priv.h @@ -315,6 +315,9 @@ exaPixmapIsOffscreen(PixmapPtr p); PixmapPtr exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp); +PixmapPtr +exaGetDrawablePixmap(DrawablePtr pDrawable); + void exaMoveInPixmap (PixmapPtr pPixmap); diff --git a/hw/xfree86/exa/exa_render.c b/hw/xfree86/exa/exa_render.c index 49d73a3bf..4909a0fc4 100644 --- a/hw/xfree86/exa/exa_render.c +++ b/hw/xfree86/exa/exa_render.c @@ -253,12 +253,7 @@ exaTryDriverSolidFill(PicturePtr pSrc, return 0; } - if (pSrc->pDrawable->type == DRAWABLE_WINDOW) - pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap)( - (WindowPtr) (pSrc->pDrawable)); - else - pSrcPix = (PixmapPtr) (pSrc->pDrawable); - + pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable); exaPrepareAccess(&pSrcPix->drawable, EXA_PREPARE_SRC); switch (pSrcPix->drawable.bitsPerPixel) { @@ -385,19 +380,11 @@ exaTryDriverComposite(CARD8 op, } if (!pSrcPix && (!pMask || pMaskPix) && pExaScr->info->accel.UploadToScratch) { - if (pSrc->pDrawable->type == DRAWABLE_WINDOW) - pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap) ( - (WindowPtr) pSrc->pDrawable); - else - pSrcPix = (PixmapPtr) pSrc->pDrawable; + pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable); if ((*pExaScr->info->accel.UploadToScratch) (pSrcPix, &scratch)) pSrcPix = &scratch; } else if (pSrcPix && pMask && !pMaskPix && pExaScr->info->accel.UploadToScratch) { - if (pMask->pDrawable->type == DRAWABLE_WINDOW) - pMaskPix = (*pMask->pDrawable->pScreen->GetWindowPixmap) ( - (WindowPtr) pMask->pDrawable); - else - pMaskPix = (PixmapPtr) pMask->pDrawable; + pMaskPix = exaGetDrawablePixmap (pMask->pDrawable); if ((*pExaScr->info->accel.UploadToScratch) (pMaskPix, &scratch)) pMaskPix = &scratch; } |