diff options
author | Eric Anholt <anholt@freebsd.org> | 2006-03-14 20:38:06 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2006-03-14 20:38:06 +0000 |
commit | d30905478078036383977ae9d4a3685c2e2c642f (patch) | |
tree | 687cc2627532b3834ae56e6cf5696f68ae636be0 /exa | |
parent | 01aa209f2056ef04e3f2735756a0f8b4a67a3d87 (diff) |
Pull code for getting the (0,0) pixel from a pixmap out to a separate
function, since it gets repeated (with bad error handling, in one
case).
Diffstat (limited to 'exa')
-rw-r--r-- | exa/exa_accel.c | 21 | ||||
-rw-r--r-- | exa/exa_priv.h | 5 | ||||
-rw-r--r-- | exa/exa_render.c | 19 | ||||
-rw-r--r-- | exa/exa_unaccel.c | 28 |
4 files changed, 36 insertions, 37 deletions
diff --git a/exa/exa_accel.c b/exa/exa_accel.c index 9d02ab990..ca3afc3ec 100644 --- a/exa/exa_accel.c +++ b/exa/exa_accel.c @@ -782,26 +782,7 @@ exaFillRegionTiled (DrawablePtr pDrawable, * FillRegionSolid, saving numerous copies. */ if (tileWidth == 1 && tileHeight == 1) { - CARD32 pixel; - - exaDrawableUseMemory(&pTile->drawable); - exaPrepareAccess(&pTile->drawable, EXA_PREPARE_SRC); - switch (pTile->drawable.bitsPerPixel) { - case 8: - pixel = *(CARD8 *)(pTile->devPrivate.ptr); - break; - case 16: - pixel = *(CARD16 *)(pTile->devPrivate.ptr); - break; - case 32: - pixel = *(CARD32 *)(pTile->devPrivate.ptr); - break; - default: - exaFinishAccess(&pTile->drawable, EXA_PREPARE_SRC); - goto fallback; - } - exaFinishAccess(&pTile->drawable, EXA_PREPARE_SRC); - exaFillRegionSolid(pDrawable, pRegion, pixel); + exaFillRegionSolid(pDrawable, pRegion, exaGetPixmapFirstPixel (pTile)); return; } diff --git a/exa/exa_priv.h b/exa/exa_priv.h index 048566e00..d9f0be1a4 100644 --- a/exa/exa_priv.h +++ b/exa/exa_priv.h @@ -147,7 +147,7 @@ typedef struct { */ void exaDDXDriverInit (ScreenPtr pScreen); -/* exaasync.c */ +/* exa_unaccel.c */ void ExaCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans, DDXPointPtr ppt, int *pwidth, int fSorted); @@ -246,6 +246,9 @@ ExaCheckRestoreAreas (PixmapPtr pPixmap, void ExaCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what); +CARD32 +exaGetPixmapFirstPixel (PixmapPtr pPixmap); + /* exa_accel.c */ void exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); diff --git a/exa/exa_render.c b/exa/exa_render.c index e0d9fda16..713817095 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -243,7 +243,9 @@ exaTryDriverSolidFill(PicturePtr pSrc, width, height)) return 1; - exaDrawableUseMemory(pSrc->pDrawable); + pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable); + pixel = exaGetPixmapFirstPixel (pSrcPix); + exaDrawableUseScreen(pDst->pDrawable); pDstPix = exaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y); @@ -252,27 +254,12 @@ exaTryDriverSolidFill(PicturePtr pSrc, return 0; } - pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable); - - exaPrepareAccess(&pSrcPix->drawable, EXA_PREPARE_SRC); - switch (pSrcPix->drawable.bitsPerPixel) { - case 32: - pixel = *(CARD32 *)(pSrcPix->devPrivate.ptr); - break; - case 16: - pixel = *(CARD16 *)(pSrcPix->devPrivate.ptr); - break; - default: - pixel = *(CARD8 *)(pSrcPix->devPrivate.ptr); - break; - } if (!exaGetRGBAFromPixel(pixel, &red, &green, &blue, &alpha, pSrc->format)) { REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); return -1; } - exaFinishAccess(&pSrcPix->drawable, EXA_PREPARE_SRC); exaGetPixelFromRGBA(&pixel, red, green, blue, alpha, pDst->format); diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c index 52c7e88f9..361147cea 100644 --- a/exa/exa_unaccel.c +++ b/exa/exa_unaccel.c @@ -326,6 +326,34 @@ ExaCheckComposite (CARD8 op, exaFinishAccess (pDst->pDrawable, EXA_PREPARE_DEST); } +/** + * Gets the 0,0 pixel of a pixmap. Used for doing solid fills of tiled pixmaps + * that happen to be 1x1. Pixmap must be at least 8bpp. + */ +CARD32 +exaGetPixmapFirstPixel (PixmapPtr pPixmap) +{ + CARD32 pixel; + + exaDrawableUseMemory(&pPixmap->drawable); + + exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC); + switch (pPixmap->drawable.bitsPerPixel) { + case 32: + pixel = *(CARD32 *)(pPixmap->devPrivate.ptr); + break; + case 16: + pixel = *(CARD16 *)(pPixmap->devPrivate.ptr); + break; + default: + pixel = *(CARD8 *)(pPixmap->devPrivate.ptr); + break; + } + exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC); + + return pixel; +} + /* * Only need to stall for CopyArea/CopyPlane, but we want to have the chance to * do migration for CopyArea. |