SpkToolbar: Fix scaling of toolbar height in cocoa. Patch by ChristianH, forum https://forum.lazarus.freepascal.org/index.php/topic,55123.msg409712/topicseen.html

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8056 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-06-23 20:25:47 +00:00
parent 239da83e8c
commit 5dc39f028a

View File

@ -2197,6 +2197,7 @@ var
MenuButtonWidth: Integer;
AdditionalPadding: Boolean;
MenuButtonTextWidth: Integer;
ToolbarHeight: Integer;
{$IFDEF LCLCocoa}
scalefactor: Double;
{$ENDIF}
@ -2208,14 +2209,15 @@ begin
FBuffer.Free;
FBuffer := TBitmap.Create;
ToolbarHeight := CalcToolbarHeight;
{$IFDEF LCLCocoa}
scalefactor := GetCanvasScaleFactor;
FBuffer.SetSize(round(scaleFactor*Width), round(scaleFactor*CalcToolbarHeight));
FBuffer.SetSize(round(scaleFactor*Width), round(scaleFactor*ToolbarHeight));
CGContextScaleCTM(TCocoaBitmapContext(FBuffer.Canvas.Handle).CGContext, scaleFactor, scaleFactor);
{$ELSE}
FBuffer.SetSize(Width, CalcToolbarHeight);
FBuffer.SetSize(Width, ToolbarHeight);
{$ENDIF}
SetBounds(Left, Top, FBuffer.Width, FBuffer.Height);
SetBounds(Left, Top, FBuffer.Width, ToolbarHeight);
// *** Tabs ***