Changeset 516 for trunk/Packages


Ignore:
Timestamp:
Jan 4, 2024, 11:52:05 PM (11 months ago)
Author:
chronos
Message:
  • Fixed: Use Round function for scaling calculation as ceil and floor are much slower.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/DpiControls/Dpi.Common.pas

    r515 r516  
    55uses
    66  {$IFDEF WINDOWS}Windows,{$ENDIF}
    7   Classes, SysUtils, LCLType, Types, Math, LCLIntf, Graphics, Dpi.Graphics;
     7  Classes, SysUtils, LCLType, Types, LCLIntf, Graphics, Dpi.Graphics;
    88
    99const
     
    100100function ScaleToNative(Value: Integer): Integer;
    101101begin
    102   Result := Ceil(Value * ScreenInfo.Dpi / 96);
     102  Result := Round(Value * ScreenInfo.Dpi / 96);
    103103end;
    104104
     
    110110function ScaleFromNative(Value: Integer): Integer;
    111111begin
    112   Result := Floor(Value * 96 / ScreenInfo.Dpi);
     112  Result := Round(Value * 96 / ScreenInfo.Dpi);
    113113end;
    114114
Note: See TracChangeset for help on using the changeset viewer.