Changeset 552 for trunk/Packages/DpiControls/Dpi.Common.pas
- Timestamp:
- Apr 24, 2024, 10:28:34 AM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/DpiControls/Dpi.Common.pas
r547 r552 15 15 XSrc, YSrc: Integer; Rop: DWORD = SRCCOPY): Boolean; 16 16 function BitBltBitmap(Dest: TBitmap; X, Y, Width, Height: Integer; Src: TBitmap; 17 XSrc, YSrc: Integer; Rop: DWORD = SRCCOPY ): Boolean;17 XSrc, YSrc: Integer; Rop: DWORD = SRCCOPY; Precise: Boolean = False): Boolean; 18 18 function CreateRectRgn(X1, Y1, X2, Y2: Integer): HRGN; 19 19 {$IFDEF WINDOWS} … … 56 56 57 57 function BitBltBitmap(Dest: TBitmap; X, Y, Width, Height: Integer; 58 Src: TBitmap; XSrc, YSrc: Integer; Rop: DWORD): Boolean; 58 Src: TBitmap; XSrc, YSrc: Integer; Rop: DWORD = SRCCOPY; 59 Precise: Boolean = False): Boolean; 59 60 var 60 61 SrcPixel: TPixelPointer; … … 65 66 NewX, NewY: Integer; 66 67 begin 67 if Frac(ScreenInfo.Dpi / 96) = 0 then 68 begin 68 if not Precise or (Frac(ScreenInfo.Dpi / 96) = 0) then begin 69 69 // Use faster non-fractional scaling 70 70 Result := BitBlt(Dest.Canvas.Handle, X, Y, Width, Height, Src.Canvas.Handle, … … 238 238 function ScaleToNative(Value: Integer): Integer; 239 239 begin 240 // Round function is faster than Ceil and Floor 241 Result := Round(Value * ScreenInfo.ToNative); 240 Result := ScreenInfo.Lookup[Value]; 241 // Round and Trunc are fast. Ceil and Floor slow. 242 // Without lookup table we would use: 243 // Result := Ceil(Value * ScreenInfo.ToNative); 242 244 end; 243 245 … … 249 251 function ScaleFromNative(Value: Integer): Integer; 250 252 begin 251 Result := Floor(Value * ScreenInfo.FromNative);253 Result := Trunc(Value * ScreenInfo.FromNative); 252 254 end; 253 255
Note:
See TracChangeset
for help on using the changeset viewer.