Ignore:
Timestamp:
Apr 20, 2024, 6:20:48 PM (4 weeks ago)
Author:
chronos
Message:
  • Modified: Optimized scaling functions.
File:
1 edited

Legend:

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

    r545 r546  
    248248function ScaleToNative(Value: Integer): Integer;
    249249begin
    250   Result := Ceil(Value * ScreenInfo.Dpi / 96);
     250  Result := Ceil(Value * ScreenInfo.ToNative);
    251251end;
    252252
     
    258258function ScaleFromNative(Value: Integer): Integer;
    259259begin
    260   Result := Floor(Value * 96 / ScreenInfo.Dpi);
     260  Result := Floor(Value * ScreenInfo.FromNative);
    261261end;
    262262
     
    303303function ScaleFloatToNative(Value: Double): Double;
    304304begin
    305   Result := Value * ScreenInfo.Dpi / 96;
     305  Result := Value * ScreenInfo.ToNative;
    306306end;
    307307
    308308function ScaleFloatFromNative(Value: Double): Double;
    309309begin
    310   Result := Value * 96 / ScreenInfo.Dpi;
     310  Result := Value * ScreenInfo.FromNative;
    311311end;
    312312
Note: See TracChangeset for help on using the changeset viewer.