diff --git a/components/spktoolbar/SpkToolbar/SpkToolbar.pas b/components/spktoolbar/SpkToolbar/SpkToolbar.pas index 5b1380839..d13a30416 100644 --- a/components/spktoolbar/SpkToolbar/SpkToolbar.pas +++ b/components/spktoolbar/SpkToolbar/SpkToolbar.pas @@ -24,10 +24,13 @@ unit SpkToolbar; interface uses + {$IFDEF LCLCocoa} + CocoaGDIObjects, MacOSAll, + {$ENDIF} LCLType, LMessages, LCLVersion, Graphics, SysUtils, Controls, Classes, Math, Dialogs, Forms, Types, ExtCtrls, Menus, ImgList, SpkGraphTools, SpkGUITools, SpkMath, spkt_Appearance, spkt_BaseItem, spkt_Const, - spkt_Dispatch, spkt_Tab, spkt_Pane, spkt_Types, spkt_Buttons, spkt_Tools; + spkt_Dispatch, spkt_Tab, spkt_Pane, spkt_Types; type { Type describes regions of the toolbar which are used during handling @@ -1226,7 +1229,16 @@ begin if not (FBufferValid) then ValidateBuffer; end; - self.canvas.draw(0, 0, FBuffer); + + {$IFDEF LCLCocoa} + StretchBlt( + Canvas.Handle, 0, 0, Width, Height, + FBuffer.Canvas.Handle, 0, 0, FBuffer.Width, FBuffer.Height, + SRCCOPY + ); + {$ELSE} + Canvas.Draw(0, 0, FBuffer); + {$ENDIF} end; procedure TSpkToolbar.DoOnResize; @@ -2185,6 +2197,9 @@ var MenuButtonWidth: Integer; AdditionalPadding: Boolean; MenuButtonTextWidth: Integer; + {$IFDEF LCLCocoa} + scalefactor: Double; + {$ENDIF} begin if FInternalUpdating or FUpdating then exit; @@ -2193,7 +2208,13 @@ begin FBuffer.Free; FBuffer := TBitmap.Create; - FBuffer.SetSize(self.Width, CalcToolbarHeight); //Height); + {$IFDEF LCLCocoa} + scalefactor := GetCanvasScaleFactor; + FBuffer.SetSize(round(scaleFactor*Width), round(scaleFactor*CalcToolbarHeight)); + CGContextScaleCTM(TCocoaBitmapContext(FBuffer.Canvas.Handle).CGContext, scaleFactor, scaleFactor); + {$ELSE} + FBuffer.SetSize(Width, CalcToolbarHeight); + {$ENDIF} SetBounds(Left, Top, FBuffer.Width, FBuffer.Height); // *** Tabs ***