FLTK logo

[master] 4b1b33c - Fix drawing rects with wide lines on macOS

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Library      Forums      Links      Apps     Login 
[  All Forums  |  Back to fltk.commit  ]
 
[ Previous Message ] [ Next Message ]

[master] 4b1b33c - Fix drawing rects with wide lines on macOS "Matthias Melcher" 14:32 Sep 28  
 
commit 4b1b33cd4301cf676ab0e2cac512f668f57d00c6
Author:     Matthias Melcher <github@matthiasm.com>
AuthorDate: Mon Sep 28 16:29:48 2026 +0200
Commit:     Matthias Melcher <github@matthiasm.com>
CommitDate: Mon Sep 28 16:29:48 2026 +0200

    Fix drawing rects with wide lines on macOS
    
    macOS would shift rectangles with line width>1
    to the left (compared to Wayland).

 CHANGES.txt                                           | 1 +
 src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git CHANGES.txt CHANGES.txt
index 1a0b97a..7003e48 100644
--- CHANGES.txt
+++ CHANGES.txt
@@ -8,6 +8,7 @@ Changes in FLTK 1.5.0                                   Released: xxx yy 2026
   Bug Fixes and other Improvements
   - Member function int Fl::get_mouse(int&, int&) has now a return value providing the
   number of the mouse-containing screen (previously, return type was void).
+  - Fix rectangle drawing for wide lines on macOS Quartz
 
 
   Platform Specific Fixes and Build Procedure Improvements
diff --git src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx
index 68ee8d5..172fd9b 100644
--- src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx
+++ src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx
@@ -37,8 +37,7 @@ void Fl_Quartz_Graphics_Driver::point(int x, int y) {
 
 void Fl_Quartz_Graphics_Driver::rect(int x, int y, int w, int h) {
   if (w<=0 || h<=0) return;
-  double offset = (quartz_line_width_ >= 2 ? quartz_line_width_/4 : 0);
-  CGRect rect = CGRectMake(x - offset, y - offset, w-1, h-1);
+  CGRect rect = CGRectMake(x, y, w-1, h-1);
   CGContextStrokeRect(gc_, rect);
 }
 
[ Direct Link to Message ]
 
     
[ Previous Message ] [ Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2026 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.