Michael Stefaniuc : wineps.drv: Use SetRect/ SetRectEmpty instead of open coding them.
Alexandre Julliard
julliard at winehq.org
Wed Apr 19 14:49:38 CDT 2017
Module: wine
Branch: master
Commit: e70eb5366950486a55fd0fe238190997afbb670f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e70eb5366950486a55fd0fe238190997afbb670f
Author: Michael Stefaniuc <mstefani at winehq.org>
Date: Mon Apr 17 21:42:04 2017 +0200
wineps.drv: Use SetRect/SetRectEmpty instead of open coding them.
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wineps.drv/escape.c | 11 +++--------
dlls/wineps.drv/graphics.c | 28 ++++++++--------------------
dlls/wineps.drv/init.c | 23 +++++++----------------
3 files changed, 18 insertions(+), 44 deletions(-)
diff --git a/dlls/wineps.drv/escape.c b/dlls/wineps.drv/escape.c
index 435376c..636ad2a 100644
--- a/dlls/wineps.drv/escape.c
+++ b/dlls/wineps.drv/escape.c
@@ -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 );
diff --git a/dlls/wineps.drv/graphics.c b/dlls/wineps.drv/graphics.c
index 7fa0727..ab6fe45 100644
--- a/dlls/wineps.drv/graphics.c
+++ b/dlls/wineps.drv/graphics.c
@@ -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;
diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c
index e4e17b0..3b00343 100644
--- a/dlls/wineps.drv/init.c
+++ b/dlls/wineps.drv/init.c
@@ -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;
}
More information about the wine-cvs
mailing list