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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 /* Older version of the Xrender headers don't define these */
51 #ifndef PictStandardARGB32
53 #define PictStandardARGB32 0
54 XRenderPictFormat * XRenderFindStandardFormat (Display *dpy, int format);
58 static XRenderPictFormat *screen_format; /* format of screen */
59 static XRenderPictFormat *mono_format; /* format of mono bitmap */
64 SIZE devsize; /* size in device coords */
68 #define INITIAL_REALIZED_BUF_SIZE 128
70 typedef enum { AA_None, AA_Grey, AA_RGB, AA_BGR, AA_VRGB, AA_VBGR } AA_Type;
77 XRenderPictFormat *font_format;
92 COLORREF lastTextColor;
96 static gsCacheEntry *glyphsetCache = NULL;
97 static DWORD glyphsetCacheSize = 0;
98 static INT lastfree = -1;
101 #define INIT_CACHE_SIZE 10
103 static int antialias = 1;
105 /* some default values just in case */
106 #ifndef SONAME_LIBX11
107 #define SONAME_LIBX11 "libX11.so"
109 #ifndef SONAME_LIBXEXT
110 #define SONAME_LIBXEXT "libXext.so"
112 #ifndef SONAME_LIBXRENDER
113 #define SONAME_LIBXRENDER "libXrender.so"
116 static void *xrender_handle;
118 #define MAKE_FUNCPTR(f) static typeof(f) * p##f;
119 MAKE_FUNCPTR(XRenderAddGlyphs)
120 MAKE_FUNCPTR(XRenderComposite)
121 MAKE_FUNCPTR(XRenderCompositeString8)
122 MAKE_FUNCPTR(XRenderCompositeString16)
123 MAKE_FUNCPTR(XRenderCompositeString32)
124 MAKE_FUNCPTR(XRenderCreateGlyphSet)
125 MAKE_FUNCPTR(XRenderCreatePicture)
126 MAKE_FUNCPTR(XRenderFillRectangle)
127 MAKE_FUNCPTR(XRenderFindFormat)
128 MAKE_FUNCPTR(XRenderFindStandardFormat)
129 MAKE_FUNCPTR(XRenderFindVisualFormat)
130 MAKE_FUNCPTR(XRenderFreeGlyphSet)
131 MAKE_FUNCPTR(XRenderFreePicture)
132 MAKE_FUNCPTR(XRenderSetPictureClipRectangles)
133 #ifdef HAVE_XRENDERSETPICTURETRANSFORM
134 MAKE_FUNCPTR(XRenderSetPictureTransform)
136 MAKE_FUNCPTR(XRenderQueryExtension)
139 static CRITICAL_SECTION xrender_cs;
140 static CRITICAL_SECTION_DEBUG critsect_debug =
143 { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
144 0, 0, { 0, (DWORD)(__FILE__ ": xrender_cs") }
146 static CRITICAL_SECTION xrender_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
149 /***********************************************************************
150 * X11DRV_XRender_Init
152 * Let's see if our XServer has the extension available
155 void X11DRV_XRender_Init(void)
157 int error_base, event_base, i;
158 XRenderPictFormat pf;
160 if (client_side_with_render &&
161 wine_dlopen(SONAME_LIBX11, RTLD_NOW|RTLD_GLOBAL, NULL, 0) &&
162 wine_dlopen(SONAME_LIBXEXT, RTLD_NOW|RTLD_GLOBAL, NULL, 0) &&
163 (xrender_handle = wine_dlopen(SONAME_LIBXRENDER, RTLD_NOW, NULL, 0)))
166 #define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(xrender_handle, #f, NULL, 0)) == NULL) goto sym_not_found;
167 LOAD_FUNCPTR(XRenderAddGlyphs)
168 LOAD_FUNCPTR(XRenderComposite)
169 LOAD_FUNCPTR(XRenderCompositeString8)
170 LOAD_FUNCPTR(XRenderCompositeString16)
171 LOAD_FUNCPTR(XRenderCompositeString32)
172 LOAD_FUNCPTR(XRenderCreateGlyphSet)
173 LOAD_FUNCPTR(XRenderCreatePicture)
174 LOAD_FUNCPTR(XRenderFillRectangle)
175 LOAD_FUNCPTR(XRenderFindFormat)
176 LOAD_FUNCPTR(XRenderFindStandardFormat)
177 LOAD_FUNCPTR(XRenderFindVisualFormat)
178 LOAD_FUNCPTR(XRenderFreeGlyphSet)
179 LOAD_FUNCPTR(XRenderFreePicture)
180 LOAD_FUNCPTR(XRenderSetPictureClipRectangles)
181 LOAD_FUNCPTR(XRenderQueryExtension)
183 #ifdef HAVE_XRENDERSETPICTURETRANSFORM
184 #define LOAD_OPTIONAL_FUNCPTR(f) p##f = wine_dlsym(xrender_handle, #f, NULL, 0);
185 LOAD_OPTIONAL_FUNCPTR(XRenderSetPictureTransform)
186 #undef LOAD_OPTIONAL_FUNCPTR
191 if(pXRenderQueryExtension(gdi_display, &event_base, &error_base)) {
192 X11DRV_XRender_Installed = TRUE;
193 TRACE("Xrender is up and running error_base = %d\n", error_base);
194 screen_format = pXRenderFindVisualFormat(gdi_display, visual);
195 if(!screen_format) { /* This fails in buggy versions of libXrender.so */
198 "Wine has detected that you probably have a buggy version\n"
199 "of libXrender.so . Because of this client side font rendering\n"
200 "will be disabled. Please upgrade this library.\n");
201 X11DRV_XRender_Installed = FALSE;
204 pf.type = PictTypeDirect;
207 pf.direct.alphaMask = 1;
208 mono_format = pXRenderFindFormat(gdi_display, PictFormatType |
209 PictFormatDepth | PictFormatAlpha |
210 PictFormatAlphaMask, &pf, 0);
212 ERR("mono_format == NULL?\n");
213 X11DRV_XRender_Installed = FALSE;
220 if(X11DRV_XRender_Installed || client_side_with_core)
222 glyphsetCache = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
223 sizeof(*glyphsetCache) * INIT_CACHE_SIZE);
225 glyphsetCacheSize = INIT_CACHE_SIZE;
227 for(i = 0; i < INIT_CACHE_SIZE; i++) {
228 glyphsetCache[i].next = i + 1;
229 glyphsetCache[i].count = -1;
231 glyphsetCache[i-1].next = -1;
232 using_client_side_fonts = 1;
234 if(!X11DRV_XRender_Installed) {
235 TRACE("Xrender is not available on your XServer, client side rendering with the core protocol instead.\n");
236 if(screen_depth <= 8 || !client_side_antialias_with_core)
239 if(screen_depth <= 8 || !client_side_antialias_with_render)
243 else TRACE("Using X11 core fonts\n");
246 static BOOL fontcmp(LFANDSIZE *p1, LFANDSIZE *p2)
248 if(p1->hash != p2->hash) return TRUE;
249 if(memcmp(&p1->devsize, &p2->devsize, sizeof(p1->devsize))) return TRUE;
250 if(memcmp(&p1->lf, &p2->lf, offsetof(LOGFONTW, lfFaceName))) return TRUE;
251 return strcmpW(p1->lf.lfFaceName, p2->lf.lfFaceName);
255 static void walk_cache(void)
259 EnterCriticalSection(&xrender_cs);
260 for(i=mru; i >= 0; i = glyphsetCache[i].next)
261 TRACE("item %d\n", i);
262 LeaveCriticalSection(&xrender_cs);
266 static int LookupEntry(LFANDSIZE *plfsz)
270 for(i = mru; i >= 0; i = glyphsetCache[i].next) {
272 if(glyphsetCache[i].count == -1) { /* reached free list so stop */
277 if(!fontcmp(&glyphsetCache[i].lfsz, plfsz)) {
278 glyphsetCache[i].count++;
280 glyphsetCache[prev_i].next = glyphsetCache[i].next;
281 glyphsetCache[i].next = mru;
284 TRACE("found font in cache %d\n", i);
289 TRACE("font not in cache\n");
293 static void FreeEntry(int entry)
297 if(glyphsetCache[entry].glyphset) {
299 pXRenderFreeGlyphSet(gdi_display, glyphsetCache[entry].glyphset);
301 glyphsetCache[entry].glyphset = 0;
303 if(glyphsetCache[entry].nrealized) {
304 HeapFree(GetProcessHeap(), 0, glyphsetCache[entry].realized);
305 glyphsetCache[entry].realized = NULL;
306 if(glyphsetCache[entry].bitmaps) {
307 for(i = 0; i < glyphsetCache[entry].nrealized; i++)
308 if(glyphsetCache[entry].bitmaps[i])
309 HeapFree(GetProcessHeap(), 0, glyphsetCache[entry].bitmaps[i]);
310 HeapFree(GetProcessHeap(), 0, glyphsetCache[entry].bitmaps);
311 glyphsetCache[entry].bitmaps = NULL;
312 HeapFree(GetProcessHeap(), 0, glyphsetCache[entry].gis);
313 glyphsetCache[entry].gis = NULL;
315 glyphsetCache[entry].nrealized = 0;
319 static int AllocEntry(void)
321 int best = -1, prev_best = -1, i, prev_i = -1;
324 assert(glyphsetCache[lastfree].count == -1);
325 glyphsetCache[lastfree].count = 1;
327 lastfree = glyphsetCache[lastfree].next;
329 glyphsetCache[best].next = mru;
332 TRACE("empty space at %d, next lastfree = %d\n", mru, lastfree);
336 for(i = mru; i >= 0; i = glyphsetCache[i].next) {
337 if(glyphsetCache[i].count == 0) {
345 TRACE("freeing unused glyphset at cache %d\n", best);
347 glyphsetCache[best].count = 1;
349 glyphsetCache[prev_best].next = glyphsetCache[best].next;
350 glyphsetCache[best].next = mru;
358 TRACE("Growing cache\n");
361 glyphsetCache = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
363 (glyphsetCacheSize + INIT_CACHE_SIZE)
364 * sizeof(*glyphsetCache));
366 glyphsetCache = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
367 (glyphsetCacheSize + INIT_CACHE_SIZE)
368 * sizeof(*glyphsetCache));
370 for(best = i = glyphsetCacheSize; i < glyphsetCacheSize + INIT_CACHE_SIZE;
372 glyphsetCache[i].next = i + 1;
373 glyphsetCache[i].count = -1;
375 glyphsetCache[i-1].next = -1;
376 glyphsetCacheSize += INIT_CACHE_SIZE;
378 lastfree = glyphsetCache[best].next;
379 glyphsetCache[best].count = 1;
380 glyphsetCache[best].next = mru;
382 TRACE("new free cache slot at %d\n", mru);
386 static int GetCacheEntry(LFANDSIZE *plfsz)
391 if((ret = LookupEntry(plfsz)) != -1) return ret;
394 entry = glyphsetCache + ret;
395 entry->lfsz = *plfsz;
396 assert(entry->nrealized == 0);
403 entry->font_format = NULL;
408 static void dec_ref_cache(int index)
411 TRACE("dec'ing entry %d to %d\n", index, glyphsetCache[index].count - 1);
412 assert(glyphsetCache[index].count > 0);
413 glyphsetCache[index].count--;
416 static void lfsz_calc_hash(LFANDSIZE *plfsz)
418 DWORD hash = 0, *ptr;
421 hash ^= plfsz->devsize.cx;
422 hash ^= plfsz->devsize.cy;
423 for(i = 0, ptr = (DWORD*)&plfsz->lf; i < 7; i++, ptr++)
425 for(i = 0, ptr = (DWORD*)&plfsz->lf.lfFaceName; i < LF_FACESIZE/2; i++, ptr++) {
426 WCHAR *pwc = (WCHAR *)ptr;
436 /***********************************************************************
437 * X11DRV_XRender_Finalize
439 void X11DRV_XRender_Finalize(void)
443 EnterCriticalSection(&xrender_cs);
444 for(i = mru; i >= 0; i = glyphsetCache[i].next)
446 LeaveCriticalSection(&xrender_cs);
450 /***********************************************************************
451 * X11DRV_XRender_SelectFont
453 BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE *physDev, HFONT hfont)
457 GetObjectW(hfont, sizeof(lfsz.lf), &lfsz.lf);
458 TRACE("h=%ld w=%ld weight=%ld it=%d charset=%d name=%s\n",
459 lfsz.lf.lfHeight, lfsz.lf.lfWidth, lfsz.lf.lfWeight,
460 lfsz.lf.lfItalic, lfsz.lf.lfCharSet, debugstr_w(lfsz.lf.lfFaceName));
461 lfsz.devsize.cx = X11DRV_XWStoDS( physDev, lfsz.lf.lfWidth );
462 lfsz.devsize.cy = X11DRV_YWStoDS( physDev, lfsz.lf.lfHeight );
463 lfsz_calc_hash(&lfsz);
465 EnterCriticalSection(&xrender_cs);
466 if(!physDev->xrender) {
467 physDev->xrender = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
468 sizeof(*physDev->xrender));
469 physDev->xrender->cache_index = -1;
471 else if(physDev->xrender->cache_index != -1)
472 dec_ref_cache(physDev->xrender->cache_index);
473 physDev->xrender->cache_index = GetCacheEntry(&lfsz);
474 LeaveCriticalSection(&xrender_cs);
478 /***********************************************************************
479 * X11DRV_XRender_DeleteDC
481 void X11DRV_XRender_DeleteDC(X11DRV_PDEVICE *physDev)
484 if(physDev->xrender->tile_pict)
485 pXRenderFreePicture(gdi_display, physDev->xrender->tile_pict);
487 if(physDev->xrender->tile_xpm)
488 XFreePixmap(gdi_display, physDev->xrender->tile_xpm);
490 if(physDev->xrender->pict) {
491 TRACE("freeing pict = %lx dc = %p\n", physDev->xrender->pict, physDev->hdc);
492 pXRenderFreePicture(gdi_display, physDev->xrender->pict);
496 EnterCriticalSection(&xrender_cs);
497 if(physDev->xrender->cache_index != -1)
498 dec_ref_cache(physDev->xrender->cache_index);
499 LeaveCriticalSection(&xrender_cs);
501 HeapFree(GetProcessHeap(), 0, physDev->xrender);
502 physDev->xrender = NULL;
506 /***********************************************************************
507 * X11DRV_XRender_UpdateDrawable
509 * This gets called from X11DRV_SetDrawable and X11DRV_SelectBitmap.
510 * It deletes the pict when the drawable changes.
512 void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev)
514 if(physDev->xrender->pict) {
515 TRACE("freeing pict %08lx from dc %p drawable %08lx\n", physDev->xrender->pict,
516 physDev->hdc, physDev->drawable);
519 pXRenderFreePicture(gdi_display, physDev->xrender->pict);
522 physDev->xrender->pict = 0;
526 /************************************************************************
529 * Helper to ExtTextOut. Must be called inside xrender_cs
531 static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph)
538 gsCacheEntry *entry = glyphsetCache + physDev->xrender->cache_index;
539 UINT ggo_format = GGO_GLYPH_INDEX;
540 XRenderPictFormat pf;
542 if(entry->nrealized <= glyph) {
543 entry->nrealized = (glyph / 128 + 1) * 128;
546 entry->realized = HeapReAlloc(GetProcessHeap(),
549 entry->nrealized * sizeof(BOOL));
551 entry->realized = HeapAlloc(GetProcessHeap(),
553 entry->nrealized * sizeof(BOOL));
555 if(!X11DRV_XRender_Installed) {
557 entry->bitmaps = HeapReAlloc(GetProcessHeap(),
560 entry->nrealized * sizeof(entry->bitmaps[0]));
562 entry->bitmaps = HeapAlloc(GetProcessHeap(),
564 entry->nrealized * sizeof(entry->bitmaps[0]));
567 entry->gis = HeapReAlloc(GetProcessHeap(),
570 entry->nrealized * sizeof(entry->gis[0]));
572 entry->gis = HeapAlloc(GetProcessHeap(),
574 entry->nrealized * sizeof(entry->gis[0]));
580 ggo_format |= WINE_GGO_GRAY16_BITMAP;
584 ERR("aa = %d - not implemented\n", entry->aa);
586 ggo_format |= GGO_BITMAP;
590 buflen = GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, 0, NULL,
592 if(buflen == GDI_ERROR) {
593 if(entry->aa != AA_None) {
595 ggo_format &= ~WINE_GGO_GRAY16_BITMAP;
596 ggo_format |= GGO_BITMAP;
597 buflen = GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, 0, NULL,
600 if(buflen == GDI_ERROR) {
601 ERR("GetGlyphOutlineW failed\n");
604 TRACE("Turning off antialiasing for this monochrome font\n");
607 if(entry->glyphset == 0 && X11DRV_XRender_Installed) {
611 pf.direct.alphaMask = 0xff;
615 ERR("aa = %d - not implemented\n", entry->aa);
618 pf.direct.alphaMask = 1;
622 pf.type = PictTypeDirect;
626 entry->font_format = pXRenderFindFormat(gdi_display,
633 entry->glyphset = pXRenderCreateGlyphSet(gdi_display, entry->font_format);
638 buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen);
639 GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, buflen, buf, NULL);
640 entry->realized[glyph] = TRUE;
642 TRACE("buflen = %d. Got metrics: %dx%d adv=%d,%d origin=%ld,%ld\n",
644 gm.gmBlackBoxX, gm.gmBlackBoxY, gm.gmCellIncX, gm.gmCellIncY,
645 gm.gmptGlyphOrigin.x, gm.gmptGlyphOrigin.y);
647 gi.width = gm.gmBlackBoxX;
648 gi.height = gm.gmBlackBoxY;
649 gi.x = -gm.gmptGlyphOrigin.x;
650 gi.y = gm.gmptGlyphOrigin.y;
651 gi.xOff = gm.gmCellIncX;
652 gi.yOff = gm.gmCellIncY;
654 if(TRACE_ON(xrender)) {
659 if(entry->aa == AA_None) {
660 pitch = ((gi.width + 31) / 32) * 4;
661 for(i = 0; i < gi.height; i++) {
662 line = buf + i * pitch;
664 for(j = 0; j < pitch * 8; j++) {
665 strcat(output, (line[j / 8] & (1 << (7 - (j % 8)))) ? "#" : " ");
667 strcat(output, "\n");
671 static const char blks[] = " .:;!o*#";
675 pitch = ((gi.width + 3) / 4) * 4;
676 for(i = 0; i < gi.height; i++) {
677 line = buf + i * pitch;
679 for(j = 0; j < pitch; j++) {
680 str[0] = blks[line[j] >> 5];
683 strcat(output, "\n");
689 if(entry->glyphset) {
690 if(entry->aa == AA_None && BitmapBitOrder(gdi_display) != MSBFirst) {
691 unsigned char *byte = buf, c;
697 /* magic to flip bit order */
698 c = ((c << 1) & 0xaa) | ((c >> 1) & 0x55);
699 c = ((c << 2) & 0xcc) | ((c >> 2) & 0x33);
700 c = ((c << 4) & 0xf0) | ((c >> 4) & 0x0f);
707 pXRenderAddGlyphs(gdi_display, entry->glyphset, &gid, &gi, 1,
710 HeapFree(GetProcessHeap(), 0, buf);
712 entry->bitmaps[glyph] = buf;
713 memcpy(&entry->gis[glyph], &gi, sizeof(gi));
718 static void SharpGlyphMono(X11DRV_PDEVICE *physDev, INT x, INT y,
719 void *bitmap, XGlyphInfo *gi)
721 unsigned char *srcLine = bitmap, *src;
722 unsigned char bits, bitsMask;
723 int width = gi->width;
724 int stride = ((width + 31) & ~31) >> 3;
725 int height = gi->height;
729 TRACE("%d, %d\n", x, y);
738 bitsMask = 0x80; /* FreeType is always MSB first */
752 bitsMask = bitsMask >> 1;
758 } while (bits & bitsMask);
759 XFillRectangle (gdi_display, physDev->drawable,
760 physDev->gc, xspan, y, lenspan, 1);
772 bitsMask = bitsMask >> 1;
778 } while (!(bits & bitsMask));
785 static void SharpGlyphGray(X11DRV_PDEVICE *physDev, INT x, INT y,
786 void *bitmap, XGlyphInfo *gi)
788 unsigned char *srcLine = bitmap, *src, bits;
789 int width = gi->width;
790 int stride = ((width + 3) & ~3);
791 int height = gi->height;
816 } while (bits >= 0x80);
817 XFillRectangle (gdi_display, physDev->drawable,
818 physDev->gc, xspan, y, lenspan, 1);
831 } while (bits < 0x80);
839 static void ExamineBitfield (DWORD mask, int *shift, int *len)
844 while ((mask & 1) == 0)
850 while ((mask & 1) == 1)
859 static DWORD GetField (DWORD pixel, int shift, int len)
861 pixel = pixel & (((1 << (len)) - 1) << shift);
862 pixel = pixel << (32 - (shift + len)) >> 24;
865 pixel |= (pixel >> len);
872 static DWORD PutField (DWORD pixel, int shift, int len)
874 shift = shift - (8 - len);
876 pixel &= (((1 << len) - 1) << (8 - len));
884 static void SmoothGlyphGray(XImage *image, int x, int y, void *bitmap, XGlyphInfo *gi,
890 BYTE *maskLine, *mask, m;
895 BYTE src_r, src_g, src_b;
897 src_r = GetRValue(color);
898 src_g = GetGValue(color);
899 src_b = GetBValue(color);
906 maskLine = (unsigned char *) bitmap;
907 maskStride = (width + 3) & ~3;
909 ExamineBitfield (image->red_mask, &r_shift, &r_len);
910 ExamineBitfield (image->green_mask, &g_shift, &g_len);
911 ExamineBitfield (image->blue_mask, &b_shift, &b_len);
915 maskLine += maskStride;
920 if(y >= image->height) break;
924 if(tx >= image->width) break;
931 pixel = (PutField ((src_r), r_shift, r_len) |
932 PutField ((src_g), g_shift, g_len) |
933 PutField ((src_b), b_shift, b_len));
934 XPutPixel (image, tx, y, pixel);
940 pixel = XGetPixel (image, tx, y);
942 r = GetField(pixel, r_shift, r_len);
943 r = ((BYTE)~m * (WORD)r + (BYTE)m * (WORD)src_r) >> 8;
944 g = GetField(pixel, g_shift, g_len);
945 g = ((BYTE)~m * (WORD)g + (BYTE)m * (WORD)src_g) >> 8;
946 b = GetField(pixel, b_shift, b_len);
947 b = ((BYTE)~m * (WORD)b + (BYTE)m * (WORD)src_b) >> 8;
949 pixel = (PutField (r, r_shift, r_len) |
950 PutField (g, g_shift, g_len) |
951 PutField (b, b_shift, b_len));
952 XPutPixel (image, tx, y, pixel);
958 static int XRenderErrorHandler(Display *dpy, XErrorEvent *event, void *arg)
963 /***********************************************************************
964 * X11DRV_XRender_ExtTextOut
966 BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
967 const RECT *lprect, LPCWSTR wstr, UINT count,
968 const INT *lpDx, INT breakExtra )
976 BOOL done_extents = FALSE;
977 INT width, xwidth, ywidth;
978 double cosEsc, sinEsc;
981 int render_op = PictOpOver;
986 HDC hdc = physDev->hdc;
987 int textPixel, backgroundPixel;
990 HRGN saved_region = 0;
991 UINT align = GetTextAlign( hdc );
992 COLORREF textColor = GetTextColor( hdc );
994 TRACE("%p, %d, %d, %08x, %p, %s, %d, %p)\n", hdc, x, y, flags,
995 lprect, debugstr_wn(wstr, count), count, lpDx);
997 if(flags & ETO_GLYPH_INDEX)
998 glyphs = (LPWORD)wstr;
1000 glyphs = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WCHAR));
1001 GetGlyphIndicesW(hdc, wstr, count, glyphs, 0);
1005 TRACE("rect: %ld,%ld - %ld,%ld\n", lprect->left, lprect->top, lprect->right,
1007 TRACE("align = %x bkmode = %x mapmode = %x\n", align, GetBkMode(hdc), GetMapMode(hdc));
1009 if(align & TA_UPDATECP)
1011 GetCurrentPositionEx( hdc, &pt );
1016 GetTextMetricsW(hdc, &tm);
1017 GetObjectW(GetCurrentObject(hdc, OBJ_FONT), sizeof(lf), &lf);
1019 if(!(tm.tmPitchAndFamily & TMPF_VECTOR)) /* Non-scalable fonts shouldn't be rotated */
1020 lf.lfEscapement = 0;
1022 if(lf.lfEscapement != 0) {
1023 cosEsc = cos(lf.lfEscapement * M_PI / 1800);
1024 sinEsc = sin(lf.lfEscapement * M_PI / 1800);
1030 if(flags & (ETO_CLIPPED | ETO_OPAQUE)) {
1032 if(flags & ETO_CLIPPED) return FALSE;
1033 GetTextExtentPointI(hdc, glyphs, count, &sz);
1034 done_extents = TRUE;
1037 rc.right = x + sz.cx;
1038 rc.bottom = y + sz.cy;
1043 LPtoDP(hdc, (POINT*)&rc, 2);
1045 if(rc.left > rc.right) {INT tmp = rc.left; rc.left = rc.right; rc.right = tmp;}
1046 if(rc.top > rc.bottom) {INT tmp = rc.top; rc.top = rc.bottom; rc.bottom = tmp;}
1049 xgcval.function = GXcopy;
1050 xgcval.background = physDev->backgroundPixel;
1051 xgcval.fill_style = FillSolid;
1053 XChangeGC( gdi_display, physDev->gc, GCFunction | GCBackground | GCFillStyle, &xgcval );
1054 wine_tsx11_unlock();
1056 X11DRV_LockDIBSection( physDev, DIB_Status_GdiMod, FALSE );
1058 if(physDev->depth == 1) {
1059 if((textColor & 0xffffff) == 0) {
1061 backgroundPixel = 1;
1064 backgroundPixel = 0;
1067 textPixel = physDev->textPixel;
1068 backgroundPixel = physDev->backgroundPixel;
1071 if(flags & ETO_OPAQUE) {
1073 XSetForeground( gdi_display, physDev->gc, backgroundPixel );
1074 XFillRectangle( gdi_display, physDev->drawable, physDev->gc,
1075 physDev->org.x + rc.left, physDev->org.y + rc.top,
1076 rc.right - rc.left, rc.bottom - rc.top );
1077 wine_tsx11_unlock();
1087 LPtoDP(hdc, &pt, 1);
1091 TRACE("real x,y %d,%d\n", x, y);
1093 if((char_extra = GetTextCharacterExtra(hdc)) != 0) {
1096 deltas = HeapAlloc(GetProcessHeap(), 0, count * sizeof(INT));
1097 for(i = 0; i < count; i++) {
1099 deltas[i] = lpDx[i] + char_extra;
1101 GetTextExtentPointI(hdc, glyphs + i, 1, &tmpsz);
1102 deltas[i] = tmpsz.cx;
1106 deltas = (INT*)lpDx;
1110 for(idx = 0; idx < count; idx++)
1111 width += deltas[idx];
1114 GetTextExtentPointI(hdc, glyphs, count, &sz);
1115 done_extents = TRUE;
1119 width = X11DRV_XWStoDS(physDev, width);
1120 xwidth = width * cosEsc;
1121 ywidth = width * sinEsc;
1123 tm.tmAscent = abs(X11DRV_YWStoDS(physDev, tm.tmAscent));
1124 tm.tmDescent = abs(X11DRV_YWStoDS(physDev, tm.tmDescent));
1125 switch( align & (TA_LEFT | TA_RIGHT | TA_CENTER) ) {
1127 if (align & TA_UPDATECP) {
1130 DPtoLP(hdc, &pt, 1);
1131 MoveToEx(hdc, pt.x, pt.y, NULL);
1143 if (align & TA_UPDATECP) {
1146 DPtoLP(hdc, &pt, 1);
1147 MoveToEx(hdc, pt.x, pt.y, NULL);
1152 switch( align & (TA_TOP | TA_BOTTOM | TA_BASELINE) ) {
1154 y += tm.tmAscent * cosEsc;
1155 x += tm.tmAscent * sinEsc;
1159 y -= tm.tmDescent * cosEsc;
1160 x -= tm.tmDescent * sinEsc;
1167 if (flags & ETO_CLIPPED)
1170 RECT clip_rect = *lprect;
1172 LPtoDP( hdc, (POINT *)&clip_rect, 2 );
1173 clip_region = CreateRectRgnIndirect( &clip_rect );
1174 /* make a copy of the current device region */
1175 saved_region = CreateRectRgn( 0, 0, 0, 0 );
1176 CombineRgn( saved_region, physDev->region, 0, RGN_COPY );
1177 X11DRV_SetDeviceClipping( physDev, saved_region, clip_region );
1178 DeleteObject( clip_region );
1181 if(X11DRV_XRender_Installed) {
1182 if(!physDev->xrender->pict) {
1183 XRenderPictureAttributes pa;
1184 pa.subwindow_mode = IncludeInferiors;
1187 physDev->xrender->pict = pXRenderCreatePicture(gdi_display,
1189 (physDev->depth == 1) ?
1190 mono_format : screen_format,
1191 CPSubwindowMode, &pa);
1192 wine_tsx11_unlock();
1194 TRACE("allocing pict = %lx dc = %p drawable = %08lx\n",
1195 physDev->xrender->pict, hdc, physDev->drawable);
1197 TRACE("using existing pict = %lx dc = %p drawable = %08lx\n",
1198 physDev->xrender->pict, hdc, physDev->drawable);
1201 if ((data = X11DRV_GetRegionData( physDev->region, 0 )))
1204 pXRenderSetPictureClipRectangles( gdi_display, physDev->xrender->pict,
1205 physDev->org.x, physDev->org.y,
1206 (XRectangle *)data->Buffer, data->rdh.nCount );
1207 wine_tsx11_unlock();
1208 HeapFree( GetProcessHeap(), 0, data );
1212 if(GetBkMode(hdc) != TRANSPARENT) {
1213 if(!((flags & ETO_CLIPPED) && (flags & ETO_OPAQUE))) {
1214 if(!(flags & ETO_OPAQUE) || x < rc.left || x + width >= rc.right ||
1215 y - tm.tmAscent < rc.top || y + tm.tmDescent >= rc.bottom) {
1217 XSetForeground( gdi_display, physDev->gc, backgroundPixel );
1218 XFillRectangle( gdi_display, physDev->drawable, physDev->gc,
1219 physDev->org.x + x, physDev->org.y + y - tm.tmAscent,
1220 width, tm.tmAscent + tm.tmDescent );
1221 wine_tsx11_unlock();
1226 if(X11DRV_XRender_Installed) {
1227 /* Create a 1x1 pixmap to tile over the font mask */
1228 if(!physDev->xrender->tile_xpm) {
1229 XRenderPictureAttributes pa;
1231 XRenderPictFormat *format = (physDev->depth == 1) ? mono_format : screen_format;
1233 physDev->xrender->tile_xpm = XCreatePixmap(gdi_display,
1238 physDev->xrender->tile_pict = pXRenderCreatePicture(gdi_display,
1239 physDev->xrender->tile_xpm,
1242 wine_tsx11_unlock();
1243 TRACE("Created pixmap of depth %d\n", format->depth);
1244 /* init lastTextColor to something different from textColor */
1245 physDev->xrender->lastTextColor = ~textColor;
1249 if(textColor != physDev->xrender->lastTextColor) {
1250 if(physDev->depth != 1) {
1251 /* Map 0 -- 0xff onto 0 -- 0xffff */
1252 col.red = GetRValue(textColor);
1253 col.red |= col.red << 8;
1254 col.green = GetGValue(textColor);
1255 col.green |= col.green << 8;
1256 col.blue = GetBValue(textColor);
1257 col.blue |= col.blue << 8;
1259 } else { /* for a 1bpp bitmap we always need a 1 in the tile */
1260 col.red = col.green = col.blue = 0;
1264 pXRenderFillRectangle(gdi_display, PictOpSrc,
1265 physDev->xrender->tile_pict,
1267 wine_tsx11_unlock();
1268 physDev->xrender->lastTextColor = textColor;
1271 /* FIXME the mapping of Text/BkColor onto 1 or 0 needs investigation.
1273 if((physDev->depth == 1) && (textPixel == 0))
1274 render_op = PictOpOutReverse; /* This gives us 'black' text */
1277 EnterCriticalSection(&xrender_cs);
1278 entry = glyphsetCache + physDev->xrender->cache_index;
1280 for(idx = 0; idx < count; idx++) {
1281 if(glyphs[idx] >= entry->nrealized || entry->realized[glyphs[idx]] == FALSE) {
1282 UploadGlyph(physDev, glyphs[idx]);
1287 TRACE("Writing %s at %ld,%ld\n", debugstr_wn(wstr,count),
1288 physDev->org.x + x, physDev->org.y + y);
1290 if(X11DRV_XRender_Installed) {
1293 pXRenderCompositeString16(gdi_display, render_op,
1294 physDev->xrender->tile_pict,
1295 physDev->xrender->pict,
1296 entry->font_format, entry->glyphset,
1297 0, 0, physDev->org.x + x, physDev->org.y + y,
1301 INT offset = 0, xoff = 0, yoff = 0;
1302 for(idx = 0; idx < count; idx++) {
1303 pXRenderCompositeString16(gdi_display, render_op,
1304 physDev->xrender->tile_pict,
1305 physDev->xrender->pict,
1306 entry->font_format, entry->glyphset,
1307 0, 0, physDev->org.x + x + xoff,
1308 physDev->org.y + y + yoff,
1310 offset += X11DRV_XWStoDS(physDev, deltas[idx]);
1311 xoff = offset * cosEsc;
1312 yoff = offset * -sinEsc;
1315 wine_tsx11_unlock();
1318 INT offset = 0, xoff = 0, yoff = 0;
1320 XSetForeground( gdi_display, physDev->gc, textPixel );
1322 if(entry->aa == AA_None) {
1323 for(idx = 0; idx < count; idx++) {
1324 SharpGlyphMono(physDev, physDev->org.x + x + xoff,
1325 physDev->org.y + y + yoff,
1326 entry->bitmaps[glyphs[idx]],
1327 &entry->gis[glyphs[idx]]);
1329 offset += X11DRV_XWStoDS(physDev, deltas[idx]);
1330 xoff = offset * cosEsc;
1331 yoff = offset * -sinEsc;
1334 xoff += entry->gis[glyphs[idx]].xOff;
1335 yoff += entry->gis[glyphs[idx]].yOff;
1338 } else if(physDev->depth == 1) {
1339 for(idx = 0; idx < count; idx++) {
1340 SharpGlyphGray(physDev, physDev->org.x + x + xoff,
1341 physDev->org.y + y + yoff,
1342 entry->bitmaps[glyphs[idx]],
1343 &entry->gis[glyphs[idx]]);
1345 offset += X11DRV_XWStoDS(physDev, deltas[idx]);
1346 xoff = offset * cosEsc;
1347 yoff = offset * -sinEsc;
1350 xoff += entry->gis[glyphs[idx]].xOff;
1351 yoff += entry->gis[glyphs[idx]].yOff;
1357 unsigned int w, h, dummy_uint;
1358 Window dummy_window;
1360 int image_x, image_y, image_off_x, image_off_y, image_w, image_h;
1361 RECT extents = {0, 0, 0, 0};
1365 XGetGeometry(gdi_display, physDev->drawable, &dummy_window, &dummy_int, &dummy_int,
1366 &w, &h, &dummy_uint, &dummy_uint);
1367 TRACE("drawable %dx%d\n", w, h);
1369 for(idx = 0; idx < count; idx++) {
1370 if(extents.left > cur.x - entry->gis[glyphs[idx]].x)
1371 extents.left = cur.x - entry->gis[glyphs[idx]].x;
1372 if(extents.top > cur.y - entry->gis[glyphs[idx]].y)
1373 extents.top = cur.y - entry->gis[glyphs[idx]].y;
1374 if(extents.right < cur.x - entry->gis[glyphs[idx]].x + entry->gis[glyphs[idx]].width)
1375 extents.right = cur.x - entry->gis[glyphs[idx]].x + entry->gis[glyphs[idx]].width;
1376 if(extents.bottom < cur.y - entry->gis[glyphs[idx]].y + entry->gis[glyphs[idx]].height)
1377 extents.bottom = cur.y - entry->gis[glyphs[idx]].y + entry->gis[glyphs[idx]].height;
1379 offset += X11DRV_XWStoDS(physDev, deltas[idx]);
1380 cur.x = offset * cosEsc;
1381 cur.y = offset * -sinEsc;
1383 cur.x += entry->gis[glyphs[idx]].xOff;
1384 cur.y += entry->gis[glyphs[idx]].yOff;
1387 TRACE("glyph extents %ld,%ld - %ld,%ld drawable x,y %ld,%ld\n", extents.left, extents.top,
1388 extents.right, extents.bottom, physDev->org.x + x, physDev->org.y + y);
1390 if(physDev->org.x + x + extents.left >= 0) {
1391 image_x = physDev->org.x + x + extents.left;
1395 image_off_x = physDev->org.x + x + extents.left;
1397 if(physDev->org.y + y + extents.top >= 0) {
1398 image_y = physDev->org.y + y + extents.top;
1402 image_off_y = physDev->org.y + y + extents.top;
1404 if(physDev->org.x + x + extents.right < w)
1405 image_w = physDev->org.x + x + extents.right - image_x;
1407 image_w = w - image_x;
1408 if(physDev->org.y + y + extents.bottom < h)
1409 image_h = physDev->org.y + y + extents.bottom - image_y;
1411 image_h = h - image_y;
1413 if(image_w <= 0 || image_h <= 0) goto no_image;
1415 X11DRV_expect_error(gdi_display, XRenderErrorHandler, NULL);
1416 image = XGetImage(gdi_display, physDev->drawable,
1417 image_x, image_y, image_w, image_h,
1418 AllPlanes, ZPixmap);
1419 X11DRV_check_error();
1421 TRACE("XGetImage(%p, %x, %d, %d, %d, %d, %lx, %x) depth = %d rets %p\n",
1422 gdi_display, (int)physDev->drawable, image_x, image_y,
1423 image_w, image_h, AllPlanes, ZPixmap,
1424 physDev->depth, image);
1426 Pixmap xpm = XCreatePixmap(gdi_display, physDev->drawable, image_w, image_h,
1431 gcv.graphics_exposures = False;
1432 gc = XCreateGC(gdi_display, xpm, GCGraphicsExposures, &gcv);
1433 XCopyArea(gdi_display, physDev->drawable, xpm, gc, image_x, image_y,
1434 image_w, image_h, 0, 0);
1435 XFreeGC(gdi_display, gc);
1436 X11DRV_expect_error(gdi_display, XRenderErrorHandler, NULL);
1437 image = XGetImage(gdi_display, xpm, 0, 0, image_w, image_h, AllPlanes,
1439 X11DRV_check_error();
1440 XFreePixmap(gdi_display, xpm);
1442 if(!image) goto no_image;
1444 image->red_mask = visual->red_mask;
1445 image->green_mask = visual->green_mask;
1446 image->blue_mask = visual->blue_mask;
1448 offset = xoff = yoff = 0;
1449 for(idx = 0; idx < count; idx++) {
1450 SmoothGlyphGray(image, xoff + image_off_x - extents.left,
1451 yoff + image_off_y - extents.top,
1452 entry->bitmaps[glyphs[idx]],
1453 &entry->gis[glyphs[idx]],
1456 offset += X11DRV_XWStoDS(physDev, deltas[idx]);
1457 xoff = offset * cosEsc;
1458 yoff = offset * -sinEsc;
1460 xoff += entry->gis[glyphs[idx]].xOff;
1461 yoff += entry->gis[glyphs[idx]].yOff;
1465 XPutImage(gdi_display, physDev->drawable, physDev->gc, image, 0, 0,
1466 image_x, image_y, image_w, image_h);
1467 XDestroyImage(image);
1470 wine_tsx11_unlock();
1472 LeaveCriticalSection(&xrender_cs);
1474 if (lf.lfUnderline || lf.lfStrikeOut) {
1476 unsigned int lineWidth;
1477 UINT nMetricsSize = GetOutlineTextMetricsW(hdc, 0, NULL);
1478 OUTLINETEXTMETRICW* otm = HeapAlloc(GetProcessHeap(), 0, nMetricsSize);
1479 if (!otm) goto done;
1481 GetOutlineTextMetricsW(hdc, nMetricsSize, otm);
1484 XSetForeground( gdi_display, physDev->gc, physDev->textPixel );
1486 if (lf.lfUnderline) {
1487 linePos = X11DRV_YWStoDS(physDev, otm->otmsUnderscorePosition);
1488 lineWidth = X11DRV_YWStoDS(physDev, otm->otmsUnderscoreSize);
1490 XSetLineAttributes( gdi_display, physDev->gc, lineWidth,
1491 LineSolid, CapProjecting, JoinBevel );
1492 XDrawLine( gdi_display, physDev->drawable, physDev->gc,
1493 physDev->org.x + x - linePos * sinEsc,
1494 physDev->org.y + y - linePos * cosEsc,
1495 physDev->org.x + x + width * cosEsc - linePos * sinEsc,
1496 physDev->org.y + y - width * sinEsc - linePos * cosEsc );
1499 if (lf.lfStrikeOut) {
1500 linePos = X11DRV_YWStoDS(physDev, otm->otmsStrikeoutPosition);
1501 lineWidth = X11DRV_YWStoDS(physDev, otm->otmsStrikeoutSize);
1503 XSetLineAttributes( gdi_display, physDev->gc, lineWidth,
1504 LineSolid, CapProjecting, JoinBevel );
1505 XDrawLine( gdi_display, physDev->drawable, physDev->gc,
1506 physDev->org.x + x, physDev->org.y + y - linePos,
1507 physDev->org.x + x + width, physDev->org.y + y - linePos );
1509 wine_tsx11_unlock();
1510 HeapFree(GetProcessHeap(), 0, otm);
1513 if(deltas && deltas != lpDx)
1514 HeapFree(GetProcessHeap(), 0, deltas);
1516 if (flags & ETO_CLIPPED)
1518 /* restore the device region */
1519 X11DRV_SetDeviceClipping( physDev, saved_region, 0 );
1520 DeleteObject( saved_region );
1526 X11DRV_UnlockDIBSection( physDev, TRUE );
1527 if(glyphs != wstr) HeapFree(GetProcessHeap(), 0, glyphs);
1531 BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst, INT heightDst,
1532 X11DRV_PDEVICE *devSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc,
1533 BLENDFUNCTION blendfn)
1535 XRenderPictureAttributes pa;
1536 XRenderPictFormat *src_format;
1537 Picture dst_pict, src_pict;
1544 char *dstbits, *data;
1547 BOOL top_down = FALSE;
1549 if(!X11DRV_XRender_Installed) {
1550 FIXME("Unable to AlphaBlend without Xrender\n");
1555 pts[1].x = xDst + widthDst;
1556 pts[1].y = yDst + heightDst;
1557 LPtoDP(devDst->hdc, pts, 2);
1560 widthDst = pts[1].x - pts[0].x;
1561 heightDst = pts[1].y - pts[0].y;
1565 pts[1].x = xSrc + widthSrc;
1566 pts[1].y = ySrc + heightSrc;
1567 LPtoDP(devSrc->hdc, pts, 2);
1570 widthSrc = pts[1].x - pts[0].x;
1571 heightSrc = pts[1].y - pts[0].y;
1573 #ifndef HAVE_XRENDERSETPICTURETRANSFORM
1574 if(widthDst != widthSrc || heightDst != heightSrc)
1576 if(!pXRenderSetPictureTransform)
1579 FIXME("Unable to Stretch, XRenderSetPictureTransform is currently required\n");
1583 hBitmap = GetCurrentObject( devSrc->hdc, OBJ_BITMAP );
1584 bmp = (BITMAPOBJ *)GDI_GetObjPtr( hBitmap, BITMAP_MAGIC );
1585 if(!bmp || !bmp->dib) {
1586 FIXME("not a dibsection\n");
1587 GDI_ReleaseObj( hBitmap );
1591 if(bmp->dib->dsBm.bmBitsPixel != 32) {
1592 FIXME("not a 32 bpp dibsection\n");
1593 GDI_ReleaseObj( hBitmap );
1596 dstbits = data = HeapAlloc(GetProcessHeap(), 0, heightSrc * widthSrc * 4);
1598 if(bmp->dib->dsBmih.biHeight < 0) { /* top-down dib */
1600 dstbits += widthSrc * (heightSrc - 1) * 4;
1602 for(y = ySrc + heightSrc - 1; y >= ySrc; y--) {
1603 memcpy(dstbits, (char *)bmp->dib->dsBm.bmBits + y * bmp->dib->dsBm.bmWidthBytes + xSrc * 4,
1605 dstbits += (top_down ? -1 : 1) * widthSrc * 4;
1609 image = XCreateImage(gdi_display, visual, 32, ZPixmap, 0,
1610 data, widthSrc, heightSrc, 32, widthSrc * 4);
1612 src_format = pXRenderFindStandardFormat(gdi_display, PictStandardARGB32);
1615 TRACE("src_format %p\n", src_format);
1617 pa.subwindow_mode = IncludeInferiors;
1619 /* FIXME use devDst->xrender->pict ? */
1620 dst_pict = pXRenderCreatePicture(gdi_display,
1622 (devDst->depth == 1) ?
1623 mono_format : screen_format,
1624 CPSubwindowMode, &pa);
1625 TRACE("dst_pict %08lx\n", dst_pict);
1626 TRACE("src_drawable = %08lx\n", devSrc->drawable);
1627 xpm = XCreatePixmap(gdi_display,
1629 widthSrc, heightSrc, 32);
1630 gcv.graphics_exposures = False;
1631 gc = XCreateGC(gdi_display, xpm, GCGraphicsExposures, &gcv);
1632 TRACE("xpm = %08lx\n", xpm);
1633 XPutImage(gdi_display, xpm, gc, image, 0, 0, 0, 0, widthSrc, heightSrc);
1635 src_pict = pXRenderCreatePicture(gdi_display,
1637 CPSubwindowMode, &pa);
1638 TRACE("src_pict %08lx\n", src_pict);
1640 #ifdef HAVE_XRENDERSETPICTURETRANSFORM
1641 if(widthDst != widthSrc || heightDst != heightSrc) {
1642 double xscale = widthSrc/(double)widthDst;
1643 double yscale = heightSrc/(double)heightDst;
1644 XTransform xform = {{
1645 { XDoubleToFixed(xscale), XDoubleToFixed(0), XDoubleToFixed(0) },
1646 { XDoubleToFixed(0), XDoubleToFixed(yscale), XDoubleToFixed(0) },
1647 { XDoubleToFixed(0), XDoubleToFixed(0), XDoubleToFixed(1) }
1649 pXRenderSetPictureTransform(gdi_display, src_pict, &xform);
1652 pXRenderComposite(gdi_display, PictOpOver, src_pict, 0, dst_pict,
1654 xDst + devDst->org.x, yDst + devDst->org.y, widthSrc, heightSrc);
1657 pXRenderFreePicture(gdi_display, src_pict);
1658 XFreePixmap(gdi_display, xpm);
1659 XFreeGC(gdi_display, gc);
1660 pXRenderFreePicture(gdi_display, dst_pict);
1662 XDestroyImage(image);
1664 wine_tsx11_unlock();
1665 HeapFree(GetProcessHeap(), 0, data);
1666 GDI_ReleaseObj( hBitmap );
1670 #else /* HAVE_X11_EXTENSIONS_XRENDER_H */
1672 void X11DRV_XRender_Init(void)
1674 TRACE("XRender support not compiled in.\n");
1678 void X11DRV_XRender_Finalize(void)
1682 BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE *physDev, HFONT hfont)
1688 void X11DRV_XRender_DeleteDC(X11DRV_PDEVICE *physDev)
1694 BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
1695 const RECT *lprect, LPCWSTR wstr, UINT count,
1696 const INT *lpDx, INT breakExtra )
1702 void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev)
1708 BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst, INT heightDst,
1709 X11DRV_PDEVICE *devSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc,
1710 BLENDFUNCTION blendfn)
1712 FIXME("not supported - XRENDER headers were missing at compile time\n");
1716 #endif /* HAVE_X11_EXTENSIONS_XRENDER_H */