winex11.drv: Take into account current world transform when caching glyphs.
This patch basically duplicates the logic for caching fonts from gdi32, and fixes the problem with a test application which rotates a text string.
This commit is contained in:
parent
9540d762ad
commit
0abee3d23c
|
@ -54,6 +54,7 @@ static XRenderPictFormat *pict_formats[2];
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
LOGFONTW lf;
|
LOGFONTW lf;
|
||||||
|
XFORM xform;
|
||||||
SIZE devsize; /* size in device coords */
|
SIZE devsize; /* size in device coords */
|
||||||
DWORD hash;
|
DWORD hash;
|
||||||
} LFANDSIZE;
|
} LFANDSIZE;
|
||||||
|
@ -268,8 +269,9 @@ static BOOL fontcmp(LFANDSIZE *p1, LFANDSIZE *p2)
|
||||||
{
|
{
|
||||||
if(p1->hash != p2->hash) return TRUE;
|
if(p1->hash != p2->hash) return TRUE;
|
||||||
if(memcmp(&p1->devsize, &p2->devsize, sizeof(p1->devsize))) return TRUE;
|
if(memcmp(&p1->devsize, &p2->devsize, sizeof(p1->devsize))) return TRUE;
|
||||||
|
if(memcmp(&p1->xform, &p2->xform, sizeof(p1->xform))) return TRUE;
|
||||||
if(memcmp(&p1->lf, &p2->lf, offsetof(LOGFONTW, lfFaceName))) return TRUE;
|
if(memcmp(&p1->lf, &p2->lf, offsetof(LOGFONTW, lfFaceName))) return TRUE;
|
||||||
return strcmpW(p1->lf.lfFaceName, p2->lf.lfFaceName);
|
return strcmpiW(p1->lf.lfFaceName, p2->lf.lfFaceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -549,18 +551,24 @@ static void dec_ref_cache(int index)
|
||||||
|
|
||||||
static void lfsz_calc_hash(LFANDSIZE *plfsz)
|
static void lfsz_calc_hash(LFANDSIZE *plfsz)
|
||||||
{
|
{
|
||||||
DWORD hash = 0, *ptr;
|
DWORD hash = 0, *ptr, two_chars;
|
||||||
|
WORD *pwc;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
hash ^= plfsz->devsize.cx;
|
hash ^= plfsz->devsize.cx;
|
||||||
hash ^= plfsz->devsize.cy;
|
hash ^= plfsz->devsize.cy;
|
||||||
|
for(i = 0, ptr = (DWORD*)&plfsz->xform; i < sizeof(XFORM)/sizeof(DWORD); i++, ptr++)
|
||||||
|
hash ^= *ptr;
|
||||||
for(i = 0, ptr = (DWORD*)&plfsz->lf; i < 7; i++, ptr++)
|
for(i = 0, ptr = (DWORD*)&plfsz->lf; i < 7; i++, ptr++)
|
||||||
hash ^= *ptr;
|
hash ^= *ptr;
|
||||||
for(i = 0, ptr = (DWORD*)plfsz->lf.lfFaceName; i < LF_FACESIZE/2; i++, ptr++) {
|
for(i = 0, ptr = (DWORD*)plfsz->lf.lfFaceName; i < LF_FACESIZE/2; i++, ptr++) {
|
||||||
WCHAR *pwc = (WCHAR *)ptr;
|
two_chars = *ptr;
|
||||||
|
pwc = (WCHAR *)&two_chars;
|
||||||
if(!*pwc) break;
|
if(!*pwc) break;
|
||||||
hash ^= *ptr;
|
*pwc = toupperW(*pwc);
|
||||||
pwc++;
|
pwc++;
|
||||||
|
*pwc = toupperW(*pwc);
|
||||||
|
hash ^= two_chars;
|
||||||
if(!*pwc) break;
|
if(!*pwc) break;
|
||||||
}
|
}
|
||||||
plfsz->hash = hash;
|
plfsz->hash = hash;
|
||||||
|
@ -592,8 +600,10 @@ BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE *physDev, HFONT hfont)
|
||||||
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",
|
||||||
lfsz.lf.lfHeight, lfsz.lf.lfWidth, lfsz.lf.lfWeight,
|
lfsz.lf.lfHeight, lfsz.lf.lfWidth, lfsz.lf.lfWeight,
|
||||||
lfsz.lf.lfItalic, lfsz.lf.lfCharSet, debugstr_w(lfsz.lf.lfFaceName));
|
lfsz.lf.lfItalic, lfsz.lf.lfCharSet, debugstr_w(lfsz.lf.lfFaceName));
|
||||||
|
lfsz.lf.lfWidth = abs( lfsz.lf.lfWidth );
|
||||||
lfsz.devsize.cx = X11DRV_XWStoDS( physDev, lfsz.lf.lfWidth );
|
lfsz.devsize.cx = X11DRV_XWStoDS( physDev, lfsz.lf.lfWidth );
|
||||||
lfsz.devsize.cy = X11DRV_YWStoDS( physDev, lfsz.lf.lfHeight );
|
lfsz.devsize.cy = X11DRV_YWStoDS( physDev, lfsz.lf.lfHeight );
|
||||||
|
GetWorldTransform( physDev->hdc, &lfsz.xform );
|
||||||
lfsz_calc_hash(&lfsz);
|
lfsz_calc_hash(&lfsz);
|
||||||
|
|
||||||
EnterCriticalSection(&xrender_cs);
|
EnterCriticalSection(&xrender_cs);
|
||||||
|
|
Loading…
Reference in New Issue