Commit e0150c35 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

winex11.drv: Use XRenderCompositeText instead of XRenderCompositeString.

parent 4edc46cb
...@@ -118,6 +118,7 @@ MAKE_FUNCPTR(XRenderComposite) ...@@ -118,6 +118,7 @@ MAKE_FUNCPTR(XRenderComposite)
MAKE_FUNCPTR(XRenderCompositeString8) MAKE_FUNCPTR(XRenderCompositeString8)
MAKE_FUNCPTR(XRenderCompositeString16) MAKE_FUNCPTR(XRenderCompositeString16)
MAKE_FUNCPTR(XRenderCompositeString32) MAKE_FUNCPTR(XRenderCompositeString32)
MAKE_FUNCPTR(XRenderCompositeText16)
MAKE_FUNCPTR(XRenderCreateGlyphSet) MAKE_FUNCPTR(XRenderCreateGlyphSet)
MAKE_FUNCPTR(XRenderCreatePicture) MAKE_FUNCPTR(XRenderCreatePicture)
MAKE_FUNCPTR(XRenderFillRectangle) MAKE_FUNCPTR(XRenderFillRectangle)
...@@ -181,6 +182,7 @@ LOAD_FUNCPTR(XRenderComposite) ...@@ -181,6 +182,7 @@ LOAD_FUNCPTR(XRenderComposite)
LOAD_FUNCPTR(XRenderCompositeString8) LOAD_FUNCPTR(XRenderCompositeString8)
LOAD_FUNCPTR(XRenderCompositeString16) LOAD_FUNCPTR(XRenderCompositeString16)
LOAD_FUNCPTR(XRenderCompositeString32) LOAD_FUNCPTR(XRenderCompositeString32)
LOAD_FUNCPTR(XRenderCompositeText16)
LOAD_FUNCPTR(XRenderCreateGlyphSet) LOAD_FUNCPTR(XRenderCreateGlyphSet)
LOAD_FUNCPTR(XRenderCreatePicture) LOAD_FUNCPTR(XRenderCreatePicture)
LOAD_FUNCPTR(XRenderFillRectangle) LOAD_FUNCPTR(XRenderFillRectangle)
...@@ -346,9 +348,9 @@ static void FreeEntry(int entry) ...@@ -346,9 +348,9 @@ static void FreeEntry(int entry)
HeapFree(GetProcessHeap(), 0, formatEntry->bitmaps[i]); HeapFree(GetProcessHeap(), 0, formatEntry->bitmaps[i]);
HeapFree(GetProcessHeap(), 0, formatEntry->bitmaps); HeapFree(GetProcessHeap(), 0, formatEntry->bitmaps);
formatEntry->bitmaps = NULL; formatEntry->bitmaps = NULL;
}
HeapFree(GetProcessHeap(), 0, formatEntry->gis); HeapFree(GetProcessHeap(), 0, formatEntry->gis);
formatEntry->gis = NULL; formatEntry->gis = NULL;
}
formatEntry->nrealized = 0; formatEntry->nrealized = 0;
} }
...@@ -694,7 +696,7 @@ static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph, AA_Type format) ...@@ -694,7 +696,7 @@ static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph, AA_Type format)
formatEntry->bitmaps = HeapAlloc(GetProcessHeap(), formatEntry->bitmaps = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
formatEntry->nrealized * sizeof(formatEntry->bitmaps[0])); formatEntry->nrealized * sizeof(formatEntry->bitmaps[0]));
}
if (formatEntry->gis) if (formatEntry->gis)
formatEntry->gis = HeapReAlloc(GetProcessHeap(), formatEntry->gis = HeapReAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
...@@ -705,7 +707,6 @@ static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph, AA_Type format) ...@@ -705,7 +707,6 @@ static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph, AA_Type format)
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
formatEntry->nrealized * sizeof(formatEntry->gis[0])); formatEntry->nrealized * sizeof(formatEntry->gis[0]));
} }
}
if(formatEntry->glyphset == 0 && X11DRV_XRender_Installed) { if(formatEntry->glyphset == 0 && X11DRV_XRender_Installed) {
...@@ -790,6 +791,8 @@ static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph, AA_Type format) ...@@ -790,6 +791,8 @@ static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph, AA_Type format)
} }
} }
memcpy(&formatEntry->gis[glyph], &gi, sizeof(gi));
if(formatEntry->glyphset) { if(formatEntry->glyphset) {
if(format == AA_None && BitmapBitOrder(gdi_display) != MSBFirst) { if(format == AA_None && BitmapBitOrder(gdi_display) != MSBFirst) {
unsigned char *byte = (unsigned char*) buf, c; unsigned char *byte = (unsigned char*) buf, c;
...@@ -814,7 +817,6 @@ static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph, AA_Type format) ...@@ -814,7 +817,6 @@ static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph, AA_Type format)
HeapFree(GetProcessHeap(), 0, buf); HeapFree(GetProcessHeap(), 0, buf);
} else { } else {
formatEntry->bitmaps[glyph] = buf; formatEntry->bitmaps[glyph] = buf;
memcpy(&formatEntry->gis[glyph], &gi, sizeof(gi));
} }
return TRUE; return TRUE;
} }
...@@ -1270,32 +1272,51 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag ...@@ -1270,32 +1272,51 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
TRACE("Writing %s at %d,%d\n", debugstr_wn(wstr,count), TRACE("Writing %s at %d,%d\n", debugstr_wn(wstr,count),
physDev->dc_rect.left + x, physDev->dc_rect.top + y); physDev->dc_rect.left + x, physDev->dc_rect.top + y);
if(X11DRV_XRender_Installed) { if(X11DRV_XRender_Installed)
wine_tsx11_lock(); {
XGlyphElt16 *elts = HeapAlloc(GetProcessHeap(), 0, sizeof(XGlyphElt16) * count);
INT offset = 0;
POINT desired, current;
/* There's a bug in XRenderCompositeText that ignores the xDst and yDst parameters.
So we pass zeros to the function and move to our starting position using the first
element of the elts array. */
desired.x = physDev->dc_rect.left + x;
desired.y = physDev->dc_rect.top + y;
current.x = current.y = 0;
for(idx = 0; idx < count; idx++)
{
elts[idx].glyphset = formatEntry->glyphset;
elts[idx].chars = wstr + idx;
elts[idx].nchars = 1;
elts[idx].xOff = desired.x - current.x;
elts[idx].yOff = desired.y - current.y;
current.x += (elts[idx].xOff + formatEntry->gis[wstr[idx]].xOff);
current.y += (elts[idx].yOff + formatEntry->gis[wstr[idx]].yOff);
if(!lpDx) if(!lpDx)
pXRenderCompositeString16(gdi_display, render_op, {
physDev->xrender->tile_pict, desired.x += formatEntry->gis[wstr[idx]].xOff;
physDev->xrender->pict, desired.y += formatEntry->gis[wstr[idx]].yOff;
formatEntry->font_format, formatEntry->glyphset, }
0, 0, physDev->dc_rect.left + x, physDev->dc_rect.top + y, else
wstr, count); {
else {
INT offset = 0, xoff = 0, yoff = 0;
for(idx = 0; idx < count; idx++) {
pXRenderCompositeString16(gdi_display, render_op,
physDev->xrender->tile_pict,
physDev->xrender->pict,
formatEntry->font_format, formatEntry->glyphset,
0, 0, physDev->dc_rect.left + x + xoff,
physDev->dc_rect.top + y + yoff,
wstr + idx, 1);
offset += lpDx[idx]; offset += lpDx[idx];
xoff = offset * cosEsc; desired.x = physDev->dc_rect.left + x + offset * cosEsc;
yoff = offset * -sinEsc; desired.y = physDev->dc_rect.top + y - offset * sinEsc;
} }
} }
wine_tsx11_lock();
pXRenderCompositeText16(gdi_display, render_op,
physDev->xrender->tile_pict,
physDev->xrender->pict,
formatEntry->font_format,
0, 0, 0, 0, elts, count);
wine_tsx11_unlock(); wine_tsx11_unlock();
HeapFree(GetProcessHeap(), 0, elts);
} else { } else {
INT offset = 0, xoff = 0, yoff = 0; INT offset = 0, xoff = 0, yoff = 0;
wine_tsx11_lock(); wine_tsx11_lock();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment