mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 01:39:42 +02:00
Cocoa: fix drawing issue for custom-drawn listbox (issue #36714)
This commit is contained in:
parent
b7183648e0
commit
df77d2766e
@ -521,6 +521,7 @@ begin
|
||||
inherited;
|
||||
if not Assigned(callback) then Exit;
|
||||
ctx := TCocoaContext.Create(NSGraphicsContext.currentContext);
|
||||
ctx.InitDraw(round(clipRect.size.width), round(clipRect.size.height));
|
||||
try
|
||||
ItemState := [];
|
||||
if isRowSelected(row) then Include(ItemState, odSelected);
|
||||
|
@ -945,11 +945,17 @@ procedure TCocoaThemeServices.CellDrawStart(dst: TCocoaContext; const r: Trect;
|
||||
var
|
||||
acc : TCocoaContextAccess absolute dst;
|
||||
begin
|
||||
NSGraphicsContext.classSaveGraphicsState;
|
||||
cur := NSGraphicsContext.currentContext;
|
||||
NSGraphicsContext.setCurrentContext( acc.ctx );
|
||||
|
||||
acc.SetCGFillping(acc.CGContext, 0, -acc.Size.cy);
|
||||
LCLToNSRect( R, acc.size.cy, dstRect);
|
||||
if NOT acc.ctx.isFlipped then begin
|
||||
CGContextTranslateCTM(acc.ctx.CGContext, 0, acc.Size.cy);
|
||||
CGContextScaleCTM(acc.ctx.CGContext, 1, -1);
|
||||
LCLToNSRect( R, acc.size.cy, dstRect);
|
||||
end else begin
|
||||
dstRect:= RectTONSRect(R);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCocoaThemeServices.CellDrawFrame(cell: NSCell; const dst: NSRect);
|
||||
@ -958,11 +964,9 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCocoaThemeServices.CellDrawEnd(dst: TCocoaContext; cur: NSGraphicsContext);
|
||||
var
|
||||
acc : TCocoaContextAccess absolute dst;
|
||||
begin
|
||||
acc.SetCGFillping(acc.CGContext, 0, -acc.Size.cy);
|
||||
NSGraphicsContext.setCurrentContext( cur );
|
||||
NSGraphicsContext.setCurrentContext(cur);
|
||||
NSGraphicsContext.classRestoreGraphicsState;
|
||||
end;
|
||||
|
||||
{ TCocoaThemeCallback }
|
||||
|
Loading…
Reference in New Issue
Block a user