View Issue Details

IDProjectCategoryView StatusLast Update
0035998LazarusWidgetsetpublic2019-08-27 20:38
ReporterZoë Peterson Assigned ToDmitry Boyarintsev  
Status resolvedResolutionfixed 
Product Version2.0.4 
Summary0035998: Fixed DrawEdge incorrectly changing the Canvas Pen color
DescriptionThis patch makes DrawEdgeRect save/restore the pen color. DrawEdge shouldn't affect the current canvas pen color and the low-level way it was doing it could (I think) cause cause TPen and it's underlying handle to get out of sync on what they think the current color is. Rev 61617 when DrawEdge was added introduced drawing artifacts for us when we were using colors in the same range as the edge used.
TagsNo tags attached.
Fixed in Revision61761
Attached Files


Zoë Peterson

2019-08-23 20:19


drawedge.patch (653 bytes)   
--- a/lcl/interfaces/cocoa/
+++ b/lcl/interfaces/cocoa/
@@ -566,7 +566,10 @@ end;
 procedure DrawEdgeRect(dst: TCocoaContext; const r: TRect; flags: Cardinal;
   LTColor, BRColor: TColor);
+  savedColor: TColorRef;
+  savedColor := dst.Pen.ColorRef;
   dst.Pen.SetColor(LTColor, true);
   if flags and BF_LEFT > 0 then
@@ -593,6 +596,7 @@ begin
     // there's a missing pixel. Seems like it's accumulating an offset
     dst.LineTo(r.Left-1, r.Bottom);
+  dst.Pen.SetColor(savedColor, true);
 function TCocoaWidgetSet.DrawEdge(DC: HDC; var Rect: TRect; edge: Cardinal;
drawedge.patch (653 bytes)   

Dmitry Boyarintsev

2019-08-27 20:38

developer   ~0117858

used a bit broader approach (to handle pen and brush styles).

please test and close if ok.

Issue History

Date Modified Username Field Change
2019-08-23 20:19 Zoë Peterson New Issue
2019-08-23 20:19 Zoë Peterson File Added: drawedge.patch
2019-08-24 19:16 Dmitry Boyarintsev Assigned To => Dmitry Boyarintsev
2019-08-24 19:16 Dmitry Boyarintsev Status new => assigned
2019-08-27 20:38 Dmitry Boyarintsev Status assigned => resolved
2019-08-27 20:38 Dmitry Boyarintsev Resolution open => fixed
2019-08-27 20:38 Dmitry Boyarintsev Fixed in Revision => 61761
2019-08-27 20:38 Dmitry Boyarintsev LazTarget => -
2019-08-27 20:38 Dmitry Boyarintsev Widgetset Cocoa => Cocoa
2019-08-27 20:38 Dmitry Boyarintsev Note Added: 0117858