Add GLX code to Xgl
This commit is contained in:
parent
ddfa6f00da
commit
e40db7f26a
11
hw/xgl/xgl.h
11
hw/xgl/xgl.h
|
@ -351,6 +351,7 @@ typedef struct _xglPixmap {
|
||||||
Bool allBits;
|
Bool allBits;
|
||||||
unsigned long pictureMask;
|
unsigned long pictureMask;
|
||||||
xglGeometryPtr pGeometry;
|
xglGeometryPtr pGeometry;
|
||||||
|
int lock;
|
||||||
} xglPixmapRec, *xglPixmapPtr;
|
} xglPixmapRec, *xglPixmapPtr;
|
||||||
|
|
||||||
extern int xglPixmapPrivateIndex;
|
extern int xglPixmapPrivateIndex;
|
||||||
|
@ -1313,6 +1314,9 @@ xglUpdatePicture (PicturePtr pPicture);
|
||||||
Bool
|
Bool
|
||||||
xglPictureInit (ScreenPtr pScreen);
|
xglPictureInit (ScreenPtr pScreen);
|
||||||
|
|
||||||
|
void
|
||||||
|
xglPictureClipExtents (PicturePtr pPicture,
|
||||||
|
BoxPtr extents);
|
||||||
|
|
||||||
/* xglglyph.c */
|
/* xglglyph.c */
|
||||||
|
|
||||||
|
@ -1365,4 +1369,11 @@ xglAddTraps (PicturePtr pDst,
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef GLXEXT
|
||||||
|
|
||||||
|
Bool
|
||||||
|
xglInitVisualConfigs (ScreenPtr pScreen);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _XGL_H_ */
|
#endif /* _XGL_H_ */
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -837,7 +837,8 @@ xglCachedGlyphs (CARD8 op,
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
xglGlyphExtents (int nlist,
|
xglGlyphExtents (PicturePtr pDst,
|
||||||
|
int nlist,
|
||||||
GlyphListPtr list,
|
GlyphListPtr list,
|
||||||
GlyphPtr *glyphs,
|
GlyphPtr *glyphs,
|
||||||
BoxPtr extents)
|
BoxPtr extents)
|
||||||
|
@ -941,6 +942,8 @@ xglGlyphExtents (int nlist,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xglPictureClipExtents (pDst, extents);
|
||||||
|
|
||||||
return overlap;
|
return overlap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -981,20 +984,26 @@ xglGlyphs (CARD8 op,
|
||||||
BoxRec extents;
|
BoxRec extents;
|
||||||
xglGlyphOpRec glyphOp;
|
xglGlyphOpRec glyphOp;
|
||||||
int xDst = list->xOff, yDst = list->yOff;
|
int xDst = list->xOff, yDst = list->yOff;
|
||||||
|
int overlap;
|
||||||
|
int target;
|
||||||
|
|
||||||
|
XGL_DRAWABLE_PIXMAP_PRIV (pDst->pDrawable);
|
||||||
|
|
||||||
|
overlap = xglGlyphExtents (pDst, nlist, list, glyphs, &extents);
|
||||||
|
if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
target = xglPrepareTarget (pDst->pDrawable);
|
||||||
|
|
||||||
if (op != PictOpAdd && maskFormat &&
|
if (op != PictOpAdd && maskFormat &&
|
||||||
(xglGlyphExtents (nlist, list, glyphs, &extents) || op != PictOpOver ||
|
(overlap || op != PictOpOver ||
|
||||||
xglGlyphListFormatId (list, nlist) != maskFormat->id))
|
xglGlyphListFormatId (list, nlist) != maskFormat->id))
|
||||||
{
|
{
|
||||||
PixmapPtr pPixmap;
|
PixmapPtr pPixmap;
|
||||||
xglPixmapPtr pPixmapPriv;
|
CARD32 componentAlpha;
|
||||||
CARD32 componentAlpha;
|
GCPtr pGC;
|
||||||
GCPtr pGC;
|
xRectangle rect;
|
||||||
xRectangle rect;
|
int error;
|
||||||
int error;
|
|
||||||
|
|
||||||
if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
|
@ -1012,7 +1021,17 @@ xglGlyphs (CARD8 op,
|
||||||
maskFormat, CPComponentAlpha, &componentAlpha,
|
maskFormat, CPComponentAlpha, &componentAlpha,
|
||||||
serverClient, &error);
|
serverClient, &error);
|
||||||
if (!pMask)
|
if (!pMask)
|
||||||
|
{
|
||||||
|
(*pScreen->DestroyPixmap) (pPixmap);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* make sure destination drawable is locked */
|
||||||
|
pPixmapPriv->lock++;
|
||||||
|
|
||||||
|
/* lock mask if we are not doing accelerated drawing to destination */
|
||||||
|
if (!target)
|
||||||
|
XGL_GET_PIXMAP_PRIV (pPixmap)->lock = 1;
|
||||||
|
|
||||||
ValidatePicture (pMask);
|
ValidatePicture (pMask);
|
||||||
pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
|
pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
|
||||||
|
@ -1020,14 +1039,9 @@ xglGlyphs (CARD8 op,
|
||||||
(*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &rect);
|
(*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &rect);
|
||||||
FreeScratchGC (pGC);
|
FreeScratchGC (pGC);
|
||||||
|
|
||||||
/* all will be damaged */
|
|
||||||
pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap);
|
|
||||||
pPixmapPriv->damageBox.x1 = 0;
|
|
||||||
pPixmapPriv->damageBox.y1 = 0;
|
|
||||||
pPixmapPriv->damageBox.x2 = pMask->pDrawable->width;
|
|
||||||
pPixmapPriv->damageBox.y2 = pMask->pDrawable->height;
|
|
||||||
|
|
||||||
(*pScreen->DestroyPixmap) (pPixmap);
|
(*pScreen->DestroyPixmap) (pPixmap);
|
||||||
|
|
||||||
|
target = xglPrepareTarget (pMask->pDrawable);
|
||||||
|
|
||||||
glyphOp.xOff = -extents.x1;
|
glyphOp.xOff = -extents.x1;
|
||||||
glyphOp.yOff = -extents.y1;
|
glyphOp.yOff = -extents.y1;
|
||||||
|
@ -1036,6 +1050,9 @@ xglGlyphs (CARD8 op,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* make sure destination drawable is locked */
|
||||||
|
pPixmapPriv->lock++;
|
||||||
|
|
||||||
glyphOp.xOff = 0;
|
glyphOp.xOff = 0;
|
||||||
glyphOp.yOff = 0;
|
glyphOp.yOff = 0;
|
||||||
pSrcPicture = pSrc;
|
pSrcPicture = pSrc;
|
||||||
|
@ -1043,11 +1060,7 @@ xglGlyphs (CARD8 op,
|
||||||
}
|
}
|
||||||
|
|
||||||
glyphOp.ppGlyphs = glyphs;
|
glyphOp.ppGlyphs = glyphs;
|
||||||
|
glyphOp.noCache = !target;
|
||||||
if (xglPrepareTarget (pDstPicture->pDrawable))
|
|
||||||
glyphOp.noCache = FALSE;
|
|
||||||
else
|
|
||||||
glyphOp.noCache = TRUE;
|
|
||||||
|
|
||||||
while (nlist--)
|
while (nlist--)
|
||||||
{
|
{
|
||||||
|
@ -1097,6 +1110,10 @@ xglGlyphs (CARD8 op,
|
||||||
|
|
||||||
FreePicture ((pointer) pMask, (XID) 0);
|
FreePicture ((pointer) pMask, (XID) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* release destination drawable lock */
|
||||||
|
pPixmapPriv->lock--;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -90,6 +90,9 @@ xglOffscreenCompareScore (xglAreaPtr pArea,
|
||||||
|
|
||||||
if (s1 > s2)
|
if (s1 > s2)
|
||||||
XGL_DECREMENT_PIXMAP_SCORE (pPixmapPriv, 10);
|
XGL_DECREMENT_PIXMAP_SCORE (pPixmapPriv, 10);
|
||||||
|
|
||||||
|
if (pPixmapPriv->lock)
|
||||||
|
return 1;
|
||||||
|
|
||||||
return s1 - s2;
|
return s1 - s2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -464,4 +464,41 @@ xglPictureInit (ScreenPtr pScreen)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
xglPictureClipExtents (PicturePtr pPicture,
|
||||||
|
BoxPtr extents)
|
||||||
|
{
|
||||||
|
if (pPicture->clientClipType != CT_NONE)
|
||||||
|
{
|
||||||
|
BoxPtr clip = REGION_EXTENTS (pPicture->pDrawable->pScreen,
|
||||||
|
(RegionPtr) pPicture->clientClip);
|
||||||
|
|
||||||
|
if (extents->x1 < pPicture->clipOrigin.x + clip->x1)
|
||||||
|
extents->x1 = pPicture->clipOrigin.x + clip->x1;
|
||||||
|
|
||||||
|
if (extents->y1 < pPicture->clipOrigin.y + clip->y1)
|
||||||
|
extents->y1 = pPicture->clipOrigin.y + clip->y1;
|
||||||
|
|
||||||
|
if (extents->x2 > pPicture->clipOrigin.x + clip->x2)
|
||||||
|
extents->x2 = pPicture->clipOrigin.x + clip->x2;
|
||||||
|
|
||||||
|
if (extents->y2 > pPicture->clipOrigin.y + clip->y2)
|
||||||
|
extents->y2 = pPicture->clipOrigin.y + clip->y2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (extents->x1 < 0)
|
||||||
|
extents->x1 = 0;
|
||||||
|
|
||||||
|
if (extents->y1 < 0)
|
||||||
|
extents->y1 = 0;
|
||||||
|
|
||||||
|
if (extents->x2 > pPicture->pDrawable->width)
|
||||||
|
extents->x2 = pPicture->pDrawable->width;
|
||||||
|
|
||||||
|
if (extents->y2 > pPicture->pDrawable->height)
|
||||||
|
extents->y2 = pPicture->pDrawable->height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -106,6 +106,7 @@ xglPixmapSurfaceInit (PixmapPtr pPixmap,
|
||||||
pPixmapPriv->acceleratedTile = FALSE;
|
pPixmapPriv->acceleratedTile = FALSE;
|
||||||
pPixmapPriv->pictureMask = ~0;
|
pPixmapPriv->pictureMask = ~0;
|
||||||
pPixmapPriv->target = xglPixmapTargetNo;
|
pPixmapPriv->target = xglPixmapTargetNo;
|
||||||
|
pPixmapPriv->lock = 0;
|
||||||
|
|
||||||
if (pPixmapPriv->format)
|
if (pPixmapPriv->format)
|
||||||
{
|
{
|
||||||
|
@ -209,7 +210,7 @@ void
|
||||||
xglFiniPixmap (PixmapPtr pPixmap)
|
xglFiniPixmap (PixmapPtr pPixmap)
|
||||||
{
|
{
|
||||||
XGL_PIXMAP_PRIV (pPixmap);
|
XGL_PIXMAP_PRIV (pPixmap);
|
||||||
|
|
||||||
if (pPixmapPriv->pArea)
|
if (pPixmapPriv->pArea)
|
||||||
xglWithdrawArea (pPixmapPriv->pArea);
|
xglWithdrawArea (pPixmapPriv->pArea);
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,9 @@ static ShmFuncs shmFuncs = { NULL, xglShmPutImage };
|
||||||
#ifdef RENDER
|
#ifdef RENDER
|
||||||
#include "glyphstr.h"
|
#include "glyphstr.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef COMPOSITE
|
||||||
|
#include "compint.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
int xglScreenGeneration = -1;
|
int xglScreenGeneration = -1;
|
||||||
int xglScreenPrivateIndex;
|
int xglScreenPrivateIndex;
|
||||||
|
@ -135,7 +138,7 @@ xglScreenInit (ScreenPtr pScreen,
|
||||||
xglScreenInfoPtr pScreenInfo)
|
xglScreenInfoPtr pScreenInfo)
|
||||||
{
|
{
|
||||||
xglScreenPtr pScreenPriv;
|
xglScreenPtr pScreenPriv;
|
||||||
int depth;
|
int depth, bpp;
|
||||||
|
|
||||||
#ifdef RENDER
|
#ifdef RENDER
|
||||||
PictureScreenPtr pPictureScreen;
|
PictureScreenPtr pPictureScreen;
|
||||||
|
@ -154,6 +157,7 @@ xglScreenInit (ScreenPtr pScreen,
|
||||||
glitz_drawable_get_features (pScreenInfo->drawable);
|
glitz_drawable_get_features (pScreenInfo->drawable);
|
||||||
|
|
||||||
depth = pScreenPriv->pVisual->pPixel->depth;
|
depth = pScreenPriv->pVisual->pPixel->depth;
|
||||||
|
bpp = pScreenPriv->pVisual->pPixel->masks.bpp;
|
||||||
|
|
||||||
if (!xglInitOffscreen (pScreen, pScreenInfo))
|
if (!xglInitOffscreen (pScreen, pScreenInfo))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -190,8 +194,7 @@ xglScreenInit (ScreenPtr pScreen,
|
||||||
if (!fbSetupScreen (pScreen, NULL,
|
if (!fbSetupScreen (pScreen, NULL,
|
||||||
pScreenInfo->width, pScreenInfo->height,
|
pScreenInfo->width, pScreenInfo->height,
|
||||||
monitorResolution, monitorResolution,
|
monitorResolution, monitorResolution,
|
||||||
pScreenInfo->width,
|
pScreenInfo->width, bpp))
|
||||||
pScreenPriv->pVisual->pPixel->masks.bpp))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pScreen->SaveScreen = xglSaveScreen;
|
pScreen->SaveScreen = xglSaveScreen;
|
||||||
|
@ -202,8 +205,7 @@ xglScreenInit (ScreenPtr pScreen,
|
||||||
if (!fbFinishScreenInit (pScreen, NULL,
|
if (!fbFinishScreenInit (pScreen, NULL,
|
||||||
pScreenInfo->width, pScreenInfo->height,
|
pScreenInfo->width, pScreenInfo->height,
|
||||||
monitorResolution, monitorResolution,
|
monitorResolution, monitorResolution,
|
||||||
pScreenInfo->width,
|
pScreenInfo->width, bpp))
|
||||||
pScreenPriv->pVisual->pPixel->masks.bpp))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
#ifdef MITSHM
|
#ifdef MITSHM
|
||||||
|
@ -267,6 +269,19 @@ xglScreenInit (ScreenPtr pScreen,
|
||||||
XGL_SCREEN_WRAP (BackingStoreFuncs.SaveAreas, xglSaveAreas);
|
XGL_SCREEN_WRAP (BackingStoreFuncs.SaveAreas, xglSaveAreas);
|
||||||
XGL_SCREEN_WRAP (BackingStoreFuncs.RestoreAreas, xglRestoreAreas);
|
XGL_SCREEN_WRAP (BackingStoreFuncs.RestoreAreas, xglRestoreAreas);
|
||||||
|
|
||||||
|
if (!fbCreateDefColormap (pScreen))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
#ifdef COMPOSITE
|
||||||
|
if (!compScreenInit (pScreen))
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GLXEXT
|
||||||
|
if (!xglInitVisualConfigs (pScreen))
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Damage is required */
|
/* Damage is required */
|
||||||
DamageSetup (pScreen);
|
DamageSetup (pScreen);
|
||||||
|
|
||||||
|
@ -288,13 +303,6 @@ xglFinishScreenInit (ScreenPtr pScreen)
|
||||||
|
|
||||||
XGL_SCREEN_PRIV (pScreen);
|
XGL_SCREEN_PRIV (pScreen);
|
||||||
|
|
||||||
/* Do we want to use BackingStore?
|
|
||||||
miInitializeBackingStore (pScreen);
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!fbCreateDefColormap (pScreen))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
pScreenPriv->solid =
|
pScreenPriv->solid =
|
||||||
glitz_surface_create (pScreenPriv->drawable,
|
glitz_surface_create (pScreenPriv->drawable,
|
||||||
pScreenPriv->pixmapFormats[32].format,
|
pScreenPriv->pixmapFormats[32].format,
|
||||||
|
|
|
@ -304,6 +304,9 @@ xglPrepareTarget (DrawablePtr pDrawable)
|
||||||
break;
|
break;
|
||||||
case xglPixmapTargetOut:
|
case xglPixmapTargetOut:
|
||||||
XGL_INCREMENT_PIXMAP_SCORE (pPixmapPriv, 10);
|
XGL_INCREMENT_PIXMAP_SCORE (pPixmapPriv, 10);
|
||||||
|
|
||||||
|
if (pPixmapPriv->lock)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (xglFindOffscreenArea (pDrawable->pScreen, pPixmap))
|
if (xglFindOffscreenArea (pDrawable->pScreen, pPixmap))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
234
hw/xgl/xgltrap.c
234
hw/xgl/xgltrap.c
|
@ -40,64 +40,6 @@
|
||||||
/* just a guess */
|
/* just a guess */
|
||||||
#define SMOOTH_TRAPS_ESTIMATE_RECTS(nTrap) (30 * nTrap)
|
#define SMOOTH_TRAPS_ESTIMATE_RECTS(nTrap) (30 * nTrap)
|
||||||
|
|
||||||
static PicturePtr
|
|
||||||
xglCreateMaskPicture (ScreenPtr pScreen,
|
|
||||||
PicturePtr pDst,
|
|
||||||
PictFormatPtr pPictFormat,
|
|
||||||
CARD16 width,
|
|
||||||
CARD16 height,
|
|
||||||
Bool accelerate)
|
|
||||||
{
|
|
||||||
PixmapPtr pPixmap;
|
|
||||||
PicturePtr pPicture;
|
|
||||||
GCPtr pGC;
|
|
||||||
int error;
|
|
||||||
xRectangle rect;
|
|
||||||
|
|
||||||
if (width > 32767 || height > 32767)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
|
|
||||||
pPictFormat->depth);
|
|
||||||
if (!pPixmap)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (!accelerate)
|
|
||||||
{
|
|
||||||
XGL_PIXMAP_PRIV (pPixmap);
|
|
||||||
|
|
||||||
if (!xglAllocatePixmapBits (pPixmap, XGL_PIXMAP_USAGE_HINT_DEFAULT))
|
|
||||||
{
|
|
||||||
(*pScreen->DestroyPixmap) (pPixmap);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
pPixmapPriv->target = xglPixmapTargetNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
|
|
||||||
if (!pGC)
|
|
||||||
{
|
|
||||||
(*pScreen->DestroyPixmap) (pPixmap);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
rect.x = 0;
|
|
||||||
rect.y = 0;
|
|
||||||
rect.width = width;
|
|
||||||
rect.height = height;
|
|
||||||
|
|
||||||
ValidateGC (&pPixmap->drawable, pGC);
|
|
||||||
(*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &rect);
|
|
||||||
FreeScratchGC (pGC);
|
|
||||||
|
|
||||||
pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat,
|
|
||||||
0, 0, serverClient, &error);
|
|
||||||
(*pScreen->DestroyPixmap) (pPixmap);
|
|
||||||
|
|
||||||
return pPicture;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define LINE_FIXED_X(l, _y, v) \
|
#define LINE_FIXED_X(l, _y, v) \
|
||||||
dx = (l)->p2.x - (l)->p1.x; \
|
dx = (l)->p2.x - (l)->p1.x; \
|
||||||
ex = (xFixed_32_32) ((_y) - (l)->p1.y) * dx; \
|
ex = (xFixed_32_32) ((_y) - (l)->p1.y) * dx; \
|
||||||
|
@ -111,9 +53,10 @@ xglCreateMaskPicture (ScreenPtr pScreen,
|
||||||
(v) = (l)->p1.x + (xFixed) ((ex + (dy - 1)) / dy)
|
(v) = (l)->p1.x + (xFixed) ((ex + (dy - 1)) / dy)
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
xglTrapezoidBounds (int ntrap,
|
xglTrapezoidExtents (PicturePtr pDst,
|
||||||
xTrapezoid *traps,
|
int ntrap,
|
||||||
BoxPtr box)
|
xTrapezoid *traps,
|
||||||
|
BoxPtr extents)
|
||||||
{
|
{
|
||||||
Bool x_overlap, overlap = FALSE;
|
Bool x_overlap, overlap = FALSE;
|
||||||
xFixed dx, dy, top, bottom;
|
xFixed dx, dy, top, bottom;
|
||||||
|
@ -121,24 +64,24 @@ xglTrapezoidBounds (int ntrap,
|
||||||
|
|
||||||
if (!ntrap)
|
if (!ntrap)
|
||||||
{
|
{
|
||||||
box->x1 = MAXSHORT;
|
extents->x1 = MAXSHORT;
|
||||||
box->x2 = MINSHORT;
|
extents->x2 = MINSHORT;
|
||||||
box->y1 = MAXSHORT;
|
extents->y1 = MAXSHORT;
|
||||||
box->y2 = MINSHORT;
|
extents->y2 = MINSHORT;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
box->y1 = xFixedToInt (traps->top);
|
extents->y1 = xFixedToInt (traps->top);
|
||||||
box->y2 = xFixedToInt (xFixedCeil (traps->bottom));
|
extents->y2 = xFixedToInt (xFixedCeil (traps->bottom));
|
||||||
|
|
||||||
LINE_FIXED_X (&traps->left, traps->top, top);
|
LINE_FIXED_X (&traps->left, traps->top, top);
|
||||||
LINE_FIXED_X (&traps->left, traps->bottom, bottom);
|
LINE_FIXED_X (&traps->left, traps->bottom, bottom);
|
||||||
box->x1 = xFixedToInt (MIN (top, bottom));
|
extents->x1 = xFixedToInt (MIN (top, bottom));
|
||||||
|
|
||||||
LINE_FIXED_X_CEIL (&traps->right, traps->top, top);
|
LINE_FIXED_X_CEIL (&traps->right, traps->top, top);
|
||||||
LINE_FIXED_X_CEIL (&traps->right, traps->bottom, bottom);
|
LINE_FIXED_X_CEIL (&traps->right, traps->bottom, bottom);
|
||||||
box->x2 = xFixedToInt (xFixedCeil (MAX (top, bottom)));
|
extents->x2 = xFixedToInt (xFixedCeil (MAX (top, bottom)));
|
||||||
|
|
||||||
ntrap--;
|
ntrap--;
|
||||||
traps++;
|
traps++;
|
||||||
|
@ -162,35 +105,37 @@ xglTrapezoidBounds (int ntrap,
|
||||||
x2 = xFixedToInt (xFixedCeil (MAX (top, bottom)));
|
x2 = xFixedToInt (xFixedCeil (MAX (top, bottom)));
|
||||||
|
|
||||||
x_overlap = FALSE;
|
x_overlap = FALSE;
|
||||||
if (x1 >= box->x2)
|
if (x1 >= extents->x2)
|
||||||
box->x2 = x2;
|
extents->x2 = x2;
|
||||||
else if (x2 <= box->x1)
|
else if (x2 <= extents->x1)
|
||||||
box->x1 = x1;
|
extents->x1 = x1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x_overlap = TRUE;
|
x_overlap = TRUE;
|
||||||
if (x1 < box->x1)
|
if (x1 < extents->x1)
|
||||||
box->x1 = x1;
|
extents->x1 = x1;
|
||||||
if (x2 > box->x2)
|
if (x2 > extents->x2)
|
||||||
box->x2 = x2;
|
extents->x2 = x2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y1 >= box->y2)
|
if (y1 >= extents->y2)
|
||||||
box->y2 = y2;
|
extents->y2 = y2;
|
||||||
else if (y2 <= box->y1)
|
else if (y2 <= extents->y1)
|
||||||
box->y1 = y1;
|
extents->y1 = y1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (y1 < box->y1)
|
if (y1 < extents->y1)
|
||||||
box->y1 = y1;
|
extents->y1 = y1;
|
||||||
if (y2 > box->y2)
|
if (y2 > extents->y2)
|
||||||
box->y2 = y2;
|
extents->y2 = y2;
|
||||||
|
|
||||||
if (x_overlap)
|
if (x_overlap)
|
||||||
overlap = TRUE;
|
overlap = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xglPictureClipExtents (pDst, extents);
|
||||||
|
|
||||||
return overlap;
|
return overlap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,24 +156,30 @@ xglTrapezoids (CARD8 op,
|
||||||
unsigned int polyEdge = pDst->polyEdge;
|
unsigned int polyEdge = pDst->polyEdge;
|
||||||
INT16 xDst, yDst;
|
INT16 xDst, yDst;
|
||||||
INT16 xOff, yOff;
|
INT16 xOff, yOff;
|
||||||
BoxRec bounds;
|
BoxRec extents;
|
||||||
Bool overlap;
|
Bool overlap;
|
||||||
|
Bool target;
|
||||||
|
|
||||||
XGL_SCREEN_PRIV (pScreen);
|
XGL_SCREEN_PRIV (pScreen);
|
||||||
|
XGL_DRAWABLE_PIXMAP_PRIV (pDst->pDrawable);
|
||||||
|
|
||||||
xDst = traps[0].left.p1.x >> 16;
|
xDst = traps[0].left.p1.x >> 16;
|
||||||
yDst = traps[0].left.p1.y >> 16;
|
yDst = traps[0].left.p1.y >> 16;
|
||||||
|
|
||||||
overlap = xglTrapezoidBounds (nTrap, traps, &bounds);
|
overlap = xglTrapezoidExtents (pDst, nTrap, traps, &extents);
|
||||||
if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
|
if (extents.y1 >= extents.y2 || extents.x1 >= extents.x2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
target = xglPrepareTarget (pDst->pDrawable);
|
||||||
|
|
||||||
if (nTrap > 1 && op != PictOpAdd && maskFormat &&
|
if (nTrap > 1 && op != PictOpAdd && maskFormat &&
|
||||||
(overlap || op != PictOpOver))
|
(overlap || op != PictOpOver))
|
||||||
{
|
{
|
||||||
xglPixmapPtr pPixmapPriv;
|
PixmapPtr pPixmap;
|
||||||
int width, height;
|
GCPtr pGC;
|
||||||
Bool accelerate;
|
xRectangle rect;
|
||||||
|
int error;
|
||||||
|
int area;
|
||||||
|
|
||||||
if (!pScreenPriv->pSolidAlpha)
|
if (!pScreenPriv->pSolidAlpha)
|
||||||
{
|
{
|
||||||
|
@ -237,39 +188,53 @@ xglTrapezoids (CARD8 op,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
accelerate = TRUE;
|
rect.x = 0;
|
||||||
width = bounds.x2 - bounds.x1;
|
rect.y = 0;
|
||||||
height = bounds.y2 - bounds.y1;
|
rect.width = extents.x2 - extents.x1;
|
||||||
if (maskFormat->depth > 1)
|
rect.height = extents.y2 - extents.y1;
|
||||||
{
|
|
||||||
/* Avoid acceleration if the estimated amount of vertex data
|
|
||||||
is likely to exceed the size of the mask. */
|
|
||||||
if ((SMOOTH_TRAPS_ESTIMATE_RECTS (nTrap) * 4) > (width * height))
|
|
||||||
accelerate = FALSE;
|
|
||||||
} else
|
|
||||||
accelerate = FALSE;
|
|
||||||
|
|
||||||
pMask = xglCreateMaskPicture (pScreen, pDst, maskFormat,
|
pPixmap = (*pScreen->CreatePixmap) (pScreen,
|
||||||
width, height, accelerate);
|
rect.width, rect.height,
|
||||||
if (!pMask)
|
maskFormat->depth);
|
||||||
|
if (!pPixmap)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
pMask = CreatePicture (0, &pPixmap->drawable, maskFormat,
|
||||||
|
0, 0, serverClient, &error);
|
||||||
|
if (!pMask)
|
||||||
|
{
|
||||||
|
(*pScreen->DestroyPixmap) (pPixmap);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* make sure destination drawable is locked */
|
||||||
|
pPixmapPriv->lock++;
|
||||||
|
|
||||||
|
/* lock mask if we are not doing accelerated drawing to destination */
|
||||||
|
area = rect.width * rect.height;
|
||||||
|
if (!target || (SMOOTH_TRAPS_ESTIMATE_RECTS (nTrap) * 4) > area)
|
||||||
|
XGL_GET_PIXMAP_PRIV (pPixmap)->lock = 1;
|
||||||
|
|
||||||
ValidatePicture (pMask);
|
ValidatePicture (pMask);
|
||||||
|
pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
|
||||||
|
ValidateGC (&pPixmap->drawable, pGC);
|
||||||
|
(*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &rect);
|
||||||
|
FreeScratchGC (pGC);
|
||||||
|
|
||||||
/* all will be damaged */
|
(*pScreen->DestroyPixmap) (pPixmap);
|
||||||
pPixmapPriv = XGL_GET_DRAWABLE_PIXMAP_PRIV (pMask->pDrawable);
|
|
||||||
pPixmapPriv->damageBox.x1 = 0;
|
|
||||||
pPixmapPriv->damageBox.y1 = 0;
|
|
||||||
pPixmapPriv->damageBox.x2 = pMask->pDrawable->width;
|
|
||||||
pPixmapPriv->damageBox.y2 = pMask->pDrawable->height;
|
|
||||||
|
|
||||||
xOff = -bounds.x1;
|
target = xglPrepareTarget (pMask->pDrawable);
|
||||||
yOff = -bounds.y1;
|
|
||||||
|
xOff = -extents.x1;
|
||||||
|
yOff = -extents.y1;
|
||||||
pSrcPicture = pScreenPriv->pSolidAlpha;
|
pSrcPicture = pScreenPriv->pSolidAlpha;
|
||||||
pDstPicture = pMask;
|
pDstPicture = pMask;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* make sure destination drawable is locked */
|
||||||
|
pPixmapPriv->lock++;
|
||||||
|
|
||||||
if (maskFormat)
|
if (maskFormat)
|
||||||
{
|
{
|
||||||
if (maskFormat->depth == 1)
|
if (maskFormat->depth == 1)
|
||||||
|
@ -284,7 +249,7 @@ xglTrapezoids (CARD8 op,
|
||||||
pDstPicture = pDst;
|
pDstPicture = pDst;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xglPrepareTarget (pDstPicture->pDrawable))
|
if (target)
|
||||||
{
|
{
|
||||||
if (maskFormat || polyEdge == PolyEdgeSmooth)
|
if (maskFormat || polyEdge == PolyEdgeSmooth)
|
||||||
{
|
{
|
||||||
|
@ -309,7 +274,8 @@ xglTrapezoids (CARD8 op,
|
||||||
{
|
{
|
||||||
if (pMask)
|
if (pMask)
|
||||||
FreePicture (pMask, 0);
|
FreePicture (pMask, 0);
|
||||||
|
|
||||||
|
pPixmapPriv->lock--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +303,8 @@ xglTrapezoids (CARD8 op,
|
||||||
{
|
{
|
||||||
if (pMask)
|
if (pMask)
|
||||||
FreePicture (pMask, 0);
|
FreePicture (pMask, 0);
|
||||||
|
|
||||||
|
pPixmapPriv->lock--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,13 +321,13 @@ xglTrapezoids (CARD8 op,
|
||||||
pSrcPicture,
|
pSrcPicture,
|
||||||
NULL,
|
NULL,
|
||||||
pDstPicture,
|
pDstPicture,
|
||||||
bounds.x1 + xOff + xSrc - xDst,
|
extents.x1 + xOff + xSrc - xDst,
|
||||||
bounds.y1 + yOff + ySrc - yDst,
|
extents.y1 + yOff + ySrc - yDst,
|
||||||
0, 0,
|
0, 0,
|
||||||
pDstPicture->pDrawable->x + bounds.x1 + xOff,
|
pDstPicture->pDrawable->x + extents.x1 + xOff,
|
||||||
pDstPicture->pDrawable->y + bounds.y1 + yOff,
|
pDstPicture->pDrawable->y + extents.y1 + yOff,
|
||||||
bounds.x2 - bounds.x1,
|
extents.x2 - extents.x1,
|
||||||
bounds.y2 - bounds.y1,
|
extents.y2 - extents.y1,
|
||||||
pGeometry,
|
pGeometry,
|
||||||
mask))
|
mask))
|
||||||
{
|
{
|
||||||
|
@ -370,7 +337,7 @@ xglTrapezoids (CARD8 op,
|
||||||
{
|
{
|
||||||
RegionRec region;
|
RegionRec region;
|
||||||
|
|
||||||
REGION_INIT (pScreen, ®ion, &bounds, 1);
|
REGION_INIT (pScreen, ®ion, &extents, 1);
|
||||||
REGION_TRANSLATE (pScreen, ®ion,
|
REGION_TRANSLATE (pScreen, ®ion,
|
||||||
pDst->pDrawable->x, pDst->pDrawable->y);
|
pDst->pDrawable->x, pDst->pDrawable->y);
|
||||||
|
|
||||||
|
@ -385,10 +352,10 @@ xglTrapezoids (CARD8 op,
|
||||||
{
|
{
|
||||||
XGL_DRAWABLE_PIXMAP_PRIV (pDstPicture->pDrawable);
|
XGL_DRAWABLE_PIXMAP_PRIV (pDstPicture->pDrawable);
|
||||||
|
|
||||||
pPixmapPriv->damageBox.x1 = bounds.x1 + xOff;
|
pPixmapPriv->damageBox.x1 = extents.x1 + xOff;
|
||||||
pPixmapPriv->damageBox.y1 = bounds.y1 + yOff;
|
pPixmapPriv->damageBox.y1 = extents.y1 + yOff;
|
||||||
pPixmapPriv->damageBox.x2 = bounds.x2 + xOff;
|
pPixmapPriv->damageBox.x2 = extents.x2 + xOff;
|
||||||
pPixmapPriv->damageBox.y2 = bounds.y2 + yOff;
|
pPixmapPriv->damageBox.y2 = extents.y2 + yOff;
|
||||||
|
|
||||||
xglSyncDamageBoxBits (pDstPicture->pDrawable);
|
xglSyncDamageBoxBits (pDstPicture->pDrawable);
|
||||||
|
|
||||||
|
@ -411,15 +378,18 @@ xglTrapezoids (CARD8 op,
|
||||||
xglLeaveOffscreenArea ((PixmapPtr) pMask->pDrawable);
|
xglLeaveOffscreenArea ((PixmapPtr) pMask->pDrawable);
|
||||||
|
|
||||||
CompositePicture (op, pSrc, pMask, pDst,
|
CompositePicture (op, pSrc, pMask, pDst,
|
||||||
bounds.x1 + xSrc - xDst,
|
extents.x1 + xSrc - xDst,
|
||||||
bounds.y1 + ySrc - yDst,
|
extents.y1 + ySrc - yDst,
|
||||||
0, 0,
|
0, 0,
|
||||||
bounds.x1, bounds.y1,
|
extents.x1, extents.y1,
|
||||||
bounds.x2 - bounds.x1,
|
extents.x2 - extents.x1,
|
||||||
bounds.y2 - bounds.y1);
|
extents.y2 - extents.y1);
|
||||||
|
|
||||||
FreePicture (pMask, 0);
|
FreePicture (pMask, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* release destination drawable lock */
|
||||||
|
pPixmapPriv->lock--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue