2 * Functions to use the XRender extension
4 * Copyright 2001, 2002 Huw D M Davies for CodeWeavers
7 * Copyright 2000 Keith Packard, member of The XFree86 Project, Inc.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/port.h"
36 #include "wine/library.h"
37 #include "wine/unicode.h"
38 #include "wine/debug.h"
40 static BOOL X11DRV_XRender_Installed = FALSE;
41 int using_client_side_fonts = FALSE;
43 WINE_DEFAULT_DEBUG_CHANNEL(xrender);
45 #ifdef HAVE_X11_EXTENSIONS_XRENDER_H
48 #include <X11/extensions/Xrender.h>
50 static XRenderPictFormat *screen_format; /* format of screen */
51 static XRenderPictFormat *mono_format; /* format of mono bitmap */
56 SIZE devsize; /* size in device coords */
60 #define INITIAL_REALIZED_BUF_SIZE 128
62 typedef enum { AA_None = 0, AA_Grey, AA_RGB, AA_BGR, AA_VRGB, AA_VBGR, AA_MAXVALUE } AA_Type;
67 XRenderPictFormat *font_format;
78 gsCacheEntryFormat * format[AA_MAXVALUE];
89 COLORREF lastTextColor;
93 static gsCacheEntry *glyphsetCache = NULL;
94 static DWORD glyphsetCacheSize = 0;
95 static INT lastfree = -1;
98 #define INIT_CACHE_SIZE 10
100 static int antialias = 1;
102 /* some default values just in case */
103 #ifndef SONAME_LIBX11
104 #define SONAME_LIBX11 "libX11.so"
106 #ifndef SONAME_LIBXEXT
107 #define SONAME_LIBXEXT "libXext.so"
109 #ifndef SONAME_LIBXRENDER
110 #define SONAME_LIBXRENDER "libXrender.so"
113 static void *xrender_handle;
115 #define MAKE_FUNCPTR(f) static typeof(f) * p##f;
116 MAKE_FUNCPTR(XRenderAddGlyphs)
117 MAKE_FUNCPTR(XRenderComposite)
118 MAKE_FUNCPTR(XRenderCompositeString8)
119 MAKE_FUNCPTR(XRenderCompositeString16)
120 MAKE_FUNCPTR(XRenderCompositeString32)
121 MAKE_FUNCPTR(XRenderCreateGlyphSet)
122 MAKE_FUNCPTR(XRenderCreatePicture)
123 MAKE_FUNCPTR(XRenderFillRectangle)
124 MAKE_FUNCPTR(XRenderFindFormat)
125 MAKE_FUNCPTR(XRenderFindVisualFormat)
126 MAKE_FUNCPTR(XRenderFreeGlyphSet)
127 MAKE_FUNCPTR(XRenderFreePicture)
128 MAKE_FUNCPTR(XRenderSetPictureClipRectangles)
129 #ifdef HAVE_XRENDERSETPICTURETRANSFORM
130 MAKE_FUNCPTR(XRenderSetPictureTransform)
132 MAKE_FUNCPTR(XRenderQueryExtension)
135 static CRITICAL_SECTION xrender_cs;
136 static CRITICAL_SECTION_DEBUG critsect_debug =
139 { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
140 0, 0, { (DWORD_PTR)(__FILE__ ": xrender_cs") }
142 static CRITICAL_SECTION xrender_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
144 #define MS_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
145 ( ( (ULONG)_x4 << 24 ) | \
146 ( (ULONG)_x3 << 16 ) | \
147 ( (ULONG)_x2 << 8 ) | \
150 #define MS_GASP_TAG MS_MAKE_TAG('g', 'a', 's', 'p')
152 #define GASP_GRIDFIT 0x01
153 #define GASP_DOGRAY 0x02
155 #ifdef WORDS_BIGENDIAN
156 #define get_be_word(x) (x)
158 #define get_be_word(x) RtlUshortByteSwap(x)
161 /***********************************************************************
162 * X11DRV_XRender_Init
164 * Let's see if our XServer has the extension available
167 void X11DRV_XRender_Init(void)
170 XRenderPictFormat pf;
172 if (client_side_with_render &&
173 wine_dlopen(SONAME_LIBX11, RTLD_NOW|RTLD_GLOBAL, NULL, 0) &&
174 wine_dlopen(SONAME_LIBXEXT, RTLD_NOW|RTLD_GLOBAL, NULL, 0) &&
175 (xrender_handle = wine_dlopen(SONAME_LIBXRENDER, RTLD_NOW, NULL, 0)))
178 #define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(xrender_handle, #f, NULL, 0)) == NULL) goto sym_not_found;
179 LOAD_FUNCPTR(XRenderAddGlyphs)
180 LOAD_FUNCPTR(XRenderComposite)
181 LOAD_FUNCPTR(XRenderCompositeString8)
182 LOAD_FUNCPTR(XRenderCompositeString16)
183 LOAD_FUNCPTR(XRenderCompositeString32)
184 LOAD_FUNCPTR(XRenderCreateGlyphSet)
185 LOAD_FUNCPTR(XRenderCreatePicture)
186 LOAD_FUNCPTR(XRenderFillRectangle)
187 LOAD_FUNCPTR(XRenderFindFormat)
188 LOAD_FUNCPTR(XRenderFindVisualFormat)
189 LOAD_FUNCPTR(XRenderFreeGlyphSet)
190 LOAD_FUNCPTR(XRenderFreePicture)
191 LOAD_FUNCPTR(XRenderSetPictureClipRectangles)
192 LOAD_FUNCPTR(XRenderQueryExtension)
194 #ifdef HAVE_XRENDERSETPICTURETRANSFORM
195 #define LOAD_OPTIONAL_FUNCPTR(f) p##f = wine_dlsym(xrender_handle, #f, NULL, 0);
196 LOAD_OPTIONAL_FUNCPTR(XRenderSetPictureTransform)
197 #undef LOAD_OPTIONAL_FUNCPTR
202 if(pXRenderQueryExtension(gdi_display, &event_base, &xrender_error_base)) {
203 X11DRV_XRender_Installed = TRUE;
204 TRACE("Xrender is up and running error_base = %d\n", xrender_error_base);
205 screen_format = pXRenderFindVisualFormat(gdi_display, visual);
208 /* Xrender doesn't like DirectColor visuals, try to find a TrueColor one instead */
209 if (visual->class == DirectColor)
212 if (XMatchVisualInfo( gdi_display, DefaultScreen(gdi_display),
213 screen_depth, TrueColor, &info ))
215 screen_format = pXRenderFindVisualFormat(gdi_display, info.visual);
216 if (screen_format) visual = info.visual;
220 if(!screen_format) /* This fails in buggy versions of libXrender.so */
224 "Wine has detected that you probably have a buggy version\n"
225 "of libXrender.so . Because of this client side font rendering\n"
226 "will be disabled. Please upgrade this library.\n");
227 X11DRV_XRender_Installed = FALSE;
230 pf.type = PictTypeDirect;
233 pf.direct.alphaMask = 1;
234 mono_format = pXRenderFindFormat(gdi_display, PictFormatType |
235 PictFormatDepth | PictFormatAlpha |
236 PictFormatAlphaMask, &pf, 0);
238 ERR("mono_format == NULL?\n");
239 X11DRV_XRender_Installed = FALSE;
241 if (!visual->red_mask || !visual->green_mask || !visual->blue_mask) {
242 WARN("one or more of the colour masks are 0, disabling XRENDER. Try running in 16-bit mode or higher.\n");
243 X11DRV_XRender_Installed = FALSE;
250 if(X11DRV_XRender_Installed || client_side_with_core)
252 glyphsetCache = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
253 sizeof(*glyphsetCache) * INIT_CACHE_SIZE);
255 glyphsetCacheSize = INIT_CACHE_SIZE;
257 for(i = 0; i < INIT_CACHE_SIZE; i++) {
258 glyphsetCache[i].next = i + 1;
259 glyphsetCache[i].count = -1;
261 glyphsetCache[i-1].next = -1;
262 using_client_side_fonts = 1;
264 if(!X11DRV_XRender_Installed) {
265 TRACE("Xrender is not available on your XServer, client side rendering with the core protocol instead.\n");
266 if(screen_depth <= 8 || !client_side_antialias_with_core)
269 if(screen_depth <= 8 || !client_side_antialias_with_render)
273 else TRACE("Using X11 core fonts\n");
276 static BOOL fontcmp(LFANDSIZE *p1, LFANDSIZE *p2)
278 if(p1->hash != p2->hash) return TRUE;
279 if(memcmp(&p1->devsize, &p2->devsize, sizeof(p1->devsize))) return TRUE;
280 if(memcmp(&p1->lf, &p2->lf, offsetof(LOGFONTW, lfFaceName))) return TRUE;
281 return strcmpW(p1->lf.lfFaceName, p2->lf.lfFaceName);
285 static void walk_cache(void)
289 EnterCriticalSection(&xrender_cs);
290 for(i=mru; i >= 0; i = glyphsetCache[i].next)
291 TRACE("item %d\n", i);
292 LeaveCriticalSection(&xrender_cs);
296 static int LookupEntry(LFANDSIZE *plfsz)
300 for(i = mru; i >= 0; i = glyphsetCache[i].next) {
302 if(glyphsetCache[i].count == -1) { /* reached free list so stop */
307 if(!fontcmp(&glyphsetCache[i].lfsz, plfsz)) {
308 glyphsetCache[i].count++;
310 glyphsetCache[prev_i].next = glyphsetCache[i].next;
311 glyphsetCache[i].next = mru;
314 TRACE("found font in cache %d\n", i);
319 TRACE("font not in cache\n");
323 static void FreeEntry(int entry)
327 for(format = 0; format < AA_MAXVALUE; format++) {
328 gsCacheEntryFormat * formatEntry;
330 if( !glyphsetCache[entry].format[format] )
333 formatEntry = glyphsetCache[entry].format[format];
335 if(formatEntry->glyphset) {
337 pXRenderFreeGlyphSet(gdi_display, formatEntry->glyphset);
339 formatEntry->glyphset = 0;
341 if(formatEntry->nrealized) {
342 HeapFree(GetProcessHeap(), 0, formatEntry->realized);
343 formatEntry->realized = NULL;
344 if(formatEntry->bitmaps) {
345 for(i = 0; i < formatEntry->nrealized; i++)
346 HeapFree(GetProcessHeap(), 0, formatEntry->bitmaps[i]);
347 HeapFree(GetProcessHeap(), 0, formatEntry->bitmaps);
348 formatEntry->bitmaps = NULL;
349 HeapFree(GetProcessHeap(), 0, formatEntry->gis);
350 formatEntry->gis = NULL;
352 formatEntry->nrealized = 0;
355 HeapFree(GetProcessHeap(), 0, formatEntry);
356 glyphsetCache[entry].format[format] = NULL;
360 static int AllocEntry(void)
362 int best = -1, prev_best = -1, i, prev_i = -1;
365 assert(glyphsetCache[lastfree].count == -1);
366 glyphsetCache[lastfree].count = 1;
368 lastfree = glyphsetCache[lastfree].next;
370 glyphsetCache[best].next = mru;
373 TRACE("empty space at %d, next lastfree = %d\n", mru, lastfree);
377 for(i = mru; i >= 0; i = glyphsetCache[i].next) {
378 if(glyphsetCache[i].count == 0) {
386 TRACE("freeing unused glyphset at cache %d\n", best);
388 glyphsetCache[best].count = 1;
390 glyphsetCache[prev_best].next = glyphsetCache[best].next;
391 glyphsetCache[best].next = mru;
399 TRACE("Growing cache\n");
402 glyphsetCache = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
404 (glyphsetCacheSize + INIT_CACHE_SIZE)
405 * sizeof(*glyphsetCache));
407 glyphsetCache = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
408 (glyphsetCacheSize + INIT_CACHE_SIZE)
409 * sizeof(*glyphsetCache));
411 for(best = i = glyphsetCacheSize; i < glyphsetCacheSize + INIT_CACHE_SIZE;
413 glyphsetCache[i].next = i + 1;
414 glyphsetCache[i].count = -1;
416 glyphsetCache[i-1].next = -1;
417 glyphsetCacheSize += INIT_CACHE_SIZE;
419 lastfree = glyphsetCache[best].next;
420 glyphsetCache[best].count = 1;
421 glyphsetCache[best].next = mru;
423 TRACE("new free cache slot at %d\n", mru);
427 static BOOL get_gasp_flags(X11DRV_PDEVICE *physDev, WORD *flags)
437 size = GetFontData(physDev->hdc, MS_GASP_TAG, 0, NULL, 0);
438 if(size == GDI_ERROR)
441 gasp = buffer = HeapAlloc(GetProcessHeap(), 0, size);
442 GetFontData(physDev->hdc, MS_GASP_TAG, 0, gasp, size);
444 GetTextMetricsW(physDev->hdc, &tm);
445 ppem = abs(X11DRV_YWStoDS(physDev, tm.tmAscent + tm.tmDescent - tm.tmInternalLeading));
448 num_recs = get_be_word(*gasp);
452 *flags = get_be_word(*(gasp + 1));
453 if(ppem <= get_be_word(*gasp))
457 TRACE("got flags %04x for ppem %d\n", *flags, ppem);
459 HeapFree(GetProcessHeap(), 0, buffer);
463 static int GetCacheEntry(X11DRV_PDEVICE *physDev, LFANDSIZE *plfsz)
469 static int hinter = -1;
471 if((ret = LookupEntry(plfsz)) != -1) return ret;
474 entry = glyphsetCache + ret;
475 entry->lfsz = *plfsz;
476 for( format = 0; format < AA_MAXVALUE; format++ ) {
477 assert( !entry->format[format] );
480 if(antialias && plfsz->lf.lfQuality != NONANTIALIASED_QUALITY)
484 RASTERIZER_STATUS status;
485 GetRasterizerCaps(&status, sizeof(status));
486 hinter = status.wFlags & WINE_TT_HINTER_ENABLED;
488 if(!hinter || !get_gasp_flags(physDev, &flags) || flags & GASP_DOGRAY)
489 entry->aa_default = AA_Grey;
491 entry->aa_default = AA_None;
494 entry->aa_default = AA_None;
499 static void dec_ref_cache(int index)
502 TRACE("dec'ing entry %d to %d\n", index, glyphsetCache[index].count - 1);
503 assert(glyphsetCache[index].count > 0);
504 glyphsetCache[index].count--;
507 static void lfsz_calc_hash(LFANDSIZE *plfsz)
509 DWORD hash = 0, *ptr;
512 hash ^= plfsz->devsize.cx;
513 hash ^= plfsz->devsize.cy;
514 for(i = 0, ptr = (DWORD*)&plfsz->lf; i < 7; i++, ptr++)
516 for(i = 0, ptr = (DWORD*)&plfsz->lf.lfFaceName; i < LF_FACESIZE/2; i++, ptr++) {
517 WCHAR *pwc = (WCHAR *)ptr;
527 /***********************************************************************
528 * X11DRV_XRender_Finalize
530 void X11DRV_XRender_Finalize(void)
534 EnterCriticalSection(&xrender_cs);
535 for(i = mru; i >= 0; i = glyphsetCache[i].next)
537 LeaveCriticalSection(&xrender_cs);
541 /***********************************************************************
542 * X11DRV_XRender_SelectFont
544 BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE *physDev, HFONT hfont)
548 GetObjectW(hfont, sizeof(lfsz.lf), &lfsz.lf);
549 TRACE("h=%d w=%d weight=%d it=%d charset=%d name=%s\n",
550 lfsz.lf.lfHeight, lfsz.lf.lfWidth, lfsz.lf.lfWeight,
551 lfsz.lf.lfItalic, lfsz.lf.lfCharSet, debugstr_w(lfsz.lf.lfFaceName));
552 lfsz.devsize.cx = X11DRV_XWStoDS( physDev, lfsz.lf.lfWidth );
553 lfsz.devsize.cy = X11DRV_YWStoDS( physDev, lfsz.lf.lfHeight );
554 lfsz_calc_hash(&lfsz);
556 EnterCriticalSection(&xrender_cs);
557 if(!physDev->xrender) {
558 physDev->xrender = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
559 sizeof(*physDev->xrender));
560 physDev->xrender->cache_index = -1;
562 else if(physDev->xrender->cache_index != -1)
563 dec_ref_cache(physDev->xrender->cache_index);
564 physDev->xrender->cache_index = GetCacheEntry(physDev, &lfsz);
565 LeaveCriticalSection(&xrender_cs);
569 /***********************************************************************
570 * X11DRV_XRender_DeleteDC
572 void X11DRV_XRender_DeleteDC(X11DRV_PDEVICE *physDev)
574 X11DRV_XRender_UpdateDrawable(physDev);
576 EnterCriticalSection(&xrender_cs);
577 if(physDev->xrender->cache_index != -1)
578 dec_ref_cache(physDev->xrender->cache_index);
579 LeaveCriticalSection(&xrender_cs);
581 HeapFree(GetProcessHeap(), 0, physDev->xrender);
582 physDev->xrender = NULL;
586 /***********************************************************************
587 * X11DRV_XRender_UpdateDrawable
589 * This gets called from X11DRV_SetDrawable and X11DRV_SelectBitmap.
590 * It deletes the pict and tile when the drawable changes.
592 void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev)
596 if(physDev->xrender->pict)
598 TRACE("freeing pict = %lx dc = %p\n", physDev->xrender->pict, physDev->hdc);
600 pXRenderFreePicture(gdi_display, physDev->xrender->pict);
601 physDev->xrender->pict = 0;
603 if(physDev->xrender->tile_pict)
605 pXRenderFreePicture(gdi_display, physDev->xrender->tile_pict);
606 physDev->xrender->tile_pict = 0;
608 if(physDev->xrender->tile_xpm)
610 XFreePixmap(gdi_display, physDev->xrender->tile_xpm);
611 physDev->xrender->tile_xpm = 0;
619 /************************************************************************
622 * Helper to ExtTextOut. Must be called inside xrender_cs
624 static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph, AA_Type format)
631 gsCacheEntry *entry = glyphsetCache + physDev->xrender->cache_index;
632 gsCacheEntryFormat *formatEntry;
633 UINT ggo_format = GGO_GLYPH_INDEX;
634 XRenderPictFormat pf;
638 ggo_format |= WINE_GGO_GRAY16_BITMAP;
642 ERR("aa = %d - not implemented\n", format);
644 ggo_format |= GGO_BITMAP;
648 buflen = GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, 0, NULL,
650 if(buflen == GDI_ERROR) {
651 if(format != AA_None) {
653 entry->aa_default = AA_None;
654 ggo_format &= ~WINE_GGO_GRAY16_BITMAP;
655 ggo_format |= GGO_BITMAP;
656 buflen = GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, 0, NULL,
659 if(buflen == GDI_ERROR) {
660 WARN("GetGlyphOutlineW failed\n");
663 TRACE("Turning off antialiasing for this monochrome font\n");
666 /* If there is nothing for the current type, we create the entry. */
667 if( !entry->format[format] ) {
668 entry->format[format] = HeapAlloc(GetProcessHeap(),
670 sizeof(gsCacheEntryFormat));
672 formatEntry = entry->format[format];
674 if(formatEntry->nrealized <= glyph) {
675 formatEntry->nrealized = (glyph / 128 + 1) * 128;
677 if (formatEntry->realized)
678 formatEntry->realized = HeapReAlloc(GetProcessHeap(),
680 formatEntry->realized,
681 formatEntry->nrealized * sizeof(BOOL));
683 formatEntry->realized = HeapAlloc(GetProcessHeap(),
685 formatEntry->nrealized * sizeof(BOOL));
687 if(!X11DRV_XRender_Installed) {
688 if (formatEntry->bitmaps)
689 formatEntry->bitmaps = HeapReAlloc(GetProcessHeap(),
691 formatEntry->bitmaps,
692 formatEntry->nrealized * sizeof(formatEntry->bitmaps[0]));
694 formatEntry->bitmaps = HeapAlloc(GetProcessHeap(),
696 formatEntry->nrealized * sizeof(formatEntry->bitmaps[0]));
698 if (formatEntry->gis)
699 formatEntry->gis = HeapReAlloc(GetProcessHeap(),
702 formatEntry->nrealized * sizeof(formatEntry->gis[0]));
704 formatEntry->gis = HeapAlloc(GetProcessHeap(),
706 formatEntry->nrealized * sizeof(formatEntry->gis[0]));
711 if(formatEntry->glyphset == 0 && X11DRV_XRender_Installed) {
715 pf.direct.alphaMask = 0xff;
719 ERR("aa = %d - not implemented\n", format);
722 pf.direct.alphaMask = 1;
726 pf.type = PictTypeDirect;
730 formatEntry->font_format = pXRenderFindFormat(gdi_display,
737 formatEntry->glyphset = pXRenderCreateGlyphSet(gdi_display, formatEntry->font_format);
742 buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen);
743 GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, buflen, buf, NULL);
744 formatEntry->realized[glyph] = TRUE;
746 TRACE("buflen = %d. Got metrics: %dx%d adv=%d,%d origin=%d,%d\n",
748 gm.gmBlackBoxX, gm.gmBlackBoxY, gm.gmCellIncX, gm.gmCellIncY,
749 gm.gmptGlyphOrigin.x, gm.gmptGlyphOrigin.y);
751 gi.width = gm.gmBlackBoxX;
752 gi.height = gm.gmBlackBoxY;
753 gi.x = -gm.gmptGlyphOrigin.x;
754 gi.y = gm.gmptGlyphOrigin.y;
755 gi.xOff = gm.gmCellIncX;
756 gi.yOff = gm.gmCellIncY;
758 if(TRACE_ON(xrender)) {
763 if(format == AA_None) {
764 pitch = ((gi.width + 31) / 32) * 4;
765 for(i = 0; i < gi.height; i++) {
766 line = (unsigned char*) buf + i * pitch;
768 for(j = 0; j < pitch * 8; j++) {
769 strcat(output, (line[j / 8] & (1 << (7 - (j % 8)))) ? "#" : " ");
771 strcat(output, "\n");
775 static const char blks[] = " .:;!o*#";
779 pitch = ((gi.width + 3) / 4) * 4;
780 for(i = 0; i < gi.height; i++) {
781 line = (unsigned char*) buf + i * pitch;
783 for(j = 0; j < pitch; j++) {
784 str[0] = blks[line[j] >> 5];
787 strcat(output, "\n");
793 if(formatEntry->glyphset) {
794 if(format == AA_None && BitmapBitOrder(gdi_display) != MSBFirst) {
795 unsigned char *byte = (unsigned char*) buf, c;
801 /* magic to flip bit order */
802 c = ((c << 1) & 0xaa) | ((c >> 1) & 0x55);
803 c = ((c << 2) & 0xcc) | ((c >> 2) & 0x33);
804 c = ((c << 4) & 0xf0) | ((c >> 4) & 0x0f);
811 pXRenderAddGlyphs(gdi_display, formatEntry->glyphset, &gid, &gi, 1,
814 HeapFree(GetProcessHeap(), 0, buf);
816 formatEntry->bitmaps[glyph] = buf;
817 memcpy(&formatEntry->gis[glyph], &gi, sizeof(gi));
822 static void SharpGlyphMono(X11DRV_PDEVICE *physDev, INT x, INT y,
823 void *bitmap, XGlyphInfo *gi)
825 unsigned char *srcLine = bitmap, *src;
826 unsigned char bits, bitsMask;
827 int width = gi->width;
828 int stride = ((width + 31) & ~31) >> 3;
829 int height = gi->height;
833 TRACE("%d, %d\n", x, y);
842 bitsMask = 0x80; /* FreeType is always MSB first */
856 bitsMask = bitsMask >> 1;
862 } while (bits & bitsMask);
863 XFillRectangle (gdi_display, physDev->drawable,
864 physDev->gc, xspan, y, lenspan, 1);
876 bitsMask = bitsMask >> 1;
882 } while (!(bits & bitsMask));
889 static void SharpGlyphGray(X11DRV_PDEVICE *physDev, INT x, INT y,
890 void *bitmap, XGlyphInfo *gi)
892 unsigned char *srcLine = bitmap, *src, bits;
893 int width = gi->width;
894 int stride = ((width + 3) & ~3);
895 int height = gi->height;
920 } while (bits >= 0x80);
921 XFillRectangle (gdi_display, physDev->drawable,
922 physDev->gc, xspan, y, lenspan, 1);
935 } while (bits < 0x80);
943 static void ExamineBitfield (DWORD mask, int *shift, int *len)
948 while ((mask & 1) == 0)
954 while ((mask & 1) == 1)
963 static DWORD GetField (DWORD pixel, int shift, int len)
965 pixel = pixel & (((1 << (len)) - 1) << shift);
966 pixel = pixel << (32 - (shift + len)) >> 24;
969 pixel |= (pixel >> len);
976 static DWORD PutField (DWORD pixel, int shift, int len)
978 shift = shift - (8 - len);
980 pixel &= (((1 << len) - 1) << (8 - len));
988 static void SmoothGlyphGray(XImage *image, int x, int y, void *bitmap, XGlyphInfo *gi,
994 BYTE *maskLine, *mask, m;
999 BYTE src_r, src_g, src_b;
1004 height = gi->height;
1006 maskLine = (unsigned char *) bitmap;
1007 maskStride = (width + 3) & ~3;
1009 ExamineBitfield (image->red_mask, &r_shift, &r_len);
1010 ExamineBitfield (image->green_mask, &g_shift, &g_len);
1011 ExamineBitfield (image->blue_mask, &b_shift, &b_len);
1013 src_r = GetField(color, r_shift, r_len);
1014 src_g = GetField(color, g_shift, g_len);
1015 src_b = GetField(color, b_shift, b_len);
1017 for(; height--; y++)
1020 maskLine += maskStride;
1025 if(y >= image->height) break;
1029 if(tx >= image->width) break;
1032 if(tx < 0) continue;
1035 XPutPixel (image, tx, y, color);
1040 pixel = XGetPixel (image, tx, y);
1042 r = GetField(pixel, r_shift, r_len);
1043 r = ((BYTE)~m * (WORD)r + (BYTE)m * (WORD)src_r) >> 8;
1044 g = GetField(pixel, g_shift, g_len);
1045 g = ((BYTE)~m * (WORD)g + (BYTE)m * (WORD)src_g) >> 8;
1046 b = GetField(pixel, b_shift, b_len);
1047 b = ((BYTE)~m * (WORD)b + (BYTE)m * (WORD)src_b) >> 8;
1049 pixel = (PutField (r, r_shift, r_len) |
1050 PutField (g, g_shift, g_len) |
1051 PutField (b, b_shift, b_len));
1052 XPutPixel (image, tx, y, pixel);
1058 static int XRenderErrorHandler(Display *dpy, XErrorEvent *event, void *arg)
1063 /***********************************************************************
1064 * X11DRV_XRender_ExtTextOut
1066 BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
1067 const RECT *lprect, LPCWSTR wstr, UINT count,
1073 int render_op = PictOpOver;
1074 gsCacheEntry *entry;
1075 gsCacheEntryFormat *formatEntry;
1077 HDC hdc = physDev->hdc;
1078 int textPixel, backgroundPixel;
1079 HRGN saved_region = 0;
1080 BOOL disable_antialias = FALSE;
1081 AA_Type aa_type = AA_None;
1084 double cosEsc, sinEsc;
1087 /* Do we need to disable antialiasing because of palette mode? */
1088 if( !physDev->bitmap || GetObjectW( physDev->bitmap->hbitmap, sizeof(bmp), &bmp ) != sizeof(bmp) ) {
1089 TRACE("bitmap is not a DIB\n");
1091 else if (bmp.dsBmih.biBitCount <= 8) {
1092 TRACE("Disabling antialiasing\n");
1093 disable_antialias = TRUE;
1096 xgcval.function = GXcopy;
1097 xgcval.background = physDev->backgroundPixel;
1098 xgcval.fill_style = FillSolid;
1100 XChangeGC( gdi_display, physDev->gc, GCFunction | GCBackground | GCFillStyle, &xgcval );
1101 wine_tsx11_unlock();
1103 X11DRV_LockDIBSection( physDev, DIB_Status_GdiMod, FALSE );
1105 if(physDev->depth == 1) {
1106 if((physDev->textPixel & 0xffffff) == 0) {
1108 backgroundPixel = 1;
1111 backgroundPixel = 0;
1114 textPixel = physDev->textPixel;
1115 backgroundPixel = physDev->backgroundPixel;
1118 if(flags & ETO_OPAQUE)
1121 XSetForeground( gdi_display, physDev->gc, backgroundPixel );
1122 XFillRectangle( gdi_display, physDev->drawable, physDev->gc,
1123 physDev->dc_rect.left + lprect->left, physDev->dc_rect.top + lprect->top,
1124 lprect->right - lprect->left, lprect->bottom - lprect->top );
1125 wine_tsx11_unlock();
1135 GetObjectW(GetCurrentObject(physDev->hdc, OBJ_FONT), sizeof(lf), &lf);
1136 if(lf.lfEscapement != 0) {
1137 cosEsc = cos(lf.lfEscapement * M_PI / 1800);
1138 sinEsc = sin(lf.lfEscapement * M_PI / 1800);
1144 if (flags & ETO_CLIPPED)
1148 clip_region = CreateRectRgnIndirect( lprect );
1149 /* make a copy of the current device region */
1150 saved_region = CreateRectRgn( 0, 0, 0, 0 );
1151 CombineRgn( saved_region, physDev->region, 0, RGN_COPY );
1152 X11DRV_SetDeviceClipping( physDev, saved_region, clip_region );
1153 DeleteObject( clip_region );
1156 if(X11DRV_XRender_Installed) {
1157 if(!physDev->xrender->pict) {
1158 XRenderPictureAttributes pa;
1159 pa.subwindow_mode = IncludeInferiors;
1162 physDev->xrender->pict = pXRenderCreatePicture(gdi_display,
1164 (physDev->depth == 1) ?
1165 mono_format : screen_format,
1166 CPSubwindowMode, &pa);
1167 wine_tsx11_unlock();
1169 TRACE("allocing pict = %lx dc = %p drawable = %08lx\n",
1170 physDev->xrender->pict, hdc, physDev->drawable);
1172 TRACE("using existing pict = %lx dc = %p drawable = %08lx\n",
1173 physDev->xrender->pict, hdc, physDev->drawable);
1176 if ((data = X11DRV_GetRegionData( physDev->region, 0 )))
1179 pXRenderSetPictureClipRectangles( gdi_display, physDev->xrender->pict,
1180 physDev->dc_rect.left, physDev->dc_rect.top,
1181 (XRectangle *)data->Buffer, data->rdh.nCount );
1182 wine_tsx11_unlock();
1183 HeapFree( GetProcessHeap(), 0, data );
1187 if(X11DRV_XRender_Installed) {
1188 /* Create a 1x1 pixmap to tile over the font mask */
1189 if(!physDev->xrender->tile_xpm) {
1190 XRenderPictureAttributes pa;
1192 XRenderPictFormat *format = (physDev->depth == 1) ? mono_format : screen_format;
1194 physDev->xrender->tile_xpm = XCreatePixmap(gdi_display,
1199 physDev->xrender->tile_pict = pXRenderCreatePicture(gdi_display,
1200 physDev->xrender->tile_xpm,
1203 wine_tsx11_unlock();
1204 TRACE("Created pixmap of depth %d\n", format->depth);
1205 /* init lastTextColor to something different from textPixel */
1206 physDev->xrender->lastTextColor = ~physDev->textPixel;
1210 if(physDev->textPixel != physDev->xrender->lastTextColor) {
1211 if(physDev->depth != 1) {
1212 /* Map 0 -- 0xff onto 0 -- 0xffff */
1217 ExamineBitfield (visual->red_mask, &r_shift, &r_len );
1218 ExamineBitfield (visual->green_mask, &g_shift, &g_len);
1219 ExamineBitfield (visual->blue_mask, &b_shift, &b_len);
1221 col.red = GetField(physDev->textPixel, r_shift, r_len);
1222 col.red |= col.red << 8;
1223 col.green = GetField(physDev->textPixel, g_shift, g_len);
1224 col.green |= col.green << 8;
1225 col.blue = GetField(physDev->textPixel, b_shift, b_len);
1226 col.blue |= col.blue << 8;
1228 } else { /* for a 1bpp bitmap we always need a 1 in the tile */
1229 col.red = col.green = col.blue = 0;
1233 pXRenderFillRectangle(gdi_display, PictOpSrc,
1234 physDev->xrender->tile_pict,
1236 wine_tsx11_unlock();
1237 physDev->xrender->lastTextColor = physDev->textPixel;
1240 /* FIXME the mapping of Text/BkColor onto 1 or 0 needs investigation.
1242 if((physDev->depth == 1) && (textPixel == 0))
1243 render_op = PictOpOutReverse; /* This gives us 'black' text */
1246 EnterCriticalSection(&xrender_cs);
1247 entry = glyphsetCache + physDev->xrender->cache_index;
1248 if( disable_antialias == FALSE )
1249 aa_type = entry->aa_default;
1250 formatEntry = entry->format[aa_type];
1252 for(idx = 0; idx < count; idx++) {
1253 if( !formatEntry ) {
1254 UploadGlyph(physDev, wstr[idx], aa_type);
1255 /* re-evaluate antialias since aa_default may have changed */
1256 if( disable_antialias == FALSE )
1257 aa_type = entry->aa_default;
1258 formatEntry = entry->format[aa_type];
1259 } else if( wstr[idx] >= formatEntry->nrealized || formatEntry->realized[wstr[idx]] == FALSE) {
1260 UploadGlyph(physDev, wstr[idx], aa_type);
1265 WARN("could not upload requested glyphs\n");
1266 LeaveCriticalSection(&xrender_cs);
1270 TRACE("Writing %s at %d,%d\n", debugstr_wn(wstr,count),
1271 physDev->dc_rect.left + x, physDev->dc_rect.top + y);
1273 if(X11DRV_XRender_Installed) {
1276 pXRenderCompositeString16(gdi_display, render_op,
1277 physDev->xrender->tile_pict,
1278 physDev->xrender->pict,
1279 formatEntry->font_format, formatEntry->glyphset,
1280 0, 0, physDev->dc_rect.left + x, physDev->dc_rect.top + y,
1283 INT offset = 0, xoff = 0, yoff = 0;
1284 for(idx = 0; idx < count; idx++) {
1285 pXRenderCompositeString16(gdi_display, render_op,
1286 physDev->xrender->tile_pict,
1287 physDev->xrender->pict,
1288 formatEntry->font_format, formatEntry->glyphset,
1289 0, 0, physDev->dc_rect.left + x + xoff,
1290 physDev->dc_rect.top + y + yoff,
1292 offset += lpDx[idx];
1293 xoff = offset * cosEsc;
1294 yoff = offset * -sinEsc;
1297 wine_tsx11_unlock();
1300 INT offset = 0, xoff = 0, yoff = 0;
1302 XSetForeground( gdi_display, physDev->gc, textPixel );
1304 if(aa_type == AA_None) {
1305 for(idx = 0; idx < count; idx++) {
1306 SharpGlyphMono(physDev, physDev->dc_rect.left + x + xoff,
1307 physDev->dc_rect.top + y + yoff,
1308 formatEntry->bitmaps[wstr[idx]],
1309 &formatEntry->gis[wstr[idx]]);
1311 offset += lpDx[idx];
1312 xoff = offset * cosEsc;
1313 yoff = offset * -sinEsc;
1315 xoff += formatEntry->gis[wstr[idx]].xOff;
1316 yoff += formatEntry->gis[wstr[idx]].yOff;
1319 } else if(physDev->depth == 1) {
1320 for(idx = 0; idx < count; idx++) {
1321 SharpGlyphGray(physDev, physDev->dc_rect.left + x + xoff,
1322 physDev->dc_rect.top + y + yoff,
1323 formatEntry->bitmaps[wstr[idx]],
1324 &formatEntry->gis[wstr[idx]]);
1326 offset += lpDx[idx];
1327 xoff = offset * cosEsc;
1328 yoff = offset * -sinEsc;
1330 xoff += formatEntry->gis[wstr[idx]].xOff;
1331 yoff += formatEntry->gis[wstr[idx]].yOff;
1337 int image_x, image_y, image_off_x, image_off_y, image_w, image_h;
1338 RECT extents = {0, 0, 0, 0};
1340 int w = physDev->drawable_rect.right - physDev->drawable_rect.left;
1341 int h = physDev->drawable_rect.bottom - physDev->drawable_rect.top;
1343 TRACE("drawable %dx%d\n", w, h);
1345 for(idx = 0; idx < count; idx++) {
1346 if(extents.left > cur.x - formatEntry->gis[wstr[idx]].x)
1347 extents.left = cur.x - formatEntry->gis[wstr[idx]].x;
1348 if(extents.top > cur.y - formatEntry->gis[wstr[idx]].y)
1349 extents.top = cur.y - formatEntry->gis[wstr[idx]].y;
1350 if(extents.right < cur.x - formatEntry->gis[wstr[idx]].x + formatEntry->gis[wstr[idx]].width)
1351 extents.right = cur.x - formatEntry->gis[wstr[idx]].x + formatEntry->gis[wstr[idx]].width;
1352 if(extents.bottom < cur.y - formatEntry->gis[wstr[idx]].y + formatEntry->gis[wstr[idx]].height)
1353 extents.bottom = cur.y - formatEntry->gis[wstr[idx]].y + formatEntry->gis[wstr[idx]].height;
1355 offset += lpDx[idx];
1356 cur.x = offset * cosEsc;
1357 cur.y = offset * -sinEsc;
1359 cur.x += formatEntry->gis[wstr[idx]].xOff;
1360 cur.y += formatEntry->gis[wstr[idx]].yOff;
1363 TRACE("glyph extents %d,%d - %d,%d drawable x,y %d,%d\n", extents.left, extents.top,
1364 extents.right, extents.bottom, physDev->dc_rect.left + x, physDev->dc_rect.top + y);
1366 if(physDev->dc_rect.left + x + extents.left >= 0) {
1367 image_x = physDev->dc_rect.left + x + extents.left;
1371 image_off_x = physDev->dc_rect.left + x + extents.left;
1373 if(physDev->dc_rect.top + y + extents.top >= 0) {
1374 image_y = physDev->dc_rect.top + y + extents.top;
1378 image_off_y = physDev->dc_rect.top + y + extents.top;
1380 if(physDev->dc_rect.left + x + extents.right < w)
1381 image_w = physDev->dc_rect.left + x + extents.right - image_x;
1383 image_w = w - image_x;
1384 if(physDev->dc_rect.top + y + extents.bottom < h)
1385 image_h = physDev->dc_rect.top + y + extents.bottom - image_y;
1387 image_h = h - image_y;
1389 if(image_w <= 0 || image_h <= 0) goto no_image;
1391 X11DRV_expect_error(gdi_display, XRenderErrorHandler, NULL);
1392 image = XGetImage(gdi_display, physDev->drawable,
1393 image_x, image_y, image_w, image_h,
1394 AllPlanes, ZPixmap);
1395 X11DRV_check_error();
1397 TRACE("XGetImage(%p, %x, %d, %d, %d, %d, %lx, %x) depth = %d rets %p\n",
1398 gdi_display, (int)physDev->drawable, image_x, image_y,
1399 image_w, image_h, AllPlanes, ZPixmap,
1400 physDev->depth, image);
1402 Pixmap xpm = XCreatePixmap(gdi_display, physDev->drawable, image_w, image_h,
1407 gcv.graphics_exposures = False;
1408 gc = XCreateGC(gdi_display, xpm, GCGraphicsExposures, &gcv);
1409 XCopyArea(gdi_display, physDev->drawable, xpm, gc, image_x, image_y,
1410 image_w, image_h, 0, 0);
1411 XFreeGC(gdi_display, gc);
1412 X11DRV_expect_error(gdi_display, XRenderErrorHandler, NULL);
1413 image = XGetImage(gdi_display, xpm, 0, 0, image_w, image_h, AllPlanes,
1415 X11DRV_check_error();
1416 XFreePixmap(gdi_display, xpm);
1418 if(!image) goto no_image;
1420 image->red_mask = visual->red_mask;
1421 image->green_mask = visual->green_mask;
1422 image->blue_mask = visual->blue_mask;
1424 offset = xoff = yoff = 0;
1425 for(idx = 0; idx < count; idx++) {
1426 SmoothGlyphGray(image, xoff + image_off_x - extents.left,
1427 yoff + image_off_y - extents.top,
1428 formatEntry->bitmaps[wstr[idx]],
1429 &formatEntry->gis[wstr[idx]],
1430 physDev->textPixel);
1432 offset += lpDx[idx];
1433 xoff = offset * cosEsc;
1434 yoff = offset * -sinEsc;
1436 xoff += formatEntry->gis[wstr[idx]].xOff;
1437 yoff += formatEntry->gis[wstr[idx]].yOff;
1440 XPutImage(gdi_display, physDev->drawable, physDev->gc, image, 0, 0,
1441 image_x, image_y, image_w, image_h);
1442 XDestroyImage(image);
1445 wine_tsx11_unlock();
1447 LeaveCriticalSection(&xrender_cs);
1449 if (flags & ETO_CLIPPED)
1451 /* restore the device region */
1452 X11DRV_SetDeviceClipping( physDev, saved_region, 0 );
1453 DeleteObject( saved_region );
1459 X11DRV_UnlockDIBSection( physDev, TRUE );
1463 /******************************************************************************
1464 * AlphaBlend (x11drv.@)
1466 BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst, INT heightDst,
1467 X11DRV_PDEVICE *devSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc,
1468 BLENDFUNCTION blendfn)
1470 XRenderPictureAttributes pa;
1471 XRenderPictFormat *src_format;
1472 XRenderPictFormat argb32_templ = {
1474 PictTypeDirect, /* type */
1477 16, /* direct.red */
1478 0xff, /* direct.redMask */
1479 8, /* direct.green */
1480 0xff, /* direct.greenMask */
1481 0, /* direct.blue */
1482 0xff, /* direct.blueMask */
1483 24, /* direct.alpha */
1484 0xff, /* direct.alphaMask */
1488 unsigned long argb32_templ_mask =
1494 PictFormatGreenMask |
1496 PictFormatBlueMask |
1498 PictFormatAlphaMask;
1500 Picture dst_pict, src_pict;
1506 BYTE *dstbits, *data;
1509 BOOL top_down = FALSE;
1512 if(!X11DRV_XRender_Installed) {
1513 FIXME("Unable to AlphaBlend without Xrender\n");
1518 pts[1].x = xDst + widthDst;
1519 pts[1].y = yDst + heightDst;
1520 LPtoDP(devDst->hdc, pts, 2);
1523 widthDst = pts[1].x - pts[0].x;
1524 heightDst = pts[1].y - pts[0].y;
1528 pts[1].x = xSrc + widthSrc;
1529 pts[1].y = ySrc + heightSrc;
1530 LPtoDP(devSrc->hdc, pts, 2);
1533 widthSrc = pts[1].x - pts[0].x;
1534 heightSrc = pts[1].y - pts[0].y;
1535 if (!widthDst || !heightDst || !widthSrc || !heightSrc) return TRUE;
1537 #ifndef HAVE_XRENDERSETPICTURETRANSFORM
1538 if(widthDst != widthSrc || heightDst != heightSrc)
1540 if(!pXRenderSetPictureTransform)
1543 FIXME("Unable to Stretch, XRenderSetPictureTransform is currently required\n");
1547 if (!devSrc->bitmap || GetObjectW( devSrc->bitmap->hbitmap, sizeof(dib), &dib ) != sizeof(dib))
1549 FIXME("not a dibsection\n");
1553 if(dib.dsBm.bmBitsPixel != 32) {
1554 FIXME("not a 32 bpp dibsection\n");
1557 dstbits = data = HeapAlloc(GetProcessHeap(), 0, heightSrc * widthSrc * 4);
1559 if(dib.dsBmih.biHeight < 0) { /* top-down dib */
1561 dstbits += widthSrc * (heightSrc - 1) * 4;
1563 y = y2 + heightSrc - 1;
1567 y = dib.dsBmih.biHeight - ySrc - 1;
1568 y2 = y - heightSrc + 1;
1570 for(; y >= y2; y--) {
1571 memcpy(dstbits, (char *)dib.dsBm.bmBits + y * dib.dsBm.bmWidthBytes + xSrc * 4,
1573 dstbits += (top_down ? -1 : 1) * widthSrc * 4;
1577 image = XCreateImage(gdi_display, visual, 32, ZPixmap, 0,
1578 (char*) data, widthSrc, heightSrc, 32, widthSrc * 4);
1581 Avoid using XRenderFindStandardFormat as older libraries don't have it
1582 src_format = pXRenderFindStandardFormat(gdi_display, PictStandardARGB32);
1584 src_format = pXRenderFindFormat(gdi_display, argb32_templ_mask, &argb32_templ, 0);
1586 TRACE("src_format %p\n", src_format);
1588 pa.subwindow_mode = IncludeInferiors;
1590 /* FIXME use devDst->xrender->pict ? */
1591 dst_pict = pXRenderCreatePicture(gdi_display,
1593 (devDst->depth == 1) ?
1594 mono_format : screen_format,
1595 CPSubwindowMode, &pa);
1596 TRACE("dst_pict %08lx\n", dst_pict);
1597 TRACE("src_drawable = %08lx\n", devSrc->drawable);
1598 xpm = XCreatePixmap(gdi_display,
1600 widthSrc, heightSrc, 32);
1601 gcv.graphics_exposures = False;
1602 gc = XCreateGC(gdi_display, xpm, GCGraphicsExposures, &gcv);
1603 TRACE("xpm = %08lx\n", xpm);
1604 XPutImage(gdi_display, xpm, gc, image, 0, 0, 0, 0, widthSrc, heightSrc);
1606 src_pict = pXRenderCreatePicture(gdi_display,
1608 CPSubwindowMode, &pa);
1609 TRACE("src_pict %08lx\n", src_pict);
1611 if ((rgndata = X11DRV_GetRegionData( devDst->region, 0 )))
1613 pXRenderSetPictureClipRectangles( gdi_display, dst_pict,
1614 devDst->dc_rect.left, devDst->dc_rect.top,
1615 (XRectangle *)rgndata->Buffer,
1616 rgndata->rdh.nCount );
1617 HeapFree( GetProcessHeap(), 0, rgndata );
1620 #ifdef HAVE_XRENDERSETPICTURETRANSFORM
1621 if(widthDst != widthSrc || heightDst != heightSrc) {
1622 double xscale = widthSrc/(double)widthDst;
1623 double yscale = heightSrc/(double)heightDst;
1624 XTransform xform = {{
1625 { XDoubleToFixed(xscale), XDoubleToFixed(0), XDoubleToFixed(0) },
1626 { XDoubleToFixed(0), XDoubleToFixed(yscale), XDoubleToFixed(0) },
1627 { XDoubleToFixed(0), XDoubleToFixed(0), XDoubleToFixed(1) }
1629 pXRenderSetPictureTransform(gdi_display, src_pict, &xform);
1632 pXRenderComposite(gdi_display, PictOpOver, src_pict, 0, dst_pict,
1634 xDst + devDst->dc_rect.left, yDst + devDst->dc_rect.top, widthDst, heightDst);
1637 pXRenderFreePicture(gdi_display, src_pict);
1638 XFreePixmap(gdi_display, xpm);
1639 XFreeGC(gdi_display, gc);
1640 pXRenderFreePicture(gdi_display, dst_pict);
1642 XDestroyImage(image);
1644 wine_tsx11_unlock();
1645 HeapFree(GetProcessHeap(), 0, data);
1649 #else /* HAVE_X11_EXTENSIONS_XRENDER_H */
1651 void X11DRV_XRender_Init(void)
1653 TRACE("XRender support not compiled in.\n");
1657 void X11DRV_XRender_Finalize(void)
1661 BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE *physDev, HFONT hfont)
1667 void X11DRV_XRender_DeleteDC(X11DRV_PDEVICE *physDev)
1673 BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
1674 const RECT *lprect, LPCWSTR wstr, UINT count,
1681 void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev)
1687 /******************************************************************************
1688 * AlphaBlend (x11drv.@)
1690 BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst, INT heightDst,
1691 X11DRV_PDEVICE *devSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc,
1692 BLENDFUNCTION blendfn)
1694 FIXME("not supported - XRENDER headers were missing at compile time\n");
1698 #endif /* HAVE_X11_EXTENSIONS_XRENDER_H */