wineps.drv: Use SetRect/SetRectEmpty instead of open coding them.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2017-04-17 21:42:04 +02:00 committed by Alexandre Julliard
parent 78c49a4d32
commit e70eb53669
3 changed files with 18 additions and 44 deletions

View File

@ -36,6 +36,7 @@
#include "winbase.h"
#include "wingdi.h"
#include "wine/wingdi16.h"
#include "winuser.h"
#include "winreg.h"
#include "psdrv.h"
#include "wine/debug.h"
@ -139,17 +140,11 @@ INT PSDRV_ExtEscape( PHYSDEV dev, INT nEscape, INT cbInput, LPCVOID in_data,
RECT *r = out_data;
if(!physDev->job.banding) {
physDev->job.banding = TRUE;
r->left = 0;
r->top = 0;
r->right = physDev->horzRes;
r->bottom = physDev->vertRes;
SetRect(r, 0, 0, physDev->horzRes, physDev->vertRes);
TRACE("NEXTBAND returning %s\n", wine_dbgstr_rect(r));
return 1;
}
r->left = 0;
r->top = 0;
r->right = 0;
r->bottom = 0;
SetRectEmpty(r);
TRACE("NEXTBAND rect to 0,0 - 0,0\n" );
physDev->job.banding = FALSE;
return EndPage( dev->hdc );

View File

@ -29,6 +29,9 @@
#if !defined(PI)
# define PI M_PI
#endif
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "psdrv.h"
#include "wine/debug.h"
@ -103,10 +106,7 @@ BOOL PSDRV_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
TRACE("%d %d - %d %d\n", left, top, right, bottom);
rect.left = left;
rect.top = top;
rect.right = right;
rect.bottom = bottom;
SetRect(&rect, left, top, right, bottom);
LPtoDP( dev->hdc, (POINT *)&rect, 2 );
/* Windows does something truly hacky here. If we're in passthrough mode
@ -140,14 +140,8 @@ BOOL PSDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right,
{
RECT rect[2];
rect[0].left = left;
rect[0].top = top;
rect[0].right = right;
rect[0].bottom = bottom;
rect[1].left = 0;
rect[1].top = 0;
rect[1].right = ell_width;
rect[1].bottom = ell_height;
SetRect(&rect[0], left, top, right, bottom);
SetRect(&rect[1], 0, 0, ell_width, ell_height);
LPtoDP( dev->hdc, (POINT *)rect, 4 );
left = rect[0].left;
@ -200,10 +194,7 @@ static BOOL PSDRV_DrawArc( PHYSDEV dev, INT left, INT top,
RECT rect;
POINT start, end;
rect.left = left;
rect.top = top;
rect.right = right;
rect.bottom = bottom;
SetRect(&rect, left, top, right, bottom);
LPtoDP( dev->hdc, (POINT *)&rect, 2 );
start.x = xstart;
start.y = ystart;
@ -290,10 +281,7 @@ BOOL PSDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom)
TRACE("%d %d - %d %d\n", left, top, right, bottom);
rect.left = left;
rect.top = top;
rect.right = right;
rect.bottom = bottom;
SetRect(&rect, left, top, right, bottom);
LPtoDP( dev->hdc, (POINT *)&rect, 2 );
x = (rect.left + rect.right) / 2;

View File

@ -33,6 +33,7 @@
#include "winerror.h"
#include "winreg.h"
#include "winnls.h"
#include "winuser.h"
#include "psdrv.h"
#include "winspool.h"
#include "wine/library.h"
@ -284,22 +285,15 @@ static void PSDRV_UpdateDevCaps( PSDRV_PDEVICE *physDev )
if(&page->entry == &physDev->pi->ppd->PageSizes) {
FIXME("Can't find page\n");
physDev->ImageableArea.left = 0;
physDev->ImageableArea.right = 0;
physDev->ImageableArea.bottom = 0;
physDev->ImageableArea.top = 0;
SetRectEmpty(&physDev->ImageableArea);
physDev->PageSize.cx = 0;
physDev->PageSize.cy = 0;
} else if(page->ImageableArea) {
/* physDev sizes in device units; ppd sizes in 1/72" */
physDev->ImageableArea.left = page->ImageableArea->llx *
physDev->logPixelsX / 72;
physDev->ImageableArea.right = page->ImageableArea->urx *
physDev->logPixelsX / 72;
physDev->ImageableArea.bottom = page->ImageableArea->lly *
physDev->logPixelsY / 72;
physDev->ImageableArea.top = page->ImageableArea->ury *
physDev->logPixelsY / 72;
SetRect(&physDev->ImageableArea, page->ImageableArea->llx * physDev->logPixelsX / 72,
page->ImageableArea->ury * physDev->logPixelsY / 72,
page->ImageableArea->urx * physDev->logPixelsX / 72,
page->ImageableArea->lly * physDev->logPixelsY / 72);
physDev->PageSize.cx = page->PaperDimension->x *
physDev->logPixelsX / 72;
physDev->PageSize.cy = page->PaperDimension->y *
@ -323,10 +317,7 @@ static void PSDRV_UpdateDevCaps( PSDRV_PDEVICE *physDev )
physDev->logPixelsY / 254;
} else {
FIXME("Odd dmFields %x\n", physDev->Devmode->dmPublic.dmFields);
physDev->ImageableArea.left = 0;
physDev->ImageableArea.right = 0;
physDev->ImageableArea.bottom = 0;
physDev->ImageableArea.top = 0;
SetRectEmpty(&physDev->ImageableArea);
physDev->PageSize.cx = 0;
physDev->PageSize.cy = 0;
}