procedure TSpkToolbar.ValidateMetrics;
var
i: integer;
x: integer;
TabWidth: integer;
TabAppearance: TSpkToolbarAppearance;
MenuButtonWidth: Integer;
AdditionalPadding: Boolean;
MenuButtonTextWidth: Integer;
{$IFDEF LCLCocoa}
scalefactor: Double;
{$ENDIF}
begin
if FInternalUpdating or FUpdating then
exit;
if FMetricsValid then
exit;
FBuffer.Free;
FBuffer := TBitmap.Create;
{$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, Width, CalcToolbarHeight);