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 "winbase.h"
#include "wingdi.h" #include "wingdi.h"
#include "wine/wingdi16.h" #include "wine/wingdi16.h"
#include "winuser.h"
#include "winreg.h" #include "winreg.h"
#include "psdrv.h" #include "psdrv.h"
#include "wine/debug.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; RECT *r = out_data;
if(!physDev->job.banding) { if(!physDev->job.banding) {
physDev->job.banding = TRUE; physDev->job.banding = TRUE;
r->left = 0; SetRect(r, 0, 0, physDev->horzRes, physDev->vertRes);
r->top = 0;
r->right = physDev->horzRes;
r->bottom = physDev->vertRes;
TRACE("NEXTBAND returning %s\n", wine_dbgstr_rect(r)); TRACE("NEXTBAND returning %s\n", wine_dbgstr_rect(r));
return 1; return 1;
} }
r->left = 0; SetRectEmpty(r);
r->top = 0;
r->right = 0;
r->bottom = 0;
TRACE("NEXTBAND rect to 0,0 - 0,0\n" ); TRACE("NEXTBAND rect to 0,0 - 0,0\n" );
physDev->job.banding = FALSE; physDev->job.banding = FALSE;
return EndPage( dev->hdc ); return EndPage( dev->hdc );

View File

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

View File

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