Commit 84f549b6 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Pass an HDC to the size mapping functions.

parent b174bde4
...@@ -473,7 +473,7 @@ BOOL X11DRV_SetupGCForText( X11DRV_PDEVICE *physDev ) ...@@ -473,7 +473,7 @@ BOOL X11DRV_SetupGCForText( X11DRV_PDEVICE *physDev )
* *
* Performs a world-to-viewport transformation on the specified width. * Performs a world-to-viewport transformation on the specified width.
*/ */
INT X11DRV_XWStoDS( X11DRV_PDEVICE *physDev, INT width ) INT X11DRV_XWStoDS( HDC hdc, INT width )
{ {
POINT pt[2]; POINT pt[2];
...@@ -481,7 +481,7 @@ INT X11DRV_XWStoDS( X11DRV_PDEVICE *physDev, INT width ) ...@@ -481,7 +481,7 @@ INT X11DRV_XWStoDS( X11DRV_PDEVICE *physDev, INT width )
pt[0].y = 0; pt[0].y = 0;
pt[1].x = width; pt[1].x = width;
pt[1].y = 0; pt[1].y = 0;
LPtoDP( physDev->dev.hdc, pt, 2 ); LPtoDP( hdc, pt, 2 );
return pt[1].x - pt[0].x; return pt[1].x - pt[0].x;
} }
...@@ -490,7 +490,7 @@ INT X11DRV_XWStoDS( X11DRV_PDEVICE *physDev, INT width ) ...@@ -490,7 +490,7 @@ INT X11DRV_XWStoDS( X11DRV_PDEVICE *physDev, INT width )
* *
* Performs a world-to-viewport transformation on the specified height. * Performs a world-to-viewport transformation on the specified height.
*/ */
INT X11DRV_YWStoDS( X11DRV_PDEVICE *physDev, INT height ) INT X11DRV_YWStoDS( HDC hdc, INT height )
{ {
POINT pt[2]; POINT pt[2];
...@@ -498,7 +498,7 @@ INT X11DRV_YWStoDS( X11DRV_PDEVICE *physDev, INT height ) ...@@ -498,7 +498,7 @@ INT X11DRV_YWStoDS( X11DRV_PDEVICE *physDev, INT height )
pt[0].y = 0; pt[0].y = 0;
pt[1].x = 0; pt[1].x = 0;
pt[1].y = height; pt[1].y = height;
LPtoDP( physDev->dev.hdc, pt, 2 ); LPtoDP( hdc, pt, 2 );
return pt[1].y - pt[0].y; return pt[1].y - pt[0].y;
} }
......
...@@ -74,7 +74,7 @@ HPEN X11DRV_SelectPen( PHYSDEV dev, HPEN hpen ) ...@@ -74,7 +74,7 @@ HPEN X11DRV_SelectPen( PHYSDEV dev, HPEN hpen )
physDev->pen.width = logpen.lopnWidth.x; physDev->pen.width = logpen.lopnWidth.x;
if ((logpen.lopnStyle & PS_GEOMETRIC) || (physDev->pen.width >= 1)) if ((logpen.lopnStyle & PS_GEOMETRIC) || (physDev->pen.width >= 1))
{ {
physDev->pen.width = X11DRV_XWStoDS( physDev, physDev->pen.width ); physDev->pen.width = X11DRV_XWStoDS( dev->hdc, physDev->pen.width );
if (physDev->pen.width < 0) physDev->pen.width = -physDev->pen.width; if (physDev->pen.width < 0) physDev->pen.width = -physDev->pen.width;
} }
......
...@@ -286,8 +286,8 @@ extern void restore_clipping_region( X11DRV_PDEVICE *dev, HRGN rgn ) DECLSPEC_HI ...@@ -286,8 +286,8 @@ extern void restore_clipping_region( X11DRV_PDEVICE *dev, HRGN rgn ) DECLSPEC_HI
extern BOOL X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE *physDev, GC gc, BOOL fMapColors ) DECLSPEC_HIDDEN; extern BOOL X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE *physDev, GC gc, BOOL fMapColors ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_SetupGCForBrush( X11DRV_PDEVICE *physDev ) DECLSPEC_HIDDEN; extern BOOL X11DRV_SetupGCForBrush( X11DRV_PDEVICE *physDev ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_SetupGCForText( X11DRV_PDEVICE *physDev ) DECLSPEC_HIDDEN; extern BOOL X11DRV_SetupGCForText( X11DRV_PDEVICE *physDev ) DECLSPEC_HIDDEN;
extern INT X11DRV_XWStoDS( X11DRV_PDEVICE *physDev, INT width ) DECLSPEC_HIDDEN; extern INT X11DRV_XWStoDS( HDC hdc, INT width ) DECLSPEC_HIDDEN;
extern INT X11DRV_YWStoDS( X11DRV_PDEVICE *physDev, INT height ) DECLSPEC_HIDDEN; extern INT X11DRV_YWStoDS( HDC hdc, INT height ) DECLSPEC_HIDDEN;
extern const int X11DRV_XROPfunction[]; extern const int X11DRV_XROPfunction[];
......
...@@ -3254,14 +3254,14 @@ HFONT X11DRV_SelectFont( PHYSDEV dev, HFONT hfont, HANDLE gdiFont ) ...@@ -3254,14 +3254,14 @@ HFONT X11DRV_SelectFont( PHYSDEV dev, HFONT hfont, HANDLE gdiFont )
/* FIXME - check that the other drivers do this correctly */ /* FIXME - check that the other drivers do this correctly */
if (lf.lfWidth) if (lf.lfWidth)
{ {
INT width = X11DRV_XWStoDS( physDev, lf.lfWidth ); INT width = X11DRV_XWStoDS( dev->hdc, lf.lfWidth );
lf.lfWidth = (lf.lfWidth < 0) ? -abs(width) : abs(width); lf.lfWidth = (lf.lfWidth < 0) ? -abs(width) : abs(width);
if (lf.lfWidth == 0) if (lf.lfWidth == 0)
lf.lfWidth = 1; /* Minimum width */ lf.lfWidth = 1; /* Minimum width */
} }
if (lf.lfHeight) if (lf.lfHeight)
{ {
INT height = X11DRV_YWStoDS( physDev, lf.lfHeight ); INT height = X11DRV_YWStoDS( dev->hdc, lf.lfHeight );
lf.lfHeight = (lf.lfHeight < 0) ? -abs(height) : abs(height); lf.lfHeight = (lf.lfHeight < 0) ? -abs(height) : abs(height);
if (lf.lfHeight == 0) if (lf.lfHeight == 0)
lf.lfHeight = MIN_FONT_SIZE; lf.lfHeight = MIN_FONT_SIZE;
......
...@@ -828,7 +828,7 @@ static int AllocEntry(void) ...@@ -828,7 +828,7 @@ static int AllocEntry(void)
return mru; return mru;
} }
static BOOL get_gasp_flags(struct xrender_physdev *physDev, WORD *flags) static BOOL get_gasp_flags(HDC hdc, WORD *flags)
{ {
DWORD size; DWORD size;
WORD *gasp, *buffer; WORD *gasp, *buffer;
...@@ -838,15 +838,15 @@ static BOOL get_gasp_flags(struct xrender_physdev *physDev, WORD *flags) ...@@ -838,15 +838,15 @@ static BOOL get_gasp_flags(struct xrender_physdev *physDev, WORD *flags)
*flags = 0; *flags = 0;
size = GetFontData(physDev->dev.hdc, MS_GASP_TAG, 0, NULL, 0); size = GetFontData(hdc, MS_GASP_TAG, 0, NULL, 0);
if(size == GDI_ERROR) if(size == GDI_ERROR)
return FALSE; return FALSE;
gasp = buffer = HeapAlloc(GetProcessHeap(), 0, size); gasp = buffer = HeapAlloc(GetProcessHeap(), 0, size);
GetFontData(physDev->dev.hdc, MS_GASP_TAG, 0, gasp, size); GetFontData(hdc, MS_GASP_TAG, 0, gasp, size);
GetTextMetricsW(physDev->dev.hdc, &tm); GetTextMetricsW(hdc, &tm);
ppem = abs(X11DRV_YWStoDS(physDev->x11dev, tm.tmAscent + tm.tmDescent - tm.tmInternalLeading)); ppem = abs(X11DRV_YWStoDS(hdc, tm.tmAscent + tm.tmDescent - tm.tmInternalLeading));
gasp++; gasp++;
num_recs = get_be_word(*gasp); num_recs = get_be_word(*gasp);
...@@ -864,7 +864,7 @@ static BOOL get_gasp_flags(struct xrender_physdev *physDev, WORD *flags) ...@@ -864,7 +864,7 @@ static BOOL get_gasp_flags(struct xrender_physdev *physDev, WORD *flags)
return TRUE; return TRUE;
} }
static AA_Type get_antialias_type( struct xrender_physdev *physDev, BOOL subpixel, BOOL hinter) static AA_Type get_antialias_type( HDC hdc, BOOL subpixel, BOOL hinter )
{ {
AA_Type ret; AA_Type ret;
WORD flags; WORD flags;
...@@ -887,7 +887,7 @@ static AA_Type get_antialias_type( struct xrender_physdev *physDev, BOOL subpixe ...@@ -887,7 +887,7 @@ static AA_Type get_antialias_type( struct xrender_physdev *physDev, BOOL subpixe
But, Wine's subpixel rendering can support the portrait mode. But, Wine's subpixel rendering can support the portrait mode.
*/ */
} }
else if (!hinter || !get_gasp_flags(physDev, &flags) || flags & GASP_DOGRAY) else if (!hinter || !get_gasp_flags(hdc, &flags) || flags & GASP_DOGRAY)
ret = AA_Grey; ret = AA_Grey;
else else
ret = AA_None; ret = AA_None;
...@@ -895,7 +895,7 @@ static AA_Type get_antialias_type( struct xrender_physdev *physDev, BOOL subpixe ...@@ -895,7 +895,7 @@ static AA_Type get_antialias_type( struct xrender_physdev *physDev, BOOL subpixe
return ret; return ret;
} }
static int GetCacheEntry(struct xrender_physdev *physDev, LFANDSIZE *plfsz) static int GetCacheEntry( HDC hdc, LFANDSIZE *plfsz )
{ {
int ret; int ret;
int format; int format;
...@@ -926,11 +926,11 @@ static int GetCacheEntry(struct xrender_physdev *physDev, LFANDSIZE *plfsz) ...@@ -926,11 +926,11 @@ static int GetCacheEntry(struct xrender_physdev *physDev, LFANDSIZE *plfsz)
switch (plfsz->lf.lfQuality) switch (plfsz->lf.lfQuality)
{ {
case ANTIALIASED_QUALITY: case ANTIALIASED_QUALITY:
entry->aa_default = get_antialias_type( physDev, FALSE, hinter ); entry->aa_default = get_antialias_type( hdc, FALSE, hinter );
return ret; /* ignore further configuration */ return ret; /* ignore further configuration */
case CLEARTYPE_QUALITY: case CLEARTYPE_QUALITY:
case CLEARTYPE_NATURAL_QUALITY: case CLEARTYPE_NATURAL_QUALITY:
entry->aa_default = get_antialias_type( physDev, subpixel, hinter ); entry->aa_default = get_antialias_type( hdc, subpixel, hinter );
break; break;
case DEFAULT_QUALITY: case DEFAULT_QUALITY:
case DRAFT_QUALITY: case DRAFT_QUALITY:
...@@ -939,7 +939,7 @@ static int GetCacheEntry(struct xrender_physdev *physDev, LFANDSIZE *plfsz) ...@@ -939,7 +939,7 @@ static int GetCacheEntry(struct xrender_physdev *physDev, LFANDSIZE *plfsz)
if ( SystemParametersInfoW( SPI_GETFONTSMOOTHING, 0, &font_smoothing, 0) && if ( SystemParametersInfoW( SPI_GETFONTSMOOTHING, 0, &font_smoothing, 0) &&
font_smoothing) font_smoothing)
{ {
entry->aa_default = get_antialias_type( physDev, subpixel, hinter ); entry->aa_default = get_antialias_type( hdc, subpixel, hinter );
} }
else else
entry->aa_default = AA_None; entry->aa_default = AA_None;
...@@ -1111,8 +1111,8 @@ static HFONT xrenderdrv_SelectFont( PHYSDEV dev, HFONT hfont, HANDLE gdiFont ) ...@@ -1111,8 +1111,8 @@ static HFONT xrenderdrv_SelectFont( PHYSDEV dev, HFONT hfont, HANDLE gdiFont )
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.lf.lfWidth = abs( lfsz.lf.lfWidth );
lfsz.devsize.cx = X11DRV_XWStoDS( physdev->x11dev, lfsz.lf.lfWidth ); lfsz.devsize.cx = X11DRV_XWStoDS( dev->hdc, lfsz.lf.lfWidth );
lfsz.devsize.cy = X11DRV_YWStoDS( physdev->x11dev, lfsz.lf.lfHeight ); lfsz.devsize.cy = X11DRV_YWStoDS( dev->hdc, lfsz.lf.lfHeight );
GetTransform( dev->hdc, 0x204, &lfsz.xform ); GetTransform( dev->hdc, 0x204, &lfsz.xform );
TRACE("font transform %f %f %f %f\n", lfsz.xform.eM11, lfsz.xform.eM12, TRACE("font transform %f %f %f %f\n", lfsz.xform.eM11, lfsz.xform.eM12,
...@@ -1126,7 +1126,7 @@ static HFONT xrenderdrv_SelectFont( PHYSDEV dev, HFONT hfont, HANDLE gdiFont ) ...@@ -1126,7 +1126,7 @@ static HFONT xrenderdrv_SelectFont( PHYSDEV dev, HFONT hfont, HANDLE gdiFont )
EnterCriticalSection(&xrender_cs); EnterCriticalSection(&xrender_cs);
if (physdev->info.cache_index != -1) if (physdev->info.cache_index != -1)
dec_ref_cache( physdev->info.cache_index ); dec_ref_cache( physdev->info.cache_index );
physdev->info.cache_index = GetCacheEntry( physdev, &lfsz ); physdev->info.cache_index = GetCacheEntry( dev->hdc, &lfsz );
LeaveCriticalSection(&xrender_cs); LeaveCriticalSection(&xrender_cs);
physdev->x11dev->has_gdi_font = TRUE; physdev->x11dev->has_gdi_font = TRUE;
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment