Ignore:
Timestamp:
May 23, 2020, 12:45:14 AM (4 years ago)
Author:
chronos
Message:
  • Fixed: Scrolling under HighDPI. ScrollDC needs to be scaled as well.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Packages/DpiControls/UDpiControls.pas

    r250 r252  
    902902function DpiBitBltCanvas(Dest: TDpiCanvas; X, Y, Width, Height: Integer; Src: TDpiCanvas; XSrc, YSrc: Integer; Rop: DWORD = SRCCOPY): Boolean;
    903903function DpiCreateRectRgn(X1, Y1, X2, Y2: Integer): HRGN;
     904function DpiScrollDC(hDC:HDC; dx:longint; dy:longint; const lprcScroll:RECT; const lprcClip:RECT;hrgnUpdate:HRGN; lprcUpdate: LPRECT): WINBOOL;
    904905function ScaleToNative(Value: Integer): Integer;
    905906function ScaleFromNative(Value: Integer): Integer;
     
    940941  Result := CreateRectRgn(ScaleToNative(X1), ScaleToNative(Y1), ScaleToNative(X2),
    941942    ScaleToNative(Y2));
     943end;
     944
     945{$IFDEF LINUX}
     946function LinuxScrollDC(Canvas: TDpiCanvas; dx: longint; dy: longint; const lprcScroll:TRect; const lprcClip:TRect; hrgnUpdate:HRGN; lprcUpdate: PRect):Boolean;
     947begin
     948end;
     949{$ENDIF}
     950
     951function DpiScrollDC(hDC: HDC; dx: longint; dy: longint;
     952  const lprcScroll: RECT; const lprcClip: RECT; hrgnUpdate: HRGN;
     953  lprcUpdate: LPRECT): WINBOOL;
     954begin
     955  {$IFDEF WINDOWS}
     956  Result := Windows.ScrollDC(hDC, ScaleToNative(dx), ScaleToNative(dy),
     957    ScaleRectToNative(lprcScroll), ScaleRectToNative(lprcClip),
     958    hrgnUpdate, lprcUpdate);
     959  {$ENDIF}
     960  {$IFDEF LINUX}
     961  // Can't do scrolling of DC under Linux, then fallback into BitBlt.
     962  Result := DpiBitCanvas(Canvas, lprcScroll.Left + dx, lprcScroll.Top + dy, lprcScroll.Right - lprcScroll.Left, lprcScroll.Bottom - lprcScroll.Top,
     963    Canvas, lprcScroll.Left, lprcScroll.Top);
     964  {$ENDIF}
    942965end;
    943966
Note: See TracChangeset for help on using the changeset viewer.