winex11: Move XRENDERINFO allocation in a separate function.
This commit is contained in:
parent
50705c5683
commit
3e5e0ee807
|
@ -207,6 +207,23 @@ static CRITICAL_SECTION xrender_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
|
||||||
#define NATIVE_BYTE_ORDER LSBFirst
|
#define NATIVE_BYTE_ORDER LSBFirst
|
||||||
#endif
|
#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)
|
static BOOL get_xrender_template(const WineXRenderFormatTemplate *fmt, XRenderPictFormat *templ, unsigned long *mask)
|
||||||
{
|
{
|
||||||
templ->id = 0;
|
templ->id = 0;
|
||||||
|
@ -795,6 +812,7 @@ void X11DRV_XRender_Finalize(void)
|
||||||
BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE *physDev, HFONT hfont)
|
BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE *physDev, HFONT hfont)
|
||||||
{
|
{
|
||||||
LFANDSIZE lfsz;
|
LFANDSIZE lfsz;
|
||||||
|
XRENDERINFO info;
|
||||||
|
|
||||||
GetObjectW(hfont, sizeof(lfsz.lf), &lfsz.lf);
|
GetObjectW(hfont, sizeof(lfsz.lf), &lfsz.lf);
|
||||||
TRACE("h=%d w=%d weight=%d it=%d charset=%d name=%s\n",
|
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 );
|
GetWorldTransform( physDev->hdc, &lfsz.xform );
|
||||||
lfsz_calc_hash(&lfsz);
|
lfsz_calc_hash(&lfsz);
|
||||||
|
|
||||||
|
info = get_xrender_info(physDev);
|
||||||
|
if (!info) return 0;
|
||||||
|
|
||||||
EnterCriticalSection(&xrender_cs);
|
EnterCriticalSection(&xrender_cs);
|
||||||
if(!physDev->xrender) {
|
if(info->cache_index != -1)
|
||||||
physDev->xrender = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
dec_ref_cache(info->cache_index);
|
||||||
sizeof(*physDev->xrender));
|
info->cache_index = GetCacheEntry(physDev, &lfsz);
|
||||||
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);
|
|
||||||
LeaveCriticalSection(&xrender_cs);
|
LeaveCriticalSection(&xrender_cs);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue