Get rid of the global INTERNAL_[XY]WSTODS macros.
diff --git a/dlls/gdi/freetype.c b/dlls/gdi/freetype.c
index e03e4ba..91ac40e 100644
--- a/dlls/gdi/freetype.c
+++ b/dlls/gdi/freetype.c
@@ -1182,6 +1182,7 @@
GdiFont ret;
Face *face;
Family *family = NULL;
+ INT height;
BOOL bd, it;
LOGFONTW lf;
CHARSETINFO csi;
@@ -1341,10 +1342,9 @@
TRACE("Chosen: %s %s\n", debugstr_w(family->FamilyName),
debugstr_w(face->StyleName));
+ height = GDI_ROUND( (FLOAT)lf.lfHeight * dc->xformWorld2Vport.eM22 );
ret->ft_face = OpenFontFile(ret, face->file, face->face_index,
- lf.lfHeight < 0 ?
- -abs(INTERNAL_YWSTODS(dc,lf.lfHeight)) :
- abs(INTERNAL_YWSTODS(dc, lf.lfHeight)));
+ lf.lfHeight < 0 ? -abs(height) : abs(height));
if (!ret->ft_face)
{
free_font( ret );
diff --git a/dlls/wineps/download.c b/dlls/wineps/download.c
index 9c48b55..2c66e82 100644
--- a/dlls/wineps/download.c
+++ b/dlls/wineps/download.c
@@ -139,10 +139,10 @@
physDev->font.fontloc = Download;
physDev->font.fontinfo.Download = is_font_downloaded(physDev, ps_name);
- physDev->font.size = INTERNAL_YWSTODS(physDev->dc, /* ppem */
- potm->otmTextMetrics.tmAscent +
- potm->otmTextMetrics.tmDescent -
- potm->otmTextMetrics.tmInternalLeading);
+ physDev->font.size = PSDRV_YWStoDS(physDev, /* ppem */
+ potm->otmTextMetrics.tmAscent +
+ potm->otmTextMetrics.tmDescent -
+ potm->otmTextMetrics.tmInternalLeading);
physDev->font.underlineThickness = potm->otmsUnderscoreSize;
physDev->font.underlinePosition = potm->otmsUnderscorePosition;
physDev->font.strikeoutThickness = potm->otmsStrikeoutSize;
diff --git a/dlls/wineps/graphics.c b/dlls/wineps/graphics.c
index f8222c2..f5a040e 100644
--- a/dlls/wineps/graphics.c
+++ b/dlls/wineps/graphics.c
@@ -36,6 +36,40 @@
WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
/***********************************************************************
+ * PSDRV_XWStoDS
+ *
+ * Performs a world-to-viewport transformation on the specified width.
+ */
+INT PSDRV_XWStoDS( PSDRV_PDEVICE *physDev, INT width )
+{
+ POINT pt[2];
+
+ pt[0].x = 0;
+ pt[0].y = 0;
+ pt[1].x = width;
+ pt[1].y = 0;
+ LPtoDP( physDev->hdc, pt, 2 );
+ return pt[1].x - pt[0].x;
+}
+
+/***********************************************************************
+ * PSDRV_YWStoDS
+ *
+ * Performs a world-to-viewport transformation on the specified height.
+ */
+INT PSDRV_YWStoDS( PSDRV_PDEVICE *physDev, INT height )
+{
+ POINT pt[2];
+
+ pt[0].x = 0;
+ pt[0].y = 0;
+ pt[1].x = 0;
+ pt[1].y = height;
+ LPtoDP( physDev->hdc, pt, 2 );
+ return pt[1].y - pt[0].y;
+}
+
+/***********************************************************************
* PSDRV_DrawLine
*/
static void PSDRV_DrawLine( PSDRV_PDEVICE *physDev )
diff --git a/dlls/wineps/pen.c b/dlls/wineps/pen.c
index 8821979..59318a7 100644
--- a/dlls/wineps/pen.c
+++ b/dlls/wineps/pen.c
@@ -41,7 +41,7 @@
TRACE("hpen = %p colour = %08lx\n", hpen, logpen.lopnColor);
- physDev->pen.width = INTERNAL_XWSTODS(physDev->dc, logpen.lopnWidth.x);
+ physDev->pen.width = PSDRV_XWStoDS(physDev, logpen.lopnWidth.x);
if(physDev->pen.width < 0)
physDev->pen.width = -physDev->pen.width;
diff --git a/dlls/wineps/psdrv.h b/dlls/wineps/psdrv.h
index 3eeed84..f08a1b6 100644
--- a/dlls/wineps/psdrv.h
+++ b/dlls/wineps/psdrv.h
@@ -395,6 +395,9 @@
extern BOOL WINAPI PSDRV_Init(HINSTANCE hinst, DWORD reason, LPVOID reserved);
+extern INT PSDRV_XWStoDS( PSDRV_PDEVICE *physDev, INT width );
+extern INT PSDRV_YWStoDS( PSDRV_PDEVICE *physDev, INT height );
+
extern BOOL PSDRV_Brush(PSDRV_PDEVICE *physDev, BOOL EO);
extern BOOL PSDRV_SetFont( PSDRV_PDEVICE *physDev );
extern BOOL PSDRV_SetPen( PSDRV_PDEVICE *physDev );
diff --git a/dlls/wineps/text.c b/dlls/wineps/text.c
index 9c8f97b..3a7bd16 100644
--- a/dlls/wineps/text.c
+++ b/dlls/wineps/text.c
@@ -172,12 +172,12 @@
sz.cx = tmpsz.cx; /* sz.cy remains untouched */
}
- sz.cx = INTERNAL_XWSTODS(dc, sz.cx);
- sz.cy = INTERNAL_YWSTODS(dc, sz.cy);
+ sz.cx = PSDRV_XWStoDS(physDev, sz.cx);
+ sz.cy = PSDRV_YWStoDS(physDev, sz.cy);
GetTextMetricsW(physDev->hdc, &tm);
- ascent = INTERNAL_YWSTODS(dc, tm.tmAscent);
- descent = INTERNAL_YWSTODS(dc, tm.tmDescent);
+ ascent = PSDRV_YWStoDS(physDev, tm.tmAscent);
+ descent = PSDRV_YWStoDS(physDev, tm.tmDescent);
TRACE("textAlign = %x\n", align);
switch(align & (TA_LEFT | TA_CENTER | TA_RIGHT) ) {
@@ -260,8 +260,8 @@
PSDRV_WriteBuiltinGlyphShow(physDev, str + i, 1);
dx += deltas[i] * cos_theta;
dy -= deltas[i] * sin_theta;
- PSDRV_WriteMoveTo(physDev, x + INTERNAL_XWSTODS(dc, dx),
- y + INTERNAL_YWSTODS(dc, dy));
+ PSDRV_WriteMoveTo(physDev, x + PSDRV_XWStoDS(physDev, dx),
+ y + PSDRV_YWStoDS(physDev, dy));
}
if(physDev->font.fontloc == Download)
PSDRV_WriteDownloadGlyphShow(physDev, glyphs + i, 1);
diff --git a/dlls/x11drv/graphics.c b/dlls/x11drv/graphics.c
index 0b6a5cc..4fbba3d 100644
--- a/dlls/x11drv/graphics.c
+++ b/dlls/x11drv/graphics.c
@@ -294,6 +294,40 @@
}
/***********************************************************************
+ * X11DRV_XWStoDS
+ *
+ * Performs a world-to-viewport transformation on the specified width.
+ */
+INT X11DRV_XWStoDS( X11DRV_PDEVICE *physDev, INT width )
+{
+ POINT pt[2];
+
+ pt[0].x = 0;
+ pt[0].y = 0;
+ pt[1].x = width;
+ pt[1].y = 0;
+ LPtoDP( physDev->hdc, pt, 2 );
+ return pt[1].x - pt[0].x;
+}
+
+/***********************************************************************
+ * X11DRV_YWStoDS
+ *
+ * Performs a world-to-viewport transformation on the specified height.
+ */
+INT X11DRV_YWStoDS( X11DRV_PDEVICE *physDev, INT height )
+{
+ POINT pt[2];
+
+ pt[0].x = 0;
+ pt[0].y = 0;
+ pt[1].x = 0;
+ pt[1].y = height;
+ LPtoDP( physDev->hdc, pt, 2 );
+ return pt[1].y - pt[0].y;
+}
+
+/***********************************************************************
* X11DRV_LineTo
*/
BOOL
diff --git a/dlls/x11drv/pen.c b/dlls/x11drv/pen.c
index 3d798f7..a23cd48 100644
--- a/dlls/x11drv/pen.c
+++ b/dlls/x11drv/pen.c
@@ -37,7 +37,6 @@
HPEN X11DRV_SelectPen( X11DRV_PDEVICE *physDev, HPEN hpen )
{
LOGPEN logpen;
- DC *dc = physDev->dc;
if (!GetObjectA( hpen, sizeof(logpen), &logpen )) return 0;
@@ -46,12 +45,11 @@
physDev->pen.endcap = logpen.lopnStyle & PS_ENDCAP_MASK;
physDev->pen.linejoin = logpen.lopnStyle & PS_JOIN_MASK;
- physDev->pen.width = GDI_ROUND((FLOAT)logpen.lopnWidth.x *
- dc->xformWorld2Vport.eM11);
+ physDev->pen.width = X11DRV_XWStoDS( physDev, logpen.lopnWidth.x );
if (physDev->pen.width < 0) physDev->pen.width = -physDev->pen.width;
if (physDev->pen.width == 1) physDev->pen.width = 0; /* Faster */
if (hpen == GetStockObject( DC_PEN ))
- logpen.lopnColor = dc->dcPenColor;
+ logpen.lopnColor = GetDCPenColor( physDev->hdc );
physDev->pen.pixel = X11DRV_PALETTE_ToPhysical( physDev, logpen.lopnColor );
switch(logpen.lopnStyle & PS_STYLE_MASK)
{
diff --git a/dlls/x11drv/text.c b/dlls/x11drv/text.c
index 93c3e46..593ad5e 100644
--- a/dlls/x11drv/text.c
+++ b/dlls/x11drv/text.c
@@ -148,7 +148,7 @@
if (lpDx) /* have explicit character cell x offsets in logical coordinates */
{
for (i = width = 0; i < count; i++) width += lpDx[i];
- width = INTERNAL_XWSTODS(dc, width);
+ width = X11DRV_XWStoDS(physDev, width);
}
else
{
@@ -158,7 +158,7 @@
result = FALSE;
goto END;
}
- width = INTERNAL_XWSTODS(dc, sz.cx);
+ width = X11DRV_XWStoDS(physDev, sz.cx);
}
ascent = pfo->lpX11Trans ? pfo->lpX11Trans->ascent : font->ascent;
descent = pfo->lpX11Trans ? pfo->lpX11Trans->descent : font->descent;
@@ -361,7 +361,7 @@
x_i, y_i, &str2b[i], 1);
if (lpDx)
{
- offset += INTERNAL_XWSTODS(dc, lpDx[i]);
+ offset += X11DRV_XWStoDS(physDev, lpDx[i]);
}
else
{
diff --git a/dlls/x11drv/x11drv.h b/dlls/x11drv/x11drv.h
index 385be73..4b06d07 100644
--- a/dlls/x11drv/x11drv.h
+++ b/dlls/x11drv/x11drv.h
@@ -210,6 +210,8 @@
extern BOOL X11DRV_SetupGCForBrush( X11DRV_PDEVICE *physDev );
extern BOOL X11DRV_SetupGCForPen( X11DRV_PDEVICE *physDev );
extern BOOL X11DRV_SetupGCForText( X11DRV_PDEVICE *physDev );
+extern INT X11DRV_XWStoDS( X11DRV_PDEVICE *physDev, INT width );
+extern INT X11DRV_YWStoDS( X11DRV_PDEVICE *physDev, INT height );
extern const int X11DRV_XROPfunction[];
diff --git a/dlls/x11drv/xfont.c b/dlls/x11drv/xfont.c
index 7b5e3d3..c92ad95 100644
--- a/dlls/x11drv/xfont.c
+++ b/dlls/x11drv/xfont.c
@@ -3287,14 +3287,15 @@
/* FIXME - check that the other drivers do this correctly */
if (lf.lfWidth)
{
- lf.lfWidth = GDI_ROUND((FLOAT)lf.lfWidth * fabs(dc->xformWorld2Vport.eM11));
+ INT width = X11DRV_XWStoDS( physDev, lf.lfWidth );
+ lf.lfWidth = (lf.lfWidth < 0) ? -abs(width) : abs(width);
if (lf.lfWidth == 0)
lf.lfWidth = 1; /* Minimum width */
}
if (lf.lfHeight)
{
- lf.lfHeight = GDI_ROUND((FLOAT)lf.lfHeight * fabs(dc->xformWorld2Vport.eM22));
-
+ INT height = X11DRV_YWStoDS( physDev, lf.lfHeight );
+ lf.lfHeight = (lf.lfHeight < 0) ? -abs(height) : abs(height);
if (lf.lfHeight == 0)
lf.lfHeight = MIN_FONT_SIZE;
}
diff --git a/dlls/x11drv/xrender.c b/dlls/x11drv/xrender.c
index eebb743..7f106f1 100644
--- a/dlls/x11drv/xrender.c
+++ b/dlls/x11drv/xrender.c
@@ -1070,14 +1070,14 @@
}
width = sz.cx;
}
- width = INTERNAL_XWSTODS(dc, width);
+ width = X11DRV_XWStoDS(physDev, width);
xwidth = width * cosEsc;
ywidth = width * sinEsc;
GetTextMetricsW(hdc, &tm);
- tm.tmAscent = INTERNAL_YWSTODS(dc, tm.tmAscent);
- tm.tmDescent = INTERNAL_YWSTODS(dc, tm.tmDescent);
+ tm.tmAscent = X11DRV_YWStoDS(physDev, tm.tmAscent);
+ tm.tmDescent = X11DRV_YWStoDS(physDev, tm.tmDescent);
switch( dc->textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER) ) {
case TA_LEFT:
if (dc->textAlign & TA_UPDATECP) {
@@ -1255,7 +1255,7 @@
0, 0, physDev->org.x + x + xoff,
physDev->org.y + y + yoff,
glyphs + idx, 1);
- offset += INTERNAL_XWSTODS(dc, deltas[idx]);
+ offset += X11DRV_XWStoDS(physDev, deltas[idx]);
xoff = offset * cosEsc;
yoff = offset * -sinEsc;
}
@@ -1275,8 +1275,8 @@
XSetForeground( gdi_display, physDev->gc, physDev->textPixel );
if (lf.lfUnderline) {
- linePos = INTERNAL_YWSTODS(dc, otm->otmsUnderscorePosition);
- lineWidth = INTERNAL_YWSTODS(dc, otm->otmsUnderscoreSize);
+ linePos = X11DRV_YWStoDS(physDev, otm->otmsUnderscorePosition);
+ lineWidth = X11DRV_YWStoDS(physDev, otm->otmsUnderscoreSize);
XSetLineAttributes( gdi_display, physDev->gc, lineWidth,
LineSolid, CapProjecting, JoinBevel );
@@ -1286,8 +1286,8 @@
}
if (lf.lfStrikeOut) {
- linePos = INTERNAL_YWSTODS(dc, otm->otmsStrikeoutPosition);
- lineWidth = INTERNAL_YWSTODS(dc, otm->otmsStrikeoutSize);
+ linePos = X11DRV_YWStoDS(physDev, otm->otmsStrikeoutPosition);
+ lineWidth = X11DRV_YWStoDS(physDev, otm->otmsStrikeoutSize);
XSetLineAttributes( gdi_display, physDev->gc, lineWidth,
LineSolid, CapProjecting, JoinBevel );
@@ -1311,7 +1311,7 @@
entry->bitmaps[glyphs[idx]],
&entry->gis[glyphs[idx]]);
if(deltas) {
- offset += INTERNAL_XWSTODS(dc, deltas[idx]);
+ offset += X11DRV_XWStoDS(physDev, deltas[idx]);
xoff = offset * cosEsc;
yoff = offset * -sinEsc;
@@ -1327,7 +1327,7 @@
entry->bitmaps[glyphs[idx]],
&entry->gis[glyphs[idx]]);
if(deltas) {
- offset += INTERNAL_XWSTODS(dc, deltas[idx]);
+ offset += X11DRV_XWStoDS(physDev, deltas[idx]);
xoff = offset * cosEsc;
yoff = offset * -sinEsc;
@@ -1361,7 +1361,7 @@
if(extents.bottom < cur.y - entry->gis[glyphs[idx]].y + entry->gis[glyphs[idx]].height)
extents.bottom = cur.y - entry->gis[glyphs[idx]].y + entry->gis[glyphs[idx]].height;
if(deltas) {
- offset += INTERNAL_XWSTODS(dc, deltas[idx]);
+ offset += X11DRV_XWStoDS(physDev, deltas[idx]);
cur.x = offset * cosEsc;
cur.y = offset * -sinEsc;
} else {
@@ -1438,7 +1438,7 @@
&entry->gis[glyphs[idx]],
dc->textColor);
if(deltas) {
- offset += INTERNAL_XWSTODS(dc, deltas[idx]);
+ offset += X11DRV_XWStoDS(physDev, deltas[idx]);
xoff = offset * cosEsc;
yoff = offset * -sinEsc;
} else {
diff --git a/include/gdi.h b/include/gdi.h
index 6f11508..66b8f23 100644
--- a/include/gdi.h
+++ b/include/gdi.h
@@ -175,34 +175,6 @@
return (int)floor(val + 0.5);
}
- /* World -> Device size conversion */
-
-/* Performs a world-to-viewport transformation on the specified width (which
- * is in integer format).
- */
-static inline INT WINE_UNUSED INTERNAL_XWSTODS(DC *dc, INT width)
-{
- FLOAT floatWidth;
-
- /* Perform operation with floating point */
- floatWidth = (FLOAT)width * dc->xformWorld2Vport.eM11;
- /* Round to integers */
- return GDI_ROUND(floatWidth);
-}
-
-/* Performs a world-to-viewport transformation on the specified size (which
- * is in integer format).
- */
-static inline INT WINE_UNUSED INTERNAL_YWSTODS(DC *dc, INT height)
-{
- FLOAT floatHeight;
-
- /* Perform operation with floating point */
- floatHeight = (FLOAT)height * dc->xformWorld2Vport.eM22;
- /* Round to integers */
- return GDI_ROUND(floatHeight);
-}
-
/* GDI local heap */
extern void *GDI_GetObjPtr( HGDIOBJ, WORD );