render: set the glyph picture to NULL by default.

In a follow-up patch we may have glyphs with a NULL picture. To cope with
that, always set the pictures for glyphs to NULL at creation time and cope
with cleaning up such glyphs. Also, since compositing a NULL source doesn't
do a lot anyway, skip trying to do so.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Peter Hutterer 2009-10-01 15:22:19 +10:00
parent b5fcc5553e
commit 758ab55d2d

View File

@ -282,7 +282,8 @@ FreeGlyphPicture(GlyphPtr glyph)
{ {
ScreenPtr pScreen = screenInfo.screens[i]; ScreenPtr pScreen = screenInfo.screens[i];
FreePicture ((pointer) GlyphPicture (glyph)[i], 0); if (GlyphPicture(glyph)[i])
FreePicture ((pointer) GlyphPicture (glyph)[i], 0);
ps = GetPictureScreenIfSet (pScreen); ps = GetPictureScreenIfSet (pScreen);
if (ps) if (ps)
@ -414,6 +415,7 @@ AllocateGlyph (xGlyphInfo *gi, int fdepth)
for (i = 0; i < screenInfo.numScreens; i++) for (i = 0; i < screenInfo.numScreens; i++)
{ {
GlyphPicture(glyph)[i] = NULL;
ps = GetPictureScreenIfSet (screenInfo.screens[i]); ps = GetPictureScreenIfSet (screenInfo.screens[i]);
if (ps) if (ps)
@ -721,32 +723,35 @@ miGlyphs (CARD8 op,
glyph = *glyphs++; glyph = *glyphs++;
pPicture = GlyphPicture (glyph)[pScreen->myNum]; pPicture = GlyphPicture (glyph)[pScreen->myNum];
if (maskFormat) if (pPicture)
{ {
CompositePicture (PictOpAdd, if (maskFormat)
pPicture, {
None, CompositePicture (PictOpAdd,
pMask, pPicture,
0, 0, None,
0, 0, pMask,
x - glyph->info.x, 0, 0,
y - glyph->info.y, 0, 0,
glyph->info.width, x - glyph->info.x,
glyph->info.height); y - glyph->info.y,
} glyph->info.width,
else glyph->info.height);
{ }
CompositePicture (op, else
pSrc, {
pPicture, CompositePicture (op,
pDst, pSrc,
xSrc + (x - glyph->info.x) - xDst, pPicture,
ySrc + (y - glyph->info.y) - yDst, pDst,
0, 0, xSrc + (x - glyph->info.x) - xDst,
x - glyph->info.x, ySrc + (y - glyph->info.y) - yDst,
y - glyph->info.y, 0, 0,
glyph->info.width, x - glyph->info.x,
glyph->info.height); y - glyph->info.y,
glyph->info.width,
glyph->info.height);
}
} }
x += glyph->info.xOff; x += glyph->info.xOff;