Replace calls to Glyphs screen hook with CompositeGlyphs and remove dead code.
Not all of the DDX/miext Glyphs hook implementations have been removed, but they should be.
This commit is contained in:
parent
a3a95d3475
commit
4b14c9a9cd
|
@ -291,7 +291,9 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
|
||||||
pExaPixmap->fb_ptr = NULL;
|
pExaPixmap->fb_ptr = NULL;
|
||||||
} else {
|
} else {
|
||||||
pExaPixmap->driverPriv = NULL;
|
pExaPixmap->driverPriv = NULL;
|
||||||
/* Glyphs have w/h equal to zero, and may not be migrated. See exaGlyphs. */
|
/* Scratch pixmaps may have w/h equal to zero, and may not be
|
||||||
|
* migrated.
|
||||||
|
*/
|
||||||
if (!w || !h)
|
if (!w || !h)
|
||||||
pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
|
pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
|
||||||
else
|
else
|
||||||
|
@ -696,7 +698,6 @@ exaCloseScreen(int i, ScreenPtr pScreen)
|
||||||
#ifdef RENDER
|
#ifdef RENDER
|
||||||
if (ps) {
|
if (ps) {
|
||||||
ps->Composite = pExaScr->SavedComposite;
|
ps->Composite = pExaScr->SavedComposite;
|
||||||
ps->Glyphs = pExaScr->SavedGlyphs;
|
|
||||||
ps->Trapezoids = pExaScr->SavedTrapezoids;
|
ps->Trapezoids = pExaScr->SavedTrapezoids;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -865,9 +866,6 @@ exaDriverInit (ScreenPtr pScreen,
|
||||||
pExaScr->SavedTriangles = ps->Triangles;
|
pExaScr->SavedTriangles = ps->Triangles;
|
||||||
ps->Triangles = exaTriangles;
|
ps->Triangles = exaTriangles;
|
||||||
|
|
||||||
pExaScr->SavedGlyphs = ps->Glyphs;
|
|
||||||
ps->Glyphs = exaGlyphs;
|
|
||||||
|
|
||||||
pExaScr->SavedTrapezoids = ps->Trapezoids;
|
pExaScr->SavedTrapezoids = ps->Trapezoids;
|
||||||
ps->Trapezoids = exaTrapezoids;
|
ps->Trapezoids = exaTrapezoids;
|
||||||
}
|
}
|
||||||
|
|
258
exa/exa_render.c
258
exa/exa_render.c
|
@ -997,261 +997,3 @@ exaTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
|
||||||
exaTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, tris);
|
exaTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, tris);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns TRUE if the glyphs in the lists intersect. Only checks based on
|
|
||||||
* bounding box, which appears to be good enough to catch most cases at least.
|
|
||||||
*/
|
|
||||||
static Bool
|
|
||||||
exaGlyphsIntersect(int nlist, GlyphListPtr list, GlyphPtr *glyphs)
|
|
||||||
{
|
|
||||||
int x1, x2, y1, y2;
|
|
||||||
int n;
|
|
||||||
GlyphPtr glyph;
|
|
||||||
int x, y;
|
|
||||||
BoxRec extents;
|
|
||||||
Bool first = TRUE;
|
|
||||||
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
while (nlist--) {
|
|
||||||
x += list->xOff;
|
|
||||||
y += list->yOff;
|
|
||||||
n = list->len;
|
|
||||||
list++;
|
|
||||||
while (n--) {
|
|
||||||
glyph = *glyphs++;
|
|
||||||
|
|
||||||
if (glyph->info.width == 0 || glyph->info.height == 0) {
|
|
||||||
x += glyph->info.xOff;
|
|
||||||
y += glyph->info.yOff;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
x1 = x - glyph->info.x;
|
|
||||||
if (x1 < MINSHORT)
|
|
||||||
x1 = MINSHORT;
|
|
||||||
y1 = y - glyph->info.y;
|
|
||||||
if (y1 < MINSHORT)
|
|
||||||
y1 = MINSHORT;
|
|
||||||
x2 = x1 + glyph->info.width;
|
|
||||||
if (x2 > MAXSHORT)
|
|
||||||
x2 = MAXSHORT;
|
|
||||||
y2 = y1 + glyph->info.height;
|
|
||||||
if (y2 > MAXSHORT)
|
|
||||||
y2 = MAXSHORT;
|
|
||||||
|
|
||||||
if (first) {
|
|
||||||
extents.x1 = x1;
|
|
||||||
extents.y1 = y1;
|
|
||||||
extents.x2 = x2;
|
|
||||||
extents.y2 = y2;
|
|
||||||
first = FALSE;
|
|
||||||
} else {
|
|
||||||
if (x1 < extents.x2 && x2 > extents.x1 &&
|
|
||||||
y1 < extents.y2 && y2 > extents.y1)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x1 < extents.x1)
|
|
||||||
extents.x1 = x1;
|
|
||||||
if (x2 > extents.x2)
|
|
||||||
extents.x2 = x2;
|
|
||||||
if (y1 < extents.y1)
|
|
||||||
extents.y1 = y1;
|
|
||||||
if (y2 > extents.y2)
|
|
||||||
extents.y2 = y2;
|
|
||||||
}
|
|
||||||
x += glyph->info.xOff;
|
|
||||||
y += glyph->info.yOff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
|
|
||||||
|
|
||||||
/* exaGlyphs is a slight variation on miGlyphs, to support acceleration. The
|
|
||||||
* issue is that miGlyphs' use of ModifyPixmapHeader makes it impossible to
|
|
||||||
* migrate these pixmaps. So, instead we create a pixmap at the beginning of
|
|
||||||
* the loop and upload each glyph into the pixmap before compositing.
|
|
||||||
*
|
|
||||||
* This is now used even when Composite can't be accelerated for better
|
|
||||||
* migration control.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
exaGlyphs (CARD8 op,
|
|
||||||
PicturePtr pSrc,
|
|
||||||
PicturePtr pDst,
|
|
||||||
PictFormatPtr maskFormat,
|
|
||||||
INT16 xSrc,
|
|
||||||
INT16 ySrc,
|
|
||||||
int nlist,
|
|
||||||
GlyphListPtr list,
|
|
||||||
GlyphPtr *glyphs)
|
|
||||||
{
|
|
||||||
ExaScreenPriv (pDst->pDrawable->pScreen);
|
|
||||||
PicturePtr pPicture;
|
|
||||||
PixmapPtr pMaskPixmap = NULL;
|
|
||||||
PicturePtr pMask;
|
|
||||||
ScreenPtr pScreen = pDst->pDrawable->pScreen;
|
|
||||||
int width = 0, height = 0;
|
|
||||||
int x, y, x1, y1;
|
|
||||||
int xDst = list->xOff, yDst = list->yOff;
|
|
||||||
int n;
|
|
||||||
int error;
|
|
||||||
BoxRec extents;
|
|
||||||
CARD32 component_alpha;
|
|
||||||
|
|
||||||
/* If we have a mask format but it's the same as all the glyphs and
|
|
||||||
* the glyphs don't intersect, we can avoid accumulating the glyphs in the
|
|
||||||
* temporary picture.
|
|
||||||
*/
|
|
||||||
if (maskFormat != NULL) {
|
|
||||||
Bool sameFormat = TRUE;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < nlist; i++) {
|
|
||||||
if (maskFormat->format != list[i].format->format) {
|
|
||||||
sameFormat = FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (sameFormat) {
|
|
||||||
if (!exaGlyphsIntersect(nlist, list, glyphs)) {
|
|
||||||
maskFormat = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maskFormat)
|
|
||||||
{
|
|
||||||
GCPtr pGC;
|
|
||||||
xRectangle rect;
|
|
||||||
|
|
||||||
miGlyphExtents (nlist, list, glyphs, &extents);
|
|
||||||
|
|
||||||
extents.x1 = max(extents.x1, 0);
|
|
||||||
extents.y1 = max(extents.y1, 0);
|
|
||||||
extents.x2 = min(extents.x2, pDst->pDrawable->width);
|
|
||||||
extents.y2 = min(extents.y2, pDst->pDrawable->height);
|
|
||||||
|
|
||||||
if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
|
|
||||||
return;
|
|
||||||
width = extents.x2 - extents.x1;
|
|
||||||
height = extents.y2 - extents.y1;
|
|
||||||
pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
|
|
||||||
maskFormat->depth);
|
|
||||||
if (!pMaskPixmap)
|
|
||||||
return;
|
|
||||||
component_alpha = NeedsComponent(maskFormat->format);
|
|
||||||
pMask = CreatePicture (0, &pMaskPixmap->drawable,
|
|
||||||
maskFormat, CPComponentAlpha, &component_alpha,
|
|
||||||
serverClient, &error);
|
|
||||||
if (!pMask)
|
|
||||||
{
|
|
||||||
(*pScreen->DestroyPixmap) (pMaskPixmap);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ValidatePicture(pMask);
|
|
||||||
pGC = GetScratchGC (pMaskPixmap->drawable.depth, pScreen);
|
|
||||||
ValidateGC (&pMaskPixmap->drawable, pGC);
|
|
||||||
rect.x = 0;
|
|
||||||
rect.y = 0;
|
|
||||||
rect.width = width;
|
|
||||||
rect.height = height;
|
|
||||||
ExaCheckPolyFillRect (&pMaskPixmap->drawable, pGC, 1, &rect);
|
|
||||||
if (pExaScr->info->PrepareComposite)
|
|
||||||
(*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect);
|
|
||||||
else
|
|
||||||
exaPixmapDirty(pMaskPixmap, 0, 0, width, height);
|
|
||||||
FreeScratchGC (pGC);
|
|
||||||
x = -extents.x1;
|
|
||||||
y = -extents.y1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pMask = pDst;
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (nlist--)
|
|
||||||
{
|
|
||||||
GCPtr pGC = NULL;
|
|
||||||
int maxwidth = 0, maxheight = 0, i;
|
|
||||||
|
|
||||||
x += list->xOff;
|
|
||||||
y += list->yOff;
|
|
||||||
n = list->len;
|
|
||||||
for (i = 0; i < n; i++) {
|
|
||||||
if (glyphs[i]->info.width > maxwidth)
|
|
||||||
maxwidth = glyphs[i]->info.width;
|
|
||||||
if (glyphs[i]->info.height > maxheight)
|
|
||||||
maxheight = glyphs[i]->info.height;
|
|
||||||
}
|
|
||||||
if (maxwidth == 0 || maxheight == 0) {
|
|
||||||
while (n--)
|
|
||||||
{
|
|
||||||
GlyphPtr glyph;
|
|
||||||
|
|
||||||
glyph = *glyphs++;
|
|
||||||
x += glyph->info.xOff;
|
|
||||||
y += glyph->info.yOff;
|
|
||||||
}
|
|
||||||
list++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (n--)
|
|
||||||
{
|
|
||||||
GlyphPtr glyph = *glyphs++;
|
|
||||||
DrawablePtr pCmpDrw = (maskFormat ? pMask : pDst)->pDrawable;
|
|
||||||
|
|
||||||
x1 = x - glyph->info.x;
|
|
||||||
y1 = y - glyph->info.y;
|
|
||||||
|
|
||||||
if (x1 >= pCmpDrw->width || y1 >= pCmpDrw->height ||
|
|
||||||
glyph->info.width == 0 || glyph->info.height == 0 ||
|
|
||||||
(x1 + glyph->info.width) <= 0 || (y1 + glyph->info.height) <= 0)
|
|
||||||
goto nextglyph;
|
|
||||||
|
|
||||||
/* The glyph already has a Picture ready for us to use. */
|
|
||||||
pPicture = GlyphPicture (glyph)[pScreen->myNum];
|
|
||||||
ValidatePicture(pPicture);
|
|
||||||
|
|
||||||
if (maskFormat)
|
|
||||||
{
|
|
||||||
exaComposite (PictOpAdd, pPicture, NULL, pMask, 0, 0, 0, 0,
|
|
||||||
x1, y1, glyph->info.width, glyph->info.height);
|
|
||||||
exaPixmapDirty(pMaskPixmap, x1, y1, x1 + glyph->info.width,
|
|
||||||
y1 + glyph->info.height);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
exaComposite (op, pSrc, pPicture, pDst,
|
|
||||||
xSrc + x1 - xDst, ySrc + y1 - yDst,
|
|
||||||
0, 0, x1, y1, glyph->info.width,
|
|
||||||
glyph->info.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
nextglyph:
|
|
||||||
x += glyph->info.xOff;
|
|
||||||
y += glyph->info.yOff;
|
|
||||||
}
|
|
||||||
list++;
|
|
||||||
if (pGC != NULL)
|
|
||||||
FreeScratchGC (pGC);
|
|
||||||
}
|
|
||||||
if (maskFormat)
|
|
||||||
{
|
|
||||||
x = extents.x1;
|
|
||||||
y = extents.y1;
|
|
||||||
exaComposite (op, pSrc, pMask, pDst, xSrc + x - xDst, ySrc + y - yDst,
|
|
||||||
0, 0, x, y, width, height);
|
|
||||||
FreePicture ((pointer) pMask, (XID) 0);
|
|
||||||
(*pScreen->DestroyPixmap) (pMaskPixmap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -205,9 +205,6 @@ _X_HIDDEN void *miLookupTab[] = {
|
||||||
SYMVAR(miPointerScreenIndex)
|
SYMVAR(miPointerScreenIndex)
|
||||||
SYMVAR(miInstalledMaps)
|
SYMVAR(miInstalledMaps)
|
||||||
SYMVAR(miInitVisualsProc)
|
SYMVAR(miInitVisualsProc)
|
||||||
#ifdef RENDER
|
|
||||||
SYMFUNC(miGlyphExtents)
|
|
||||||
#endif
|
|
||||||
#ifdef DAMAGE
|
#ifdef DAMAGE
|
||||||
SYMFUNC(DamageDamageRegion)
|
SYMFUNC(DamageDamageRegion)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -98,7 +98,6 @@ typedef struct {
|
||||||
ValidatePictureProcPtr ValidatePicture;
|
ValidatePictureProcPtr ValidatePicture;
|
||||||
|
|
||||||
CompositeProcPtr Composite;
|
CompositeProcPtr Composite;
|
||||||
GlyphsProcPtr Glyphs;
|
|
||||||
CompositeRectsProcPtr CompositeRects;
|
CompositeRectsProcPtr CompositeRects;
|
||||||
|
|
||||||
TrapezoidsProcPtr Trapezoids;
|
TrapezoidsProcPtr Trapezoids;
|
||||||
|
|
|
@ -279,34 +279,6 @@ cwComposite (CARD8 op,
|
||||||
cwPsWrap(Composite, cwComposite);
|
cwPsWrap(Composite, cwComposite);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
cwGlyphs (CARD8 op,
|
|
||||||
PicturePtr pSrcPicture,
|
|
||||||
PicturePtr pDstPicture,
|
|
||||||
PictFormatPtr maskFormat,
|
|
||||||
INT16 xSrc,
|
|
||||||
INT16 ySrc,
|
|
||||||
int nlists,
|
|
||||||
GlyphListPtr lists,
|
|
||||||
GlyphPtr *glyphs)
|
|
||||||
{
|
|
||||||
ScreenPtr pScreen = pDstPicture->pDrawable->pScreen;
|
|
||||||
cwPsDecl(pScreen);
|
|
||||||
cwSrcPictureDecl;
|
|
||||||
cwDstPictureDecl;
|
|
||||||
|
|
||||||
cwPsUnwrap(Glyphs);
|
|
||||||
if (nlists)
|
|
||||||
{
|
|
||||||
lists->xOff += dst_picture_x_off;
|
|
||||||
lists->yOff += dst_picture_y_off;
|
|
||||||
}
|
|
||||||
(*ps->Glyphs) (op, pBackingSrcPicture, pBackingDstPicture, maskFormat,
|
|
||||||
xSrc + src_picture_x_off, ySrc + src_picture_y_off,
|
|
||||||
nlists, lists, glyphs);
|
|
||||||
cwPsWrap(Glyphs, cwGlyphs);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cwCompositeRects (CARD8 op,
|
cwCompositeRects (CARD8 op,
|
||||||
PicturePtr pDstPicture,
|
PicturePtr pDstPicture,
|
||||||
|
@ -470,7 +442,6 @@ cwInitializeRender (ScreenPtr pScreen)
|
||||||
cwPsWrap(ChangePicture, cwChangePicture);
|
cwPsWrap(ChangePicture, cwChangePicture);
|
||||||
cwPsWrap(ValidatePicture, cwValidatePicture);
|
cwPsWrap(ValidatePicture, cwValidatePicture);
|
||||||
cwPsWrap(Composite, cwComposite);
|
cwPsWrap(Composite, cwComposite);
|
||||||
cwPsWrap(Glyphs, cwGlyphs);
|
|
||||||
cwPsWrap(CompositeRects, cwCompositeRects);
|
cwPsWrap(CompositeRects, cwCompositeRects);
|
||||||
cwPsWrap(Trapezoids, cwTrapezoids);
|
cwPsWrap(Trapezoids, cwTrapezoids);
|
||||||
cwPsWrap(Triangles, cwTriangles);
|
cwPsWrap(Triangles, cwTriangles);
|
||||||
|
@ -491,7 +462,6 @@ cwFiniRender (ScreenPtr pScreen)
|
||||||
cwPsUnwrap(ChangePicture);
|
cwPsUnwrap(ChangePicture);
|
||||||
cwPsUnwrap(ValidatePicture);
|
cwPsUnwrap(ValidatePicture);
|
||||||
cwPsUnwrap(Composite);
|
cwPsUnwrap(Composite);
|
||||||
cwPsUnwrap(Glyphs);
|
|
||||||
cwPsUnwrap(CompositeRects);
|
cwPsUnwrap(CompositeRects);
|
||||||
cwPsUnwrap(Trapezoids);
|
cwPsUnwrap(Trapezoids);
|
||||||
cwPsUnwrap(Triangles);
|
cwPsUnwrap(Triangles);
|
||||||
|
|
|
@ -6,7 +6,6 @@ librender_la_SOURCES = \
|
||||||
animcur.c \
|
animcur.c \
|
||||||
filter.c \
|
filter.c \
|
||||||
glyph.c \
|
glyph.c \
|
||||||
miglyph.c \
|
|
||||||
miindex.c \
|
miindex.c \
|
||||||
mipict.c \
|
mipict.c \
|
||||||
mirect.c \
|
mirect.c \
|
||||||
|
|
213
render/glyph.c
213
render/glyph.c
|
@ -43,6 +43,7 @@
|
||||||
#include "servermd.h"
|
#include "servermd.h"
|
||||||
#include "picturestr.h"
|
#include "picturestr.h"
|
||||||
#include "glyphstr.h"
|
#include "glyphstr.h"
|
||||||
|
#include "mipict.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* From Knuth -- a good choice for hash/rehash values is p, p-2 where
|
* From Knuth -- a good choice for hash/rehash values is p, p-2 where
|
||||||
|
@ -845,3 +846,215 @@ FreeGlyphSet (pointer value,
|
||||||
}
|
}
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
GlyphExtents (int nlist,
|
||||||
|
GlyphListPtr list,
|
||||||
|
GlyphPtr *glyphs,
|
||||||
|
BoxPtr extents)
|
||||||
|
{
|
||||||
|
int x1, x2, y1, y2;
|
||||||
|
int n;
|
||||||
|
GlyphPtr glyph;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
extents->x1 = MAXSHORT;
|
||||||
|
extents->x2 = MINSHORT;
|
||||||
|
extents->y1 = MAXSHORT;
|
||||||
|
extents->y2 = MINSHORT;
|
||||||
|
while (nlist--)
|
||||||
|
{
|
||||||
|
x += list->xOff;
|
||||||
|
y += list->yOff;
|
||||||
|
n = list->len;
|
||||||
|
list++;
|
||||||
|
while (n--)
|
||||||
|
{
|
||||||
|
glyph = *glyphs++;
|
||||||
|
x1 = x - glyph->info.x;
|
||||||
|
if (x1 < MINSHORT)
|
||||||
|
x1 = MINSHORT;
|
||||||
|
y1 = y - glyph->info.y;
|
||||||
|
if (y1 < MINSHORT)
|
||||||
|
y1 = MINSHORT;
|
||||||
|
x2 = x1 + glyph->info.width;
|
||||||
|
if (x2 > MAXSHORT)
|
||||||
|
x2 = MAXSHORT;
|
||||||
|
y2 = y1 + glyph->info.height;
|
||||||
|
if (y2 > MAXSHORT)
|
||||||
|
y2 = MAXSHORT;
|
||||||
|
if (x1 < extents->x1)
|
||||||
|
extents->x1 = x1;
|
||||||
|
if (x2 > extents->x2)
|
||||||
|
extents->x2 = x2;
|
||||||
|
if (y1 < extents->y1)
|
||||||
|
extents->y1 = y1;
|
||||||
|
if (y2 > extents->y2)
|
||||||
|
extents->y2 = y2;
|
||||||
|
x += glyph->info.xOff;
|
||||||
|
y += glyph->info.yOff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
|
||||||
|
|
||||||
|
/* Stub ABI compatibility for mi*Glyph, should go away */
|
||||||
|
_X_EXPORT void
|
||||||
|
miGlyphs (CARD8 op,
|
||||||
|
PicturePtr pSrc,
|
||||||
|
PicturePtr pDst,
|
||||||
|
PictFormatPtr maskFormat,
|
||||||
|
INT16 xSrc,
|
||||||
|
INT16 ySrc,
|
||||||
|
int nlist,
|
||||||
|
GlyphListPtr list,
|
||||||
|
GlyphPtr *glyphs)
|
||||||
|
{
|
||||||
|
CompositeGlyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list,
|
||||||
|
glyphs);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
miRealizeGlyph (ScreenPtr pScreen,
|
||||||
|
GlyphPtr glyph)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
miUnrealizeGlyph (ScreenPtr pScreen,
|
||||||
|
GlyphPtr glyph)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
_X_EXPORT void
|
||||||
|
CompositeGlyphs (CARD8 op,
|
||||||
|
PicturePtr pSrc,
|
||||||
|
PicturePtr pDst,
|
||||||
|
PictFormatPtr maskFormat,
|
||||||
|
INT16 xSrc,
|
||||||
|
INT16 ySrc,
|
||||||
|
int nlist,
|
||||||
|
GlyphListPtr list,
|
||||||
|
GlyphPtr *glyphs)
|
||||||
|
{
|
||||||
|
PicturePtr pPicture;
|
||||||
|
PixmapPtr pMaskPixmap = 0;
|
||||||
|
PicturePtr pMask;
|
||||||
|
ScreenPtr pScreen = pDst->pDrawable->pScreen;
|
||||||
|
int width = 0, height = 0;
|
||||||
|
int x, y;
|
||||||
|
int xDst = list->xOff, yDst = list->yOff;
|
||||||
|
int n;
|
||||||
|
GlyphPtr glyph;
|
||||||
|
int error;
|
||||||
|
BoxRec extents = {0, 0, 0, 0};
|
||||||
|
CARD32 component_alpha;
|
||||||
|
|
||||||
|
ValidatePicture (pSrc);
|
||||||
|
ValidatePicture (pDst);
|
||||||
|
|
||||||
|
if (maskFormat)
|
||||||
|
{
|
||||||
|
GCPtr pGC;
|
||||||
|
xRectangle rect;
|
||||||
|
|
||||||
|
GlyphExtents (nlist, list, glyphs, &extents);
|
||||||
|
|
||||||
|
if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
|
||||||
|
return;
|
||||||
|
width = extents.x2 - extents.x1;
|
||||||
|
height = extents.y2 - extents.y1;
|
||||||
|
pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
|
||||||
|
maskFormat->depth);
|
||||||
|
if (!pMaskPixmap)
|
||||||
|
return;
|
||||||
|
component_alpha = NeedsComponent(maskFormat->format);
|
||||||
|
pMask = CreatePicture (0, &pMaskPixmap->drawable,
|
||||||
|
maskFormat, CPComponentAlpha, &component_alpha,
|
||||||
|
serverClient, &error);
|
||||||
|
if (!pMask)
|
||||||
|
{
|
||||||
|
(*pScreen->DestroyPixmap) (pMaskPixmap);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pGC = GetScratchGC (pMaskPixmap->drawable.depth, pScreen);
|
||||||
|
ValidateGC (&pMaskPixmap->drawable, pGC);
|
||||||
|
rect.x = 0;
|
||||||
|
rect.y = 0;
|
||||||
|
rect.width = width;
|
||||||
|
rect.height = height;
|
||||||
|
(*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect);
|
||||||
|
FreeScratchGC (pGC);
|
||||||
|
x = -extents.x1;
|
||||||
|
y = -extents.y1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pMask = pDst;
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
while (nlist--)
|
||||||
|
{
|
||||||
|
x += list->xOff;
|
||||||
|
y += list->yOff;
|
||||||
|
n = list->len;
|
||||||
|
while (n--)
|
||||||
|
{
|
||||||
|
glyph = *glyphs++;
|
||||||
|
pPicture = GlyphPicture (glyph)[pScreen->myNum];
|
||||||
|
|
||||||
|
if (maskFormat)
|
||||||
|
{
|
||||||
|
CompositePicture (PictOpAdd,
|
||||||
|
pPicture,
|
||||||
|
None,
|
||||||
|
pMask,
|
||||||
|
0, 0,
|
||||||
|
0, 0,
|
||||||
|
x - glyph->info.x,
|
||||||
|
y - glyph->info.y,
|
||||||
|
glyph->info.width,
|
||||||
|
glyph->info.height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CompositePicture (op,
|
||||||
|
pSrc,
|
||||||
|
pPicture,
|
||||||
|
pDst,
|
||||||
|
xSrc + (x - glyph->info.x) - xDst,
|
||||||
|
ySrc + (y - glyph->info.y) - yDst,
|
||||||
|
0, 0,
|
||||||
|
x - glyph->info.x,
|
||||||
|
y - glyph->info.y,
|
||||||
|
glyph->info.width,
|
||||||
|
glyph->info.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
x += glyph->info.xOff;
|
||||||
|
y += glyph->info.yOff;
|
||||||
|
}
|
||||||
|
list++;
|
||||||
|
}
|
||||||
|
if (maskFormat)
|
||||||
|
{
|
||||||
|
x = extents.x1;
|
||||||
|
y = extents.y1;
|
||||||
|
CompositePicture (op,
|
||||||
|
pSrc,
|
||||||
|
pMask,
|
||||||
|
pDst,
|
||||||
|
xSrc + x - xDst,
|
||||||
|
ySrc + y - yDst,
|
||||||
|
0, 0,
|
||||||
|
x, y,
|
||||||
|
width, height);
|
||||||
|
FreePicture ((pointer) pMask, (XID) 0);
|
||||||
|
(*pScreen->DestroyPixmap) (pMaskPixmap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
228
render/miglyph.c
228
render/miglyph.c
|
@ -1,228 +0,0 @@
|
||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright © 2000 SuSE, Inc.
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
* the above copyright notice appear in all copies and that both that
|
|
||||||
* copyright notice and this permission notice appear in supporting
|
|
||||||
* documentation, and that the name of SuSE not be used in advertising or
|
|
||||||
* publicity pertaining to distribution of the software without specific,
|
|
||||||
* written prior permission. SuSE makes no representations about the
|
|
||||||
* suitability of this software for any purpose. It is provided "as is"
|
|
||||||
* without express or implied warranty.
|
|
||||||
*
|
|
||||||
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
|
|
||||||
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
||||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*
|
|
||||||
* Author: Keith Packard, SuSE, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "gcstruct.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "mi.h"
|
|
||||||
#include "picturestr.h"
|
|
||||||
#include "mipict.h"
|
|
||||||
|
|
||||||
Bool
|
|
||||||
miRealizeGlyph (ScreenPtr pScreen,
|
|
||||||
GlyphPtr glyph)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
miUnrealizeGlyph (ScreenPtr pScreen,
|
|
||||||
GlyphPtr glyph)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
miGlyphExtents (int nlist,
|
|
||||||
GlyphListPtr list,
|
|
||||||
GlyphPtr *glyphs,
|
|
||||||
BoxPtr extents)
|
|
||||||
{
|
|
||||||
int x1, x2, y1, y2;
|
|
||||||
int n;
|
|
||||||
GlyphPtr glyph;
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
extents->x1 = MAXSHORT;
|
|
||||||
extents->x2 = MINSHORT;
|
|
||||||
extents->y1 = MAXSHORT;
|
|
||||||
extents->y2 = MINSHORT;
|
|
||||||
while (nlist--)
|
|
||||||
{
|
|
||||||
x += list->xOff;
|
|
||||||
y += list->yOff;
|
|
||||||
n = list->len;
|
|
||||||
list++;
|
|
||||||
while (n--)
|
|
||||||
{
|
|
||||||
glyph = *glyphs++;
|
|
||||||
x1 = x - glyph->info.x;
|
|
||||||
if (x1 < MINSHORT)
|
|
||||||
x1 = MINSHORT;
|
|
||||||
y1 = y - glyph->info.y;
|
|
||||||
if (y1 < MINSHORT)
|
|
||||||
y1 = MINSHORT;
|
|
||||||
x2 = x1 + glyph->info.width;
|
|
||||||
if (x2 > MAXSHORT)
|
|
||||||
x2 = MAXSHORT;
|
|
||||||
y2 = y1 + glyph->info.height;
|
|
||||||
if (y2 > MAXSHORT)
|
|
||||||
y2 = MAXSHORT;
|
|
||||||
if (x1 < extents->x1)
|
|
||||||
extents->x1 = x1;
|
|
||||||
if (x2 > extents->x2)
|
|
||||||
extents->x2 = x2;
|
|
||||||
if (y1 < extents->y1)
|
|
||||||
extents->y1 = y1;
|
|
||||||
if (y2 > extents->y2)
|
|
||||||
extents->y2 = y2;
|
|
||||||
x += glyph->info.xOff;
|
|
||||||
y += glyph->info.yOff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
|
|
||||||
|
|
||||||
_X_EXPORT void
|
|
||||||
miGlyphs (CARD8 op,
|
|
||||||
PicturePtr pSrc,
|
|
||||||
PicturePtr pDst,
|
|
||||||
PictFormatPtr maskFormat,
|
|
||||||
INT16 xSrc,
|
|
||||||
INT16 ySrc,
|
|
||||||
int nlist,
|
|
||||||
GlyphListPtr list,
|
|
||||||
GlyphPtr *glyphs)
|
|
||||||
{
|
|
||||||
PixmapPtr pPixmap;
|
|
||||||
PicturePtr pPicture;
|
|
||||||
PixmapPtr pMaskPixmap = 0;
|
|
||||||
PicturePtr pMask;
|
|
||||||
ScreenPtr pScreen = pDst->pDrawable->pScreen;
|
|
||||||
int width = 0, height = 0;
|
|
||||||
int x, y;
|
|
||||||
int xDst = list->xOff, yDst = list->yOff;
|
|
||||||
int n;
|
|
||||||
GlyphPtr glyph;
|
|
||||||
int error;
|
|
||||||
BoxRec extents;
|
|
||||||
CARD32 component_alpha;
|
|
||||||
|
|
||||||
if (maskFormat)
|
|
||||||
{
|
|
||||||
GCPtr pGC;
|
|
||||||
xRectangle rect;
|
|
||||||
|
|
||||||
miGlyphExtents (nlist, list, glyphs, &extents);
|
|
||||||
|
|
||||||
if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
|
|
||||||
return;
|
|
||||||
width = extents.x2 - extents.x1;
|
|
||||||
height = extents.y2 - extents.y1;
|
|
||||||
pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, maskFormat->depth);
|
|
||||||
if (!pMaskPixmap)
|
|
||||||
return;
|
|
||||||
component_alpha = NeedsComponent(maskFormat->format);
|
|
||||||
pMask = CreatePicture (0, &pMaskPixmap->drawable,
|
|
||||||
maskFormat, CPComponentAlpha, &component_alpha,
|
|
||||||
serverClient, &error);
|
|
||||||
if (!pMask)
|
|
||||||
{
|
|
||||||
(*pScreen->DestroyPixmap) (pMaskPixmap);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pGC = GetScratchGC (pMaskPixmap->drawable.depth, pScreen);
|
|
||||||
ValidateGC (&pMaskPixmap->drawable, pGC);
|
|
||||||
rect.x = 0;
|
|
||||||
rect.y = 0;
|
|
||||||
rect.width = width;
|
|
||||||
rect.height = height;
|
|
||||||
(*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect);
|
|
||||||
FreeScratchGC (pGC);
|
|
||||||
x = -extents.x1;
|
|
||||||
y = -extents.y1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pMask = pDst;
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
}
|
|
||||||
while (nlist--)
|
|
||||||
{
|
|
||||||
x += list->xOff;
|
|
||||||
y += list->yOff;
|
|
||||||
n = list->len;
|
|
||||||
while (n--)
|
|
||||||
{
|
|
||||||
glyph = *glyphs++;
|
|
||||||
pPicture = GlyphPicture (glyph)[pScreen->myNum];
|
|
||||||
|
|
||||||
if (maskFormat)
|
|
||||||
{
|
|
||||||
CompositePicture (PictOpAdd,
|
|
||||||
pPicture,
|
|
||||||
None,
|
|
||||||
pMask,
|
|
||||||
0, 0,
|
|
||||||
0, 0,
|
|
||||||
x - glyph->info.x,
|
|
||||||
y - glyph->info.y,
|
|
||||||
glyph->info.width,
|
|
||||||
glyph->info.height);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CompositePicture (op,
|
|
||||||
pSrc,
|
|
||||||
pPicture,
|
|
||||||
pDst,
|
|
||||||
xSrc + (x - glyph->info.x) - xDst,
|
|
||||||
ySrc + (y - glyph->info.y) - yDst,
|
|
||||||
0, 0,
|
|
||||||
x - glyph->info.x,
|
|
||||||
y - glyph->info.y,
|
|
||||||
glyph->info.width,
|
|
||||||
glyph->info.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
x += glyph->info.xOff;
|
|
||||||
y += glyph->info.yOff;
|
|
||||||
}
|
|
||||||
list++;
|
|
||||||
}
|
|
||||||
if (maskFormat)
|
|
||||||
{
|
|
||||||
x = extents.x1;
|
|
||||||
y = extents.y1;
|
|
||||||
CompositePicture (op,
|
|
||||||
pSrc,
|
|
||||||
pMask,
|
|
||||||
pDst,
|
|
||||||
xSrc + x - xDst,
|
|
||||||
ySrc + y - yDst,
|
|
||||||
0, 0,
|
|
||||||
x, y,
|
|
||||||
width, height);
|
|
||||||
FreePicture ((pointer) pMask, (XID) 0);
|
|
||||||
(*pScreen->DestroyPixmap) (pMaskPixmap);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -636,7 +636,7 @@ miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
||||||
|
|
||||||
/* MI rendering routines */
|
/* MI rendering routines */
|
||||||
ps->Composite = 0; /* requires DDX support */
|
ps->Composite = 0; /* requires DDX support */
|
||||||
ps->Glyphs = miGlyphs;
|
ps->Glyphs = NULL;
|
||||||
ps->CompositeRects = miCompositeRects;
|
ps->CompositeRects = miCompositeRects;
|
||||||
ps->Trapezoids = miTrapezoids;
|
ps->Trapezoids = miTrapezoids;
|
||||||
ps->Triangles = miTriangles;
|
ps->Triangles = miTriangles;
|
||||||
|
|
|
@ -119,12 +119,6 @@ void
|
||||||
miUnrealizeGlyph (ScreenPtr pScreen,
|
miUnrealizeGlyph (ScreenPtr pScreen,
|
||||||
GlyphPtr glyph);
|
GlyphPtr glyph);
|
||||||
|
|
||||||
void
|
|
||||||
miGlyphExtents (int nlist,
|
|
||||||
GlyphListPtr list,
|
|
||||||
GlyphPtr *glyphs,
|
|
||||||
BoxPtr extents);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
miGlyphs (CARD8 op,
|
miGlyphs (CARD8 op,
|
||||||
PicturePtr pSrc,
|
PicturePtr pSrc,
|
||||||
|
|
|
@ -1767,24 +1767,6 @@ CompositePicture (CARD8 op,
|
||||||
height);
|
height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
CompositeGlyphs (CARD8 op,
|
|
||||||
PicturePtr pSrc,
|
|
||||||
PicturePtr pDst,
|
|
||||||
PictFormatPtr maskFormat,
|
|
||||||
INT16 xSrc,
|
|
||||||
INT16 ySrc,
|
|
||||||
int nlist,
|
|
||||||
GlyphListPtr lists,
|
|
||||||
GlyphPtr *glyphs)
|
|
||||||
{
|
|
||||||
PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen);
|
|
||||||
|
|
||||||
ValidatePicture (pSrc);
|
|
||||||
ValidatePicture (pDst);
|
|
||||||
(*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, lists, glyphs);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CompositeRects (CARD8 op,
|
CompositeRects (CARD8 op,
|
||||||
PicturePtr pDst,
|
PicturePtr pDst,
|
||||||
|
|
|
@ -345,7 +345,7 @@ typedef struct _PictureScreen {
|
||||||
ValidatePictureProcPtr ValidatePicture;
|
ValidatePictureProcPtr ValidatePicture;
|
||||||
|
|
||||||
CompositeProcPtr Composite;
|
CompositeProcPtr Composite;
|
||||||
GlyphsProcPtr Glyphs;
|
GlyphsProcPtr Glyphs; /* unused */
|
||||||
CompositeRectsProcPtr CompositeRects;
|
CompositeRectsProcPtr CompositeRects;
|
||||||
|
|
||||||
DestroyWindowProcPtr DestroyWindow;
|
DestroyWindowProcPtr DestroyWindow;
|
||||||
|
|
Loading…
Reference in New Issue