From 9a38c24d638023059db9059c3805f0f62b455dbd Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 5 Aug 2015 20:20:30 +0000 Subject: The CGContextStrokePath bug has been fixed in Mac OS El Capitan (10.11) public beta 4. It's no longer necessary to apply a workaround for it. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10825 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_rect.cxx | 46 ++++++++++++++++------------------------------ 1 file changed, 16 insertions(+), 30 deletions(-) (limited to 'src/fl_rect.cxx') diff --git a/src/fl_rect.cxx b/src/fl_rect.cxx index 18b965653..ff217db34 100644 --- a/src/fl_rect.cxx +++ b/src/fl_rect.cxx @@ -195,20 +195,6 @@ void Fl_Graphics_Driver::rectf(int x, int y, int w, int h) { #endif } -#ifdef __APPLE_QUARTZ__ -void CGContextStrokePath_fixed(CGContextRef c) -{ -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - if (fl_mac_os_version >= 101100) { - // bizarrely, CGContextStrokePath does not work with 10.11 after mouse click or keydown event - CGContextReplacePathWithStrokedPath(c); // needs 10.4 - CGContextFillPath(c); - } else -#endif - CGContextStrokePath(c); -} -#endif - void Fl_Graphics_Driver::xyline(int x, int y, int x1) { #if defined(USE_X11) XDrawLine(fl_display, fl_window, fl_gc, clip_x(x), clip_x(y), clip_x(x1), clip_x(y)); @@ -218,7 +204,7 @@ void Fl_Graphics_Driver::xyline(int x, int y, int x1) { if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true); CGContextMoveToPoint(fl_gc, x, y); CGContextAddLineToPoint(fl_gc, x1, y); - CGContextStrokePath_fixed(fl_gc); + 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 @@ -250,7 +236,7 @@ void Fl_Graphics_Driver::xyline(int x, int y, int x1, int y2) { CGContextMoveToPoint(fl_gc, x, y); CGContextAddLineToPoint(fl_gc, x1, y); CGContextAddLineToPoint(fl_gc, x1, y2); - CGContextStrokePath_fixed(fl_gc); + CGContextStrokePath(fl_gc); if (Fl_Display_Device::high_resolution()) { CGContextFillRect(fl_gc, CGRectMake(x-0.5, y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_)); CGContextFillRect(fl_gc, CGRectMake(x1 - fl_quartz_line_width_/2, y2-0.5, fl_quartz_line_width_, 1)); @@ -281,7 +267,7 @@ void Fl_Graphics_Driver::xyline(int x, int y, int x1, int y2, int x3) { CGContextAddLineToPoint(fl_gc, x1, y); CGContextAddLineToPoint(fl_gc, x1, y2); CGContextAddLineToPoint(fl_gc, x3, y2); - CGContextStrokePath_fixed(fl_gc); + CGContextStrokePath(fl_gc); if (Fl_Display_Device::high_resolution()) { CGContextFillRect(fl_gc, CGRectMake(x-0.5, y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_)); CGContextFillRect(fl_gc, CGRectMake(x3-0.5, y2 - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_)); @@ -301,13 +287,13 @@ 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_fixed(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)); - } + 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 # error unsupported platform @@ -331,7 +317,7 @@ void Fl_Graphics_Driver::yxline(int x, int y, int y1, int x2) { CGContextMoveToPoint(fl_gc, x, y); CGContextAddLineToPoint(fl_gc, x, y1); CGContextAddLineToPoint(fl_gc, x2, y1); - CGContextStrokePath_fixed(fl_gc); + 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(x2-0.5, y1 - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_)); @@ -362,7 +348,7 @@ void Fl_Graphics_Driver::yxline(int x, int y, int y1, int x2, int y3) { CGContextAddLineToPoint(fl_gc, x, y1); CGContextAddLineToPoint(fl_gc, x2, y1); CGContextAddLineToPoint(fl_gc, x2, y3); - CGContextStrokePath_fixed(fl_gc); + 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(x2 - fl_quartz_line_width_/2, y3-0.5, fl_quartz_line_width_, 1)); @@ -386,7 +372,7 @@ void Fl_Graphics_Driver::line(int x, int y, int x1, int y1) { if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true); CGContextMoveToPoint(fl_gc, x, y); CGContextAddLineToPoint(fl_gc, x1, y1); - CGContextStrokePath_fixed(fl_gc); + CGContextStrokePath(fl_gc); if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false); #else # error unsupported platform @@ -412,7 +398,7 @@ void Fl_Graphics_Driver::line(int x, int y, int x1, int y1, int x2, int y2) { CGContextMoveToPoint(fl_gc, x, y); CGContextAddLineToPoint(fl_gc, x1, y1); CGContextAddLineToPoint(fl_gc, x2, y2); - CGContextStrokePath_fixed(fl_gc); + CGContextStrokePath(fl_gc); if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false); #else # error unsupported platform @@ -438,7 +424,7 @@ void Fl_Graphics_Driver::loop(int x, int y, int x1, int y1, int x2, int y2) { CGContextAddLineToPoint(fl_gc, x1, y1); CGContextAddLineToPoint(fl_gc, x2, y2); CGContextClosePath(fl_gc); - CGContextStrokePath_fixed(fl_gc); + CGContextStrokePath(fl_gc); CGContextSetShouldAntialias(fl_gc, false); #else # error unsupported platform @@ -467,7 +453,7 @@ void Fl_Graphics_Driver::loop(int x, int y, int x1, int y1, int x2, int y2, int CGContextAddLineToPoint(fl_gc, x2, y2); CGContextAddLineToPoint(fl_gc, x3, y3); CGContextClosePath(fl_gc); - CGContextStrokePath_fixed(fl_gc); + CGContextStrokePath(fl_gc); CGContextSetShouldAntialias(fl_gc, false); #else # error unsupported platform -- cgit v1.2.3