diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/fl_rect.cxx | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/src/fl_rect.cxx b/src/fl_rect.cxx index ff217db34..189bca7a7 100644 --- a/src/fl_rect.cxx +++ b/src/fl_rect.cxx @@ -202,16 +202,21 @@ void Fl_Graphics_Driver::xyline(int x, int y, int x1) { MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x1+1, y); #elif defined(__APPLE_QUARTZ__) if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true); - CGContextMoveToPoint(fl_gc, x, y); - CGContextAddLineToPoint(fl_gc, x1, y); - CGContextStrokePath(fl_gc); - if (Fl_Display_Device::high_resolution()) { - /* On retina displays, all xyline() and yxline() functions produce lines that are half-unit - (or one pixel) too short at both ends. This is corrected by filling at both ends rectangles - of size one unit by line-width. - */ - CGContextFillRect(fl_gc, CGRectMake(x-0.5 , y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_)); - CGContextFillRect(fl_gc, CGRectMake(x1-0.5 , y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_)); + if (fl_mac_os_version >= 101100) { + // bizarrely, the line drawing does not always work with 10.11, draw a thin rectangle instead + CGContextFillRect(fl_gc, CGRectMake((x1>x?x:x1) - 0.5, y - fl_quartz_line_width_/2, (x1>x?x1-x:x-x1)+1, fl_quartz_line_width_)); + } else { + CGContextMoveToPoint(fl_gc, x, y); + CGContextAddLineToPoint(fl_gc, x1, y); + CGContextStrokePath(fl_gc); + if (Fl_Display_Device::high_resolution()) { + /* On retina displays, all xyline() and yxline() functions produce lines that are half-unit + (or one pixel) too short at both ends. This is corrected by filling at both ends rectangles + of size one unit by line-width. + */ + CGContextFillRect(fl_gc, CGRectMake(x-0.5 , y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_)); + CGContextFillRect(fl_gc, CGRectMake(x1-0.5 , y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_)); + } } if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false); #else @@ -287,12 +292,19 @@ void Fl_Graphics_Driver::yxline(int x, int y, int y1) { MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x, y1); #elif defined(__APPLE_QUARTZ__) if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true); - CGContextMoveToPoint(fl_gc, x, y); - CGContextAddLineToPoint(fl_gc, x, y1); - CGContextStrokePath(fl_gc); - if (Fl_Display_Device::high_resolution()) { - CGContextFillRect(fl_gc, CGRectMake(x - fl_quartz_line_width_/2, y-0.5, fl_quartz_line_width_, 1)); - CGContextFillRect(fl_gc, CGRectMake(x - fl_quartz_line_width_/2, y1-0.5, fl_quartz_line_width_, 1)); + if (fl_mac_os_version >= 101100) { + // bizarrely, the line drawing does not always work with 10.11, draw a thin rectangle instead + CGContextFillRect(fl_gc, CGRectMake(x - fl_quartz_line_width_/2, (y>y1?y1:y) - 0.5, + fl_quartz_line_width_ , (y>y1?y-y1:y1-y)+1)); + } + else { + CGContextMoveToPoint(fl_gc, x, y); + CGContextAddLineToPoint(fl_gc, x, y1); + CGContextStrokePath(fl_gc); + if (Fl_Display_Device::high_resolution()) { + CGContextFillRect(fl_gc, CGRectMake(x - fl_quartz_line_width_/2, y-0.5, fl_quartz_line_width_, 1)); + CGContextFillRect(fl_gc, CGRectMake(x - fl_quartz_line_width_/2, y1-0.5, fl_quartz_line_width_, 1)); + } } if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false); #else |
