Roderick Colenbrander : winex11: Move XRENDERINFO allocation in a separate function.
Alexandre Julliard
julliard at winehq.org
Thu Oct 8 08:57:13 CDT 2009
Module: wine
Branch: master
Commit: 3e5e0ee80769f027e870c2759c3c3310ae440bcc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3e5e0ee80769f027e870c2759c3c3310ae440bcc
Author: Roderick Colenbrander <thunderbird2k at gmail.com>
Date: Tue Oct 6 20:41:33 2009 +0200
winex11: Move XRENDERINFO allocation in a separate function.
---
dlls/winex11.drv/xrender.c | 32 ++++++++++++++++++++++++--------
1 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c
index 076b6d4..d4474dd 100644
--- a/dlls/winex11.drv/xrender.c
+++ b/dlls/winex11.drv/xrender.c
@@ -207,6 +207,23 @@ static CRITICAL_SECTION xrender_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
#define NATIVE_BYTE_ORDER LSBFirst
#endif
+static XRENDERINFO get_xrender_info(X11DRV_PDEVICE *physDev)
+{
+ if(!physDev->xrender)
+ {
+ physDev->xrender = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct tagXRENDERINFO));
+
+ if(!physDev->xrender)
+ {
+ ERR("Unable to allocate XRENDERINFO!\n");
+ return NULL;
+ }
+ physDev->xrender->cache_index = -1;
+ }
+
+ return physDev->xrender;
+}
+
static BOOL get_xrender_template(const WineXRenderFormatTemplate *fmt, XRenderPictFormat *templ, unsigned long *mask)
{
templ->id = 0;
@@ -795,6 +812,7 @@ void X11DRV_XRender_Finalize(void)
BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE *physDev, HFONT hfont)
{
LFANDSIZE lfsz;
+ XRENDERINFO info;
GetObjectW(hfont, sizeof(lfsz.lf), &lfsz.lf);
TRACE("h=%d w=%d weight=%d it=%d charset=%d name=%s\n",
@@ -806,15 +824,13 @@ BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE *physDev, HFONT hfont)
GetWorldTransform( physDev->hdc, &lfsz.xform );
lfsz_calc_hash(&lfsz);
+ info = get_xrender_info(physDev);
+ if (!info) return 0;
+
EnterCriticalSection(&xrender_cs);
- if(!physDev->xrender) {
- physDev->xrender = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
- sizeof(*physDev->xrender));
- physDev->xrender->cache_index = -1;
- }
- else if(physDev->xrender->cache_index != -1)
- dec_ref_cache(physDev->xrender->cache_index);
- physDev->xrender->cache_index = GetCacheEntry(physDev, &lfsz);
+ if(info->cache_index != -1)
+ dec_ref_cache(info->cache_index);
+ info->cache_index = GetCacheEntry(physDev, &lfsz);
LeaveCriticalSection(&xrender_cs);
return 0;
}
More information about the wine-cvs
mailing list