From 7ce87f5102ba3108c12b56ea4f87e262903e8380 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sun, 10 Apr 2011 09:01:13 +0000 Subject: [PATCH] Mac OS: fl_rect(), fl_rectf(), and fl_point() now have exact same output to display and printer. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8572 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_rect.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/fl_rect.cxx b/src/fl_rect.cxx index adba7a909..da2ef4154 100644 --- a/src/fl_rect.cxx +++ b/src/fl_rect.cxx @@ -171,10 +171,10 @@ void Fl_Graphics_Driver::rect(int x, int y, int w, int h) { LineTo(fl_gc, x, y+h-1); LineTo(fl_gc, x, y); #elif defined(__APPLE_QUARTZ__) - if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true); + if ( (!USINGQUARTZPRINTER) && fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true); CGRect rect = CGRectMake(x, y, w-1, h-1); CGContextStrokeRect(fl_gc, rect); - if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false); + if ( (!USINGQUARTZPRINTER) && fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false); #else # error unsupported platform #endif @@ -191,10 +191,14 @@ void Fl_Graphics_Driver::rectf(int x, int y, int w, int h) { rect.right = x + w; rect.bottom = y + h; FillRect(fl_gc, &rect, fl_brush()); #elif defined(__APPLE_QUARTZ__) - if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true); - CGRect rect = CGRectMake(x, y, w-1, h-1); + CGFloat delta_size = 0.9; + CGFloat delta_ori = 0; + if (USINGQUARTZPRINTER) { + delta_size = 0; + delta_ori = 0.5; + } + CGRect rect = CGRectMake(x - delta_ori, y - delta_ori, w - delta_size , h - delta_size); CGContextFillRect(fl_gc, rect); - if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false); #else # error unsupported platform #endif @@ -495,11 +499,7 @@ void Fl_Graphics_Driver::point(int x, int y) { #elif defined(WIN32) SetPixel(fl_gc, x, y, fl_RGB()); #elif defined(__APPLE_QUARTZ__) - if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true); - CGContextMoveToPoint(fl_gc, x-.5, y); // Quartz needs a line that is one pixel long, or it will not draw anything - CGContextAddLineToPoint(fl_gc, x+.5, y); - CGContextStrokePath(fl_gc); - if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false); + CGContextFillRect(fl_gc, CGRectMake(x - 0.5, y - 0.5, 1, 1) ); #else # error unsupported platform #endif