From 84f549b6832e234361510fd502fa43c289cf9aac Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 12 Sep 2011 13:27:31 +0200 Subject: [PATCH] winex11: Pass an HDC to the size mapping functions. --- dlls/winex11.drv/graphics.c | 8 ++++---- dlls/winex11.drv/pen.c | 2 +- dlls/winex11.drv/x11drv.h | 4 ++-- dlls/winex11.drv/xfont.c | 4 ++-- dlls/winex11.drv/xrender.c | 28 ++++++++++++++-------------- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/dlls/winex11.drv/graphics.c b/dlls/winex11.drv/graphics.c index 7c4e0d588d2..c93001fd23d 100644 --- a/dlls/winex11.drv/graphics.c +++ b/dlls/winex11.drv/graphics.c @@ -473,7 +473,7 @@ BOOL X11DRV_SetupGCForText( X11DRV_PDEVICE *physDev ) * * 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]; @@ -481,7 +481,7 @@ INT X11DRV_XWStoDS( X11DRV_PDEVICE *physDev, INT width ) pt[0].y = 0; pt[1].x = width; pt[1].y = 0; - LPtoDP( physDev->dev.hdc, pt, 2 ); + LPtoDP( hdc, pt, 2 ); return pt[1].x - pt[0].x; } @@ -490,7 +490,7 @@ INT X11DRV_XWStoDS( X11DRV_PDEVICE *physDev, INT width ) * * 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]; @@ -498,7 +498,7 @@ INT X11DRV_YWStoDS( X11DRV_PDEVICE *physDev, INT height ) pt[0].y = 0; pt[1].x = 0; pt[1].y = height; - LPtoDP( physDev->dev.hdc, pt, 2 ); + LPtoDP( hdc, pt, 2 ); return pt[1].y - pt[0].y; } diff --git a/dlls/winex11.drv/pen.c b/dlls/winex11.drv/pen.c index 54883b208d7..45a1f6fbbc0 100644 --- a/dlls/winex11.drv/pen.c +++ b/dlls/winex11.drv/pen.c @@ -74,7 +74,7 @@ HPEN X11DRV_SelectPen( PHYSDEV dev, HPEN hpen ) physDev->pen.width = logpen.lopnWidth.x; 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; } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index c128da781be..fb190b224a6 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -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_SetupGCForBrush( 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_YWStoDS( X11DRV_PDEVICE *physDev, INT height ) DECLSPEC_HIDDEN; +extern INT X11DRV_XWStoDS( HDC hdc, INT width ) DECLSPEC_HIDDEN; +extern INT X11DRV_YWStoDS( HDC hdc, INT height ) DECLSPEC_HIDDEN; extern const int X11DRV_XROPfunction[]; diff --git a/dlls/winex11.drv/xfont.c b/dlls/winex11.drv/xfont.c index 35d23d6a5ce..9d837a450e5 100644 --- a/dlls/winex11.drv/xfont.c +++ b/dlls/winex11.drv/xfont.c @@ -3254,14 +3254,14 @@ HFONT X11DRV_SelectFont( PHYSDEV dev, HFONT hfont, HANDLE gdiFont ) /* FIXME - check that the other drivers do this correctly */ 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); if (lf.lfWidth == 0) lf.lfWidth = 1; /* Minimum width */ } 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); if (lf.lfHeight == 0) lf.lfHeight = MIN_FONT_SIZE; diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index 62db5b09d1f..e7a10623f7a 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -828,7 +828,7 @@ static int AllocEntry(void) return mru; } -static BOOL get_gasp_flags(struct xrender_physdev *physDev, WORD *flags) +static BOOL get_gasp_flags(HDC hdc, WORD *flags) { DWORD size; WORD *gasp, *buffer; @@ -838,15 +838,15 @@ static BOOL get_gasp_flags(struct xrender_physdev *physDev, WORD *flags) *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) return FALSE; 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); - ppem = abs(X11DRV_YWStoDS(physDev->x11dev, tm.tmAscent + tm.tmDescent - tm.tmInternalLeading)); + GetTextMetricsW(hdc, &tm); + ppem = abs(X11DRV_YWStoDS(hdc, tm.tmAscent + tm.tmDescent - tm.tmInternalLeading)); gasp++; num_recs = get_be_word(*gasp); @@ -864,7 +864,7 @@ static BOOL get_gasp_flags(struct xrender_physdev *physDev, WORD *flags) 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; WORD flags; @@ -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. */ } - 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; else ret = AA_None; @@ -895,7 +895,7 @@ static AA_Type get_antialias_type( struct xrender_physdev *physDev, BOOL subpixe return ret; } -static int GetCacheEntry(struct xrender_physdev *physDev, LFANDSIZE *plfsz) +static int GetCacheEntry( HDC hdc, LFANDSIZE *plfsz ) { int ret; int format; @@ -926,11 +926,11 @@ static int GetCacheEntry(struct xrender_physdev *physDev, LFANDSIZE *plfsz) switch (plfsz->lf.lfQuality) { 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 */ case CLEARTYPE_QUALITY: case CLEARTYPE_NATURAL_QUALITY: - entry->aa_default = get_antialias_type( physDev, subpixel, hinter ); + entry->aa_default = get_antialias_type( hdc, subpixel, hinter ); break; case DEFAULT_QUALITY: case DRAFT_QUALITY: @@ -939,7 +939,7 @@ static int GetCacheEntry(struct xrender_physdev *physDev, LFANDSIZE *plfsz) if ( SystemParametersInfoW( SPI_GETFONTSMOOTHING, 0, &font_smoothing, 0) && font_smoothing) { - entry->aa_default = get_antialias_type( physDev, subpixel, hinter ); + entry->aa_default = get_antialias_type( hdc, subpixel, hinter ); } else entry->aa_default = AA_None; @@ -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.lfItalic, lfsz.lf.lfCharSet, debugstr_w(lfsz.lf.lfFaceName)); lfsz.lf.lfWidth = abs( lfsz.lf.lfWidth ); - lfsz.devsize.cx = X11DRV_XWStoDS( physdev->x11dev, lfsz.lf.lfWidth ); - lfsz.devsize.cy = X11DRV_YWStoDS( physdev->x11dev, lfsz.lf.lfHeight ); + lfsz.devsize.cx = X11DRV_XWStoDS( dev->hdc, lfsz.lf.lfWidth ); + lfsz.devsize.cy = X11DRV_YWStoDS( dev->hdc, lfsz.lf.lfHeight ); GetTransform( dev->hdc, 0x204, &lfsz.xform ); 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 ) EnterCriticalSection(&xrender_cs); if (physdev->info.cache_index != -1) 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); physdev->x11dev->has_gdi_font = TRUE; return 0;