xrender: don't allocate a glyphset too early
Huw D M Davies
h.davies1 at physics.ox.ac.uk
Mon Jun 14 14:53:58 CDT 2004
This will be necessary for the upcoming bitmap font support...
Huw Davies <huw at codeweavers.com>
Don't allocate a glyphset until we actually need it.
Index: dlls/x11drv/xrender.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/xrender.c,v
retrieving revision 1.39
diff -u -r1.39 xrender.c
--- dlls/x11drv/xrender.c 27 May 2004 02:20:50 -0000 1.39
+++ dlls/x11drv/xrender.c 14 Jun 2004 19:28:11 -0000
@@ -364,7 +364,6 @@
static int GetCacheEntry(LFANDSIZE *plfsz)
{
- XRenderPictFormat pf;
int ret;
gsCacheEntry *entry;
@@ -380,35 +379,8 @@
else
entry->aa = AA_None;
- if(X11DRV_XRender_Installed) {
- switch(entry->aa) {
- case AA_Grey:
- pf.depth = 8;
- pf.direct.alphaMask = 0xff;
- break;
-
- default:
- ERR("aa = %d - not implemented\n", entry->aa);
- case AA_None:
- pf.depth = 1;
- pf.direct.alphaMask = 1;
- break;
- }
-
- pf.type = PictTypeDirect;
- pf.direct.alpha = 0;
-
- wine_tsx11_lock();
- entry->font_format = pXRenderFindFormat(gdi_display,
- PictFormatType |
- PictFormatDepth |
- PictFormatAlpha |
- PictFormatAlphaMask,
- &pf, 0);
-
- entry->glyphset = pXRenderCreateGlyphSet(gdi_display, entry->font_format);
- wine_tsx11_unlock();
- }
+ entry->font_format = NULL;
+ entry->glyphset = 0;
return ret;
}
@@ -544,6 +516,7 @@
XGlyphInfo gi;
gsCacheEntry *entry = glyphsetCache + physDev->xrender->cache_index;
UINT ggo_format = GGO_GLYPH_INDEX;
+ XRenderPictFormat pf;
if(entry->nrealized <= glyph) {
entry->nrealized = (glyph / 128 + 1) * 128;
@@ -558,7 +531,7 @@
HEAP_ZERO_MEMORY,
entry->nrealized * sizeof(BOOL));
- if(entry->glyphset == 0) {
+ if(!X11DRV_XRender_Installed) {
if (entry->bitmaps)
entry->bitmaps = HeapReAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
@@ -596,14 +569,54 @@
buflen = GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, 0, NULL,
NULL);
if(buflen == GDI_ERROR) {
- LeaveCriticalSection(&xrender_cs);
- return FALSE;
+ if(entry->aa != AA_None) {
+ entry->aa = AA_None;
+ ggo_format &= ~WINE_GGO_GRAY16_BITMAP;
+ ggo_format |= GGO_BITMAP;
+ buflen = GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, 0, NULL,
+ NULL);
+ }
+ if(buflen == GDI_ERROR) {
+ LeaveCriticalSection(&xrender_cs);
+ return FALSE;
+ }
+ TRACE("Turning off antialiasing for this monochrome font\n");
+ }
+
+ if(entry->glyphset == 0 && X11DRV_XRender_Installed) {
+ switch(entry->aa) {
+ case AA_Grey:
+ pf.depth = 8;
+ pf.direct.alphaMask = 0xff;
+ break;
+
+ default:
+ ERR("aa = %d - not implemented\n", entry->aa);
+ case AA_None:
+ pf.depth = 1;
+ pf.direct.alphaMask = 1;
+ break;
+ }
+
+ pf.type = PictTypeDirect;
+ pf.direct.alpha = 0;
+
+ wine_tsx11_lock();
+ entry->font_format = pXRenderFindFormat(gdi_display,
+ PictFormatType |
+ PictFormatDepth |
+ PictFormatAlpha |
+ PictFormatAlphaMask,
+ &pf, 0);
+
+ entry->glyphset = pXRenderCreateGlyphSet(gdi_display, entry->font_format);
+ wine_tsx11_unlock();
}
- entry->realized[glyph] = TRUE;
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen);
GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, buflen, buf, NULL);
+ entry->realized[glyph] = TRUE;
TRACE("buflen = %d. Got metrics: %dx%d adv=%d,%d origin=%ld,%ld\n",
buflen,
More information about the wine-patches
mailing list