From fdbb1e6aa3ede52fe070c1dc2d62fcaab574fb71 Mon Sep 17 00:00:00 2001 From: rich2014 Date: Tue, 2 Jul 2024 20:21:48 +0800 Subject: [PATCH] Cocoa: fix the issues related to Canvas Clipping, especially on version < macOS 11 --- lcl/interfaces/cocoa/cocoagdiobjects.pas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lcl/interfaces/cocoa/cocoagdiobjects.pas b/lcl/interfaces/cocoa/cocoagdiobjects.pas index b1257621e5..96f4baf1d3 100644 --- a/lcl/interfaces/cocoa/cocoagdiobjects.pas +++ b/lcl/interfaces/cocoa/cocoagdiobjects.pas @@ -1436,10 +1436,12 @@ begin FBkBrush.Free; if Assigned(ctx) then begin - if Assigned(CGContext()) and Flipped then + if Clipped then + CGContextRestoreGState(CGContext()); + if Flipped then CGContextRestoreGState(CGContext()); ctx.release; - end; + end; if Assigned(boxview) then boxview.release; inherited Destroy; end;