From 92051890f1127429142cc0b60e3e9a1e567bf01d Mon Sep 17 00:00:00 2001 From: Fabien Costantini Date: Mon, 13 Oct 2008 23:10:43 +0000 Subject: Quickdraw removal: option removed from configure, all Qd code removed from sources. Also took this opportunity to sort the ifdef clauses so that USE_X11 shows first. Also added error pragma to enforce proper target checking, thus make even less assumptions. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6423 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_rect.cxx | 358 +++++++++++++++++++++----------------------------------- 1 file changed, 136 insertions(+), 222 deletions(-) (limited to 'src/fl_rect.cxx') diff --git a/src/fl_rect.cxx b/src/fl_rect.cxx index 71937f507..1edeecce2 100644 --- a/src/fl_rect.cxx +++ b/src/fl_rect.cxx @@ -50,23 +50,21 @@ extern float fl_quartz_line_width_; */ void fl_rect(int x, int y, int w, int h) { if (w<=0 || h<=0) return; -#ifdef WIN32 +#if defined(USE_X11) + XDrawRectangle(fl_display, fl_window, fl_gc, x, y, w-1, h-1); +#elif defined(WIN32) MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x+w-1, y); LineTo(fl_gc, x+w-1, y+h-1); LineTo(fl_gc, x, y+h-1); LineTo(fl_gc, x, y); -#elif defined(__APPLE_QD__) - Rect rect; - SetRect(&rect, x, y, x+w, y+h); - FrameRect(&rect); #elif defined(__APPLE_QUARTZ__) if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false); CGRect rect = CGRectMake(x, y, w-1, h-1); CGContextStrokeRect(fl_gc, rect); if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true); #else - XDrawRectangle(fl_display, fl_window, fl_gc, x, y, w-1, h-1); +# error unsupported platform #endif } @@ -75,22 +73,20 @@ void fl_rect(int x, int y, int w, int h) { */ void fl_rectf(int x, int y, int w, int h) { if (w<=0 || h<=0) return; -#ifdef WIN32 +#if defined(USE_X11) + if (w && h) XFillRectangle(fl_display, fl_window, fl_gc, x, y, w, h); +#elif defined(WIN32) RECT rect; rect.left = x; rect.top = y; rect.right = x + w; rect.bottom = y + h; FillRect(fl_gc, &rect, fl_brush()); -#elif defined(__APPLE_QD__) - Rect rect; - SetRect(&rect, x, y, x+w, y+h); - PaintRect(&rect); #elif defined(__APPLE_QUARTZ__) if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false); CGRect rect = CGRectMake(x, y, w-1, h-1); CGContextFillRect(fl_gc, rect); if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true); #else - if (w && h) XFillRectangle(fl_display, fl_window, fl_gc, x, y, w, h); +# error unsupported platform #endif } @@ -98,10 +94,10 @@ void fl_rectf(int x, int y, int w, int h) { Draw horizontal line from x,y to x1,y */ void fl_xyline(int x, int y, int x1) { -#ifdef WIN32 +#if defined(USE_X11) + XDrawLine(fl_display, fl_window, fl_gc, x, y, x1, y); +#elif defined(WIN32) MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x1+1, y); -#elif defined(__APPLE_QD__) - MoveTo(x, y); LineTo(x1, y); #elif defined(__APPLE_QUARTZ__) if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false); CGContextMoveToPoint(fl_gc, x, y); @@ -109,7 +105,7 @@ void fl_xyline(int x, int y, int x1) { CGContextStrokePath(fl_gc); if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true); #else - XDrawLine(fl_display, fl_window, fl_gc, x, y, x1, y); +# error unsupported platform #endif } @@ -117,16 +113,17 @@ void fl_xyline(int x, int y, int x1) { Draw horizontal line from x,y to x1,y, then vertical from x1,y to x1,y2 */ void fl_xyline(int x, int y, int x1, int y2) { -#ifdef WIN32 +#if defined (USE_X11) + XPoint p[3]; + p[0].x = x; p[0].y = p[1].y = y; + p[1].x = p[2].x = x1; p[2].y = y2; + XDrawLines(fl_display, fl_window, fl_gc, p, 3, 0); +#elif defined(WIN32) if (y2 < y) y2--; else y2++; MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x1, y); LineTo(fl_gc, x1, y2); -#elif defined(__APPLE_QD__) - MoveTo(x, y); - LineTo(x1, y); - LineTo(x1, y2); #elif defined(__APPLE_QUARTZ__) if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false); CGContextMoveToPoint(fl_gc, x, y); @@ -135,10 +132,7 @@ void fl_xyline(int x, int y, int x1, int y2) { CGContextStrokePath(fl_gc); if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true); #else - XPoint p[3]; - p[0].x = x; p[0].y = p[1].y = y; - p[1].x = p[2].x = x1; p[2].y = y2; - XDrawLines(fl_display, fl_window, fl_gc, p, 3, 0); +#error unsupported platform #endif } @@ -147,18 +141,19 @@ void fl_xyline(int x, int y, int x1, int y2) { and then another horizontal from x1,y2 to x3,y2 */ void fl_xyline(int x, int y, int x1, int y2, int x3) { -#ifdef WIN32 +#if defined(USE_X11) + XPoint p[4]; + p[0].x = x; p[0].y = p[1].y = y; + p[1].x = p[2].x = x1; p[2].y = p[3].y = y2; + p[3].x = x3; + XDrawLines(fl_display, fl_window, fl_gc, p, 4, 0); +#elif defined(WIN32) if(x3 < x1) x3--; else x3++; MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x1, y); LineTo(fl_gc, x1, y2); LineTo(fl_gc, x3, y2); -#elif defined(__APPLE_QD__) - MoveTo(x, y); - LineTo(x1, y); - LineTo(x1, y2); - LineTo(x3, y2); #elif defined(__APPLE_QUARTZ__) if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false); CGContextMoveToPoint(fl_gc, x, y); @@ -168,11 +163,7 @@ void fl_xyline(int x, int y, int x1, int y2, int x3) { CGContextStrokePath(fl_gc); if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true); #else - XPoint p[4]; - p[0].x = x; p[0].y = p[1].y = y; - p[1].x = p[2].x = x1; p[2].y = p[3].y = y2; - p[3].x = x3; - XDrawLines(fl_display, fl_window, fl_gc, p, 4, 0); +# error unsupported platform #endif } @@ -180,12 +171,12 @@ void fl_xyline(int x, int y, int x1, int y2, int x3) { Draw a vertical line from x,y to x,y1 */ void fl_yxline(int x, int y, int y1) { -#ifdef WIN32 +#if defined(USE_X11) + XDrawLine(fl_display, fl_window, fl_gc, x, y, x, y1); +#elif defined(WIN32) if (y1 < y) y1--; else y1++; MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x, y1); -#elif defined(__APPLE_QD__) - MoveTo(x, y); LineTo(x, y1); #elif defined(__APPLE_QUARTZ__) if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false); CGContextMoveToPoint(fl_gc, x, y); @@ -193,7 +184,7 @@ void fl_yxline(int x, int y, int y1) { CGContextStrokePath(fl_gc); if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true); #else - XDrawLine(fl_display, fl_window, fl_gc, x, y, x, y1); +# error unsupported platform #endif } @@ -201,16 +192,17 @@ void fl_yxline(int x, int y, int y1) { Draw a vertical line from x,y to x,y1 then a horizontal from x,y1 to x2,y1 */ void fl_yxline(int x, int y, int y1, int x2) { -#ifdef WIN32 +#if defined(USE_X11) + XPoint p[3]; + p[0].x = p[1].x = x; p[0].y = y; + p[1].y = p[2].y = y1; p[2].x = x2; + XDrawLines(fl_display, fl_window, fl_gc, p, 3, 0); +#elif defined(WIN32) if (x2 > x) x2++; else x2--; MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x, y1); LineTo(fl_gc, x2, y1); -#elif defined(__APPLE_QD__) - MoveTo(x, y); - LineTo(x, y1); - LineTo(x2, y1); #elif defined(__APPLE_QUARTZ__) if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false); CGContextMoveToPoint(fl_gc, x, y); @@ -219,10 +211,7 @@ void fl_yxline(int x, int y, int y1, int x2) { CGContextStrokePath(fl_gc); if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true); #else - XPoint p[3]; - p[0].x = p[1].x = x; p[0].y = y; - p[1].y = p[2].y = y1; p[2].x = x2; - XDrawLines(fl_display, fl_window, fl_gc, p, 3, 0); +# error unsupported platform #endif } @@ -231,18 +220,19 @@ void fl_yxline(int x, int y, int y1, int x2) { then another vertical from x2,y1 to x2,y3 */ void fl_yxline(int x, int y, int y1, int x2, int y3) { -#ifdef WIN32 +#if defined(USE_X11) + XPoint p[4]; + p[0].x = p[1].x = x; p[0].y = y; + p[1].y = p[2].y = y1; p[2].x = p[3].x = x2; + p[3].y = y3; + XDrawLines(fl_display, fl_window, fl_gc, p, 4, 0); +#elif defined(WIN32) if(y3