summaryrefslogtreecommitdiff
path: root/render/render.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2007-08-01 15:48:30 -0700
committerCarl Worth <cworth@cworth.org>2007-08-02 22:49:56 -0700
commita2af34d5a861982a03afad8e586bb0181b72bbd0 (patch)
tree0e423afde57f7d875c8a08f134bf1eb7e07276c0 /render/render.c
parent19b3b1fd8feb343a690331cafe88ef10b34b9d98 (diff)
Use per-screen Pixmaps for glyphs
Instead of system-memory data which prevents accelerated compositing of glyphs, (at least without forcing an upload of the glyph data before compositing).
Diffstat (limited to 'render/render.c')
-rw-r--r--render/render.c67
1 files changed, 65 insertions, 2 deletions
diff --git a/render/render.c b/render/render.c
index c7a6dcb44..4bad379f6 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1099,7 +1099,9 @@ ProcRenderAddGlyphs (ClientPtr client)
CARD8 *bits;
int size;
int err = BadAlloc;
- int i;
+ int i, screen;
+ PicturePtr pSrc = NULL, pDst = NULL;
+ PixmapPtr pSrcPix = NULL, pDstPix = NULL;
REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq);
glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client,
@@ -1164,7 +1166,62 @@ ProcRenderAddGlyphs (ClientPtr client)
goto bail;
}
- memcpy ((CARD8 *) (glyph_new->glyph + 1), bits, size);
+ for (screen = 0; screen < screenInfo.numScreens; screen++)
+ {
+ int width = gi[i].width;
+ int height = gi[i].height;
+ int depth = glyphSet->format->depth;
+ ScreenPtr pScreen;
+ int error;
+
+ pScreen = screenInfo.screens[screen];
+ pSrcPix = GetScratchPixmapHeader (pScreen,
+ width, height,
+ depth, depth,
+ -1, bits);
+ if (! pSrcPix)
+ {
+ err = BadAlloc;
+ goto bail;
+ }
+
+ pSrc = CreatePicture (0, &pSrcPix->drawable,
+ glyphSet->format, 0, NULL,
+ serverClient, &error);
+ if (! pSrc)
+ {
+ err = BadAlloc;
+ goto bail;
+ }
+
+ pDstPix = GlyphPixmap (glyph_new->glyph)[screen];
+
+ pDst = CreatePicture (0, &pDstPix->drawable,
+ glyphSet->format, 0, NULL,
+ serverClient, &error);
+ if (! pDst)
+ {
+ err = BadAlloc;
+ goto bail;
+ }
+
+ CompositePicture (PictOpSrc,
+ pSrc,
+ None,
+ pDst,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ width, height);
+
+ FreePicture ((pointer) pSrc, 0);
+ pSrc = NULL;
+ FreePicture ((pointer) pDst, 0);
+ pDst = NULL;
+ FreeScratchPixmapHeader (pSrcPix);
+ pSrcPix = NULL;
+ }
+
memcpy (glyph_new->glyph->sha1, glyph_new->sha1, 20);
}
@@ -1192,6 +1249,12 @@ ProcRenderAddGlyphs (ClientPtr client)
Xfree (glyphsBase);
return client->noClientException;
bail:
+ if (pSrc)
+ FreePicture ((pointer) pSrc, 0);
+ if (pDst)
+ FreePicture ((pointer) pDst, 0);
+ if (pSrcPix)
+ FreeScratchPixmapHeader (pSrcPix);
for (i = 0; i < nglyphs; i++)
if (glyphs[i].glyph && ! glyphs[i].found)
xfree (glyphs[i].glyph);