From d52537b88bc85808a821786790f1bb1d07f250b3 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Mon, 10 May 2004 15:35:25 +0000 Subject: Tried to reduce dependancies to the rest of the code (headers); This was done to limit the warnings due to redefined functions --- win/WinPort.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'win') diff --git a/win/WinPort.c b/win/WinPort.c index ecdbe03..6bd3bfa 100644 --- a/win/WinPort.c +++ b/win/WinPort.c @@ -28,8 +28,9 @@ #ifdef _WIN32 -#include "Geo.h" -#include "Types.h" +#include +#undef EXTERN +#define EXTERN #include #include #ifdef PTK @@ -39,6 +40,14 @@ static const char rcsid[] = "$Id"; static const char compile_id[]="$Compile$"; +#ifndef MIN +#define MIN(a, b) ((a) <= (b) ? (a) : (b)) +#endif +#ifndef MAX +#define MAX(a, b) ((a) >= (b) ? (a) : (b)) +#endif + + /* *---------------------------------------------------------------------- * @@ -54,12 +63,12 @@ static const char compile_id[]="$Compile$"; * *---------------------------------------------------------------------- */ -ZnBool +int ZnPointInRegion(TkRegion reg, int x, int y) { - return (ZnBool) PtInRegion((HRGN) reg, x, y); + return PtInRegion((HRGN) reg, x, y); } /* @@ -131,9 +140,8 @@ ZnPolygonRegion(XPoint *points, POINT *pts; HRGN reg; int i; - char msg[256]; - pts = ZnMalloc(n*sizeof(POINT)); + pts = (POINT *) ckalloc(n*sizeof(POINT)); for (i = 0; i < n; i++, points++) { pts[i].x = points->x; pts[i].y = points->y; @@ -142,10 +150,9 @@ ZnPolygonRegion(XPoint *points, reg = CreatePolygonRgn(pts, n, fill_rule==EvenOddRule?ALTERNATE:WINDING); if (!reg) { - sprintf(msg, "Polygon region failed: %ld, n: %d\n", GetLastError(), n); - OutputDebugString(msg); + fprintf(stderr, "Polygon region failed: %ld, n: %d\n", GetLastError(), n); } - ZnFree(pts); + ckfree((char *) pts); return (TkRegion) reg; } @@ -406,8 +413,7 @@ XFillRectangles(display, d, gc, rectangles, nrectangles) HBRUSH bgBrush = CreateSolidBrush(gc->background); if (twdPtr->type != TWD_BITMAP) { - ZnWarning("unexpected drawable type in stipple"); - exit(1); + Tcl_Panic("unexpected drawable type in stipple"); } /* @@ -544,8 +550,7 @@ RenderObject(dc, gc, points, npoints, mode, pen, func) HBRUSH oldMemBrush; if (twdPtr->type != TWD_BITMAP) { - ZnWarning("unexpected drawable type in stipple"); - exit(1); + Tcl_Panic("unexpected drawable type in stipple"); } /* @@ -925,8 +930,7 @@ DrawOrFillArc(display, d, gc, x, y, width, height, start, extent, fill) HBRUSH oldMemBrush; if (twdPtr->type != TWD_BITMAP) { - ZnWarning("unexpected drawable type in stipple"); - exit(1); + Tcl_Panic("unexpected drawable type in stipple"); } /* -- cgit v1.1