Commit 30d6d5dc authored by Phil Krylov's avatar Phil Krylov Committed by Alexandre Julliard

Fixed SetTextAlign(), SetBkMode(), SetROP2(), SetPolyFillMode(), and

SetStretchBltMode() to assume that the corresponding DC driver functions return only a BOOL success flag, and therefore a proper return value should be generated by the main function. Fixed EMFDRV_StretchDIBits() to return a proper value (like MFDRV_StretchDIBits already does). Added comments about other cases of improper return values.
parent 26b40c29
......@@ -187,7 +187,10 @@ INT WINAPI OffsetClipRgn( HDC hdc, INT x, INT y )
TRACE("%p %d,%d\n", hdc, x, y );
if(dc->funcs->pOffsetClipRgn)
{
ret = dc->funcs->pOffsetClipRgn( dc->physDev, x, y );
/* FIXME: ret is just a success flag, we should return a proper value */
}
else if (dc->hClipRgn) {
ret = OffsetRgn( dc->hClipRgn, MulDiv( x, dc->vportExtX, dc->wndExtX ),
MulDiv( y, dc->vportExtY, dc->wndExtY ) );
......@@ -229,7 +232,10 @@ INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top,
TRACE("%p %dx%d,%dx%d\n", hdc, left, top, right, bottom );
if(dc->funcs->pExcludeClipRect)
{
ret = dc->funcs->pExcludeClipRect( dc->physDev, left, top, right, bottom );
/* FIXME: ret is just a success flag, we should return a proper value */
}
else
{
POINT pt[2];
......@@ -266,7 +272,10 @@ INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom
TRACE("%p %d,%d - %d,%d\n", hdc, left, top, right, bottom );
if(dc->funcs->pIntersectClipRect)
{
ret = dc->funcs->pIntersectClipRect( dc->physDev, left, top, right, bottom );
/* FIXME: ret is just a success flag, we should return a proper value */
}
else
{
POINT pt[2];
......
......@@ -505,6 +505,7 @@ INT WINAPI SaveDC( HDC hdc )
{
ret = dc->funcs->pSaveDC( dc->physDev );
GDI_ReleaseObj( hdc );
/* FIXME: ret is just a success flag, we should return a proper value */
return ret;
}
......@@ -998,20 +999,20 @@ UINT WINAPI GetTextAlign( HDC hdc )
*/
UINT WINAPI SetTextAlign( HDC hdc, UINT align )
{
UINT prevAlign;
UINT ret;
DC *dc = DC_GetDCPtr( hdc );
TRACE("hdc=%p align=%d\n", hdc, align);
if (!dc) return 0x0;
ret = dc->textAlign;
if (dc->funcs->pSetTextAlign)
prevAlign = dc->funcs->pSetTextAlign(dc->physDev, align);
else {
prevAlign = dc->textAlign;
if (!dc->funcs->pSetTextAlign(dc->physDev, align))
ret = GDI_ERROR;
if (ret != GDI_ERROR)
dc->textAlign = align;
}
GDI_ReleaseObj( hdc );
return prevAlign;
return ret;
}
/***********************************************************************
......@@ -1620,13 +1621,13 @@ INT WINAPI SetBkMode( HDC hdc, INT mode )
return 0;
}
if (!(dc = DC_GetDCPtr( hdc ))) return 0;
ret = dc->backgroundMode;
if (dc->funcs->pSetBkMode)
ret = dc->funcs->pSetBkMode( dc->physDev, mode );
else
{
ret = dc->backgroundMode;
if (!dc->funcs->pSetBkMode( dc->physDev, mode ))
ret = 0;
if (ret)
dc->backgroundMode = mode;
}
GDI_ReleaseObj( hdc );
return ret;
}
......@@ -1661,13 +1662,12 @@ INT WINAPI SetROP2( HDC hdc, INT mode )
return 0;
}
if (!(dc = DC_GetDCPtr( hdc ))) return 0;
ret = dc->ROPmode;
if (dc->funcs->pSetROP2)
ret = dc->funcs->pSetROP2( dc->physDev, mode );
else
{
ret = dc->ROPmode;
if (!dc->funcs->pSetROP2( dc->physDev, mode ))
ret = 0;
if (ret)
dc->ROPmode = mode;
}
GDI_ReleaseObj( hdc );
return ret;
}
......@@ -1727,13 +1727,12 @@ INT WINAPI SetPolyFillMode( HDC hdc, INT mode )
return 0;
}
if (!(dc = DC_GetDCPtr( hdc ))) return 0;
ret = dc->polyFillMode;
if (dc->funcs->pSetPolyFillMode)
ret = dc->funcs->pSetPolyFillMode( dc->physDev, mode );
else
{
ret = dc->polyFillMode;
if (!dc->funcs->pSetPolyFillMode( dc->physDev, mode ))
ret = 0;
if (ret)
dc->polyFillMode = mode;
}
GDI_ReleaseObj( hdc );
return ret;
}
......@@ -1768,13 +1767,12 @@ INT WINAPI SetStretchBltMode( HDC hdc, INT mode )
return 0;
}
if (!(dc = DC_GetDCPtr( hdc ))) return 0;
ret = dc->stretchBltMode;
if (dc->funcs->pSetStretchBltMode)
ret = dc->funcs->pSetStretchBltMode( dc->physDev, mode );
else
{
ret = dc->stretchBltMode;
if (!dc->funcs->pSetStretchBltMode( dc->physDev, mode ))
ret = 0;
if (ret)
dc->stretchBltMode = mode;
}
GDI_ReleaseObj( hdc );
return ret;
}
......
......@@ -254,7 +254,7 @@ INT EMFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst,
HeapFree(GetProcessHeap(), 0, emr);
return ret;
return ret ? heightSrc : GDI_ERROR;
}
INT EMFDRV_SetDIBitsToDevice(
......
......@@ -2225,7 +2225,10 @@ DWORD WINAPI SetMapperFlags( HDC hDC, DWORD dwFlag )
DWORD ret = 0;
if(!dc) return 0;
if(dc->funcs->pSetMapperFlags)
{
ret = dc->funcs->pSetMapperFlags( dc->physDev, dwFlag );
/* FIXME: ret is just a success flag, we should return a proper value */
}
else
FIXME("(%p, 0x%08lx): stub - harmless\n", hDC, dwFlag);
GDI_ReleaseObj( hDC );
......
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