diff options
author | Carl Worth <cworth@cworth.org> | 2007-08-01 15:48:30 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2007-08-02 22:49:56 -0700 |
commit | a2af34d5a861982a03afad8e586bb0181b72bbd0 (patch) | |
tree | 0e423afde57f7d875c8a08f134bf1eb7e07276c0 /render/glyph.c | |
parent | 19b3b1fd8feb343a690331cafe88ef10b34b9d98 (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/glyph.c')
-rw-r--r-- | render/glyph.c | 55 |
1 files changed, 35 insertions, 20 deletions
diff --git a/render/glyph.c b/render/glyph.c index 7dbdda2d9..7fd3705df 100644 --- a/render/glyph.c +++ b/render/glyph.c @@ -571,9 +571,13 @@ FreeGlyph (GlyphPtr glyph, int format) for (i = 0; i < screenInfo.numScreens; i++) { - ps = GetPictureScreenIfSet (screenInfo.screens[i]); + ScreenPtr pScreen = screenInfo.screens[i]; + + (pScreen->DestroyPixmap) (GlyphPixmap (glyph)[i]); + + ps = GetPictureScreenIfSet (pScreen); if (ps) - (*ps->UnrealizeGlyph) (screenInfo.screens[i], glyph); + (*ps->UnrealizeGlyph) (pScreen, glyph); } if (glyph->devPrivates) @@ -665,7 +669,7 @@ AllocateGlyph (xGlyphInfo *gi, int fdepth) GlyphPtr glyph; int i; - size = gi->height * PixmapBytePad (gi->width, glyphDepths[fdepth]); + size = screenInfo.numScreens * sizeof (PixmapPtr); glyph = (GlyphPtr) xalloc (size + sizeof (GlyphRec)); if (!glyph) return 0; @@ -685,27 +689,38 @@ AllocateGlyph (xGlyphInfo *gi, int fdepth) for (i = 0; i < screenInfo.numScreens; i++) { - ps = GetPictureScreenIfSet (screenInfo.screens[i]); - if (ps) - { - if (!(*ps->RealizeGlyph) (screenInfo.screens[i], glyph)) - { - while (i--) - { - ps = GetPictureScreenIfSet (screenInfo.screens[i]); - if (ps) - (*ps->UnrealizeGlyph) (screenInfo.screens[i], glyph); - } - - if (glyph->devPrivates) - xfree (glyph->devPrivates); - xfree (glyph); - return 0; - } + ScreenPtr pScreen = screenInfo.screens[i]; + + GlyphPixmap (glyph)[i] = (pScreen->CreatePixmap) (pScreen, + gi->width, gi->height, + glyphDepths[fdepth]); + if (! GlyphPixmap (glyph)[i]) + goto bail; + + ps = GetPictureScreenIfSet (pScreen); + if (! ps) + continue; + + if (!(*ps->RealizeGlyph) (pScreen, glyph)) { + (pScreen->DestroyPixmap) (GlyphPixmap (glyph)[i]); + goto bail; } } return glyph; + +bail: + while (i--) + { + ps = GetPictureScreenIfSet (screenInfo.screens[i]); + if (ps) + (*ps->UnrealizeGlyph) (screenInfo.screens[i], glyph); + } + + if (glyph->devPrivates) + xfree (glyph->devPrivates); + xfree (glyph); + return 0; } Bool |