From 3475655620bc51071f0ba9cbc30b39587d9b0b44 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Sequoia Date: Sat, 31 May 2014 13:14:20 -0700 Subject: [PATCH 5005/5005] fb: Revert fb changes that broke XQuartz http://bugs.freedesktop.org/show_bug.cgi?id=26124 Revert "Use new pixman_glyph_cache_t API that will be in pixman 0.28.0" Revert "fb: Fix origin of source picture in fbGlyphs" Revert "fb: Publish fbGlyphs and fbUnrealizeGlyph" This reverts commit 9cbcb5bd6a5360a128d15b77a02d8d3351f74366. This reverts commit 983e30361f49a67252d0b5d82630e70724d69dbf. This reverts commit 3c2c59eed3c68c0e5a93c38cf01eedad015e3157. --- fb/fb.h | 3 -- fb/fbpict.c | 149 +--------------------------------------------------------- fb/fbpict.h | 11 +---- fb/fbscreen.c | 1 - 4 files changed, 2 insertions(+), 162 deletions(-) diff --git a/fb/fb.h b/fb/fb.h index 256a1ee..8e87498 100644 --- a/fb/fb.h +++ b/fb/fb.h @@ -1111,9 +1111,6 @@ extern _X_EXPORT void extern _X_EXPORT Bool fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats); -extern _X_EXPORT void -fbDestroyGlyphCache(void); - /* * fbpixmap.c */ diff --git a/fb/fbpict.c b/fb/fbpict.c index be8274b..66dd633 100644 --- a/fb/fbpict.c +++ b/fb/fbpict.c @@ -65,152 +65,6 @@ fbComposite(CARD8 op, free_pixman_pict(pDst, dest); } -static pixman_glyph_cache_t *glyphCache; - -void -fbDestroyGlyphCache(void) -{ - if (glyphCache) - { - pixman_glyph_cache_destroy (glyphCache); - glyphCache = NULL; - } -} - -static void -fbUnrealizeGlyph(ScreenPtr pScreen, - GlyphPtr pGlyph) -{ - if (glyphCache) - pixman_glyph_cache_remove (glyphCache, pGlyph, NULL); -} - -void -fbGlyphs(CARD8 op, - PicturePtr pSrc, - PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, - INT16 ySrc, int nlist, - GlyphListPtr list, - GlyphPtr *glyphs) -{ -#define N_STACK_GLYPHS 512 - ScreenPtr pScreen = pDst->pDrawable->pScreen; - pixman_glyph_t stack_glyphs[N_STACK_GLYPHS]; - pixman_glyph_t *pglyphs = stack_glyphs; - pixman_image_t *srcImage, *dstImage; - int srcXoff, srcYoff, dstXoff, dstYoff; - GlyphPtr glyph; - int n_glyphs; - int x, y; - int i, n; - int xDst = list->xOff, yDst = list->yOff; - - miCompositeSourceValidate(pSrc); - - n_glyphs = 0; - for (i = 0; i < nlist; ++i) - n_glyphs += list[i].len; - - if (!glyphCache) - glyphCache = pixman_glyph_cache_create(); - - pixman_glyph_cache_freeze (glyphCache); - - if (n_glyphs > N_STACK_GLYPHS) { - if (!(pglyphs = xallocarray(n_glyphs, sizeof(pixman_glyph_t)))) - goto out; - } - - i = 0; - x = y = 0; - while (nlist--) { - x += list->xOff; - y += list->yOff; - n = list->len; - while (n--) { - const void *g; - - glyph = *glyphs++; - - if (!(g = pixman_glyph_cache_lookup (glyphCache, glyph, NULL))) { - pixman_image_t *glyphImage; - PicturePtr pPicture; - int xoff, yoff; - - pPicture = GetGlyphPicture(glyph, pScreen); - if (!pPicture) { - n_glyphs--; - goto next; - } - - if (!(glyphImage = image_from_pict(pPicture, FALSE, &xoff, &yoff))) - goto out; - - g = pixman_glyph_cache_insert(glyphCache, glyph, NULL, - glyph->info.x, - glyph->info.y, - glyphImage); - - free_pixman_pict(pPicture, glyphImage); - - if (!g) - goto out; - } - - pglyphs[i].x = x; - pglyphs[i].y = y; - pglyphs[i].glyph = g; - i++; - - next: - x += glyph->info.xOff; - y += glyph->info.yOff; - } - list++; - } - - if (!(srcImage = image_from_pict(pSrc, FALSE, &srcXoff, &srcYoff))) - goto out; - - if (!(dstImage = image_from_pict(pDst, TRUE, &dstXoff, &dstYoff))) - goto out_free_src; - - if (maskFormat) { - pixman_format_code_t format; - pixman_box32_t extents; - - format = maskFormat->format | (maskFormat->depth << 24); - - pixman_glyph_get_extents(glyphCache, n_glyphs, pglyphs, &extents); - - pixman_composite_glyphs(op, srcImage, dstImage, format, - xSrc + srcXoff + extents.x1 - xDst, ySrc + srcYoff + extents.y1 - yDst, - extents.x1, extents.y1, - extents.x1 + dstXoff, extents.y1 + dstYoff, - extents.x2 - extents.x1, - extents.y2 - extents.y1, - glyphCache, n_glyphs, pglyphs); - } - else { - pixman_composite_glyphs_no_mask(op, srcImage, dstImage, - xSrc + srcXoff - xDst, ySrc + srcYoff - yDst, - dstXoff, dstYoff, - glyphCache, n_glyphs, pglyphs); - } - - free_pixman_pict(pDst, dstImage); - -out_free_src: - free_pixman_pict(pSrc, srcImage); - -out: - pixman_glyph_cache_thaw(glyphCache); - if (pglyphs != stack_glyphs) - free(pglyphs); -} - static pixman_image_t * create_solid_fill_image(PicturePtr pict) { @@ -470,8 +324,7 @@ fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) return FALSE; ps = GetPictureScreen(pScreen); ps->Composite = fbComposite; - ps->Glyphs = fbGlyphs; - ps->UnrealizeGlyph = fbUnrealizeGlyph; + ps->Glyphs = miGlyphs; ps->CompositeRects = miCompositeRects; ps->RasterizeTrapezoid = fbRasterizeTrapezoid; ps->AddTraps = fbAddTraps; diff --git a/fb/fbpict.h b/fb/fbpict.h index 5cb8663..110f32d 100644 --- a/fb/fbpict.h +++ b/fb/fbpict.h @@ -65,20 +65,11 @@ fbTrapezoids(CARD8 op, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps); extern _X_EXPORT void + fbTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris); -extern _X_EXPORT void -fbGlyphs(CARD8 op, - PicturePtr pSrc, - PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, - INT16 ySrc, int nlist, - GlyphListPtr list, - GlyphPtr *glyphs); - #endif /* _FBPICT_H_ */ diff --git a/fb/fbscreen.c b/fb/fbscreen.c index 71bcc5d..55330fc 100644 --- a/fb/fbscreen.c +++ b/fb/fbscreen.c @@ -32,7 +32,6 @@ fbCloseScreen(ScreenPtr pScreen) int d; DepthPtr depths = pScreen->allowedDepths; - fbDestroyGlyphCache(); for (d = 0; d < pScreen->numDepths; d++) free(depths[d].vids); free(depths); -- 2.8.1