mirror of https://github.com/fltk/fltk
Under Mac OS 10.11 beta, fl_xyline(init,int,int) and fl_yxline(init,int,int) produce bizarre graphics just after
processing a mouse or keyboard event (they are OK in other cases). We fix that by filling a rectangle instead of stroking along a line (and hope the public 10.11 will have fixed that). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10803 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
4f6903eed5
commit
e7291b373c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue