Changeset 547


Ignore:
Timestamp:
Apr 20, 2024, 8:45:50 PM (7 months ago)
Author:
chronos
Message:
  • Modified: Optimized scaling function.
File:
1 edited

Legend:

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

    r546 r547  
    6060  SrcPixel: TPixelPointer;
    6161  DstPixel: TPixelPointer;
    62   DstWidth, DstHeight: Integer;
    63   SrcWidth, SrcHeight: Integer;
    6462  XX, YY: Integer;
    6563  DstPixelX, DstPixelY: Integer;
    66   XNative, YNative: Integer;
    6764  DstPixelWidth, DstPixelHeight: Integer;
    6865  NewX, NewY: Integer;
     
    107104    Exit;
    108105  end;
    109 
    110   DstWidth := ScaleToNativeDist(X, Width);
    111   DstHeight := ScaleToNativeDist(Y, Height);
    112   SrcWidth := ScaleToNativeDist(XSrc, Width);
    113   SrcHeight := ScaleToNativeDist(YSrc, Height);
    114   XNative := ScaleToNative(X);
    115   YNative := ScaleToNative(Y);
    116106
    117107  Dest.BeginUpdate;
     
    248238function ScaleToNative(Value: Integer): Integer;
    249239begin
    250   Result := Ceil(Value * ScreenInfo.ToNative);
     240  // Round function is faster than Ceil and Floor
     241  Result := Round(Value * ScreenInfo.ToNative);
    251242end;
    252243
Note: See TracChangeset for help on using the changeset viewer.