00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <os2win.h>
00015
00016
00017
00018
00019 BOOL WINAPI ScrollDC( HDC hdc, INT dx, INT dy, const RECT *rc,
00020 const RECT *prLClip, HRGN hrgnUpdate,
00021 LPRECT rcUpdate )
00022 {
00023 RECT rect, rClip, rSrc;
00024 POINT src, dest;
00025
00026 dprintf(("USER32: ScrollDC %04x %d,%d hrgnUpdate=%04x rcUpdate = %p cliprc = (%d,%d-%d,%d), rc=(%d,%d-%d,%d)",
00027 hdc, dx, dy, hrgnUpdate, rcUpdate,
00028 prLClip ? prLClip->left : 0, prLClip ? prLClip->top : 0, prLClip ? prLClip->right : 0, prLClip ? prLClip->bottom : 0,
00029 rc ? rc->left : 0, rc ? rc->top : 0, rc ? rc->right : 0, rc ? rc->bottom : 0 ));
00030
00031 if ( !hdc ) return FALSE;
00032
00033
00034
00035 if ( rc )
00036 rect = *rc;
00037 else
00038 {
00039 DebugInt3();
00040 GetClipBox( hdc, &rect );
00041 }
00042
00043 LPtoDP( hdc, (LPPOINT)&rect, 2 );
00044
00045 if (prLClip)
00046 {
00047 rClip = *prLClip;
00048 LPtoDP( hdc, (LPPOINT)&rClip, 2 );
00049 IntersectRect( &rClip, &rect, &rClip );
00050 }
00051 else
00052 rClip = rect;
00053
00054
00055 GetClipBox( hdc, &rSrc );
00056 IntersectRect( &rClip, &rSrc, &rClip );
00057 IntersectRect( &rect, &rSrc, &rect );
00058
00059 POINT ptl[2] = { 0, 0, dx, dy };
00060
00061 LPtoDP( hdc, ptl, 2);
00062
00063 dx = (int)(ptl[1].x - ptl[0].x);
00064 dy = (int)(ptl[1].y - ptl[0].y);
00065
00066 rSrc = rClip;
00067 if (prLClip) {
00068 OffsetRect( &rSrc, -dx, -dy );
00069 IntersectRect( &rSrc, &rSrc, &rect );
00070 }
00071 if (!IsRectEmpty(&rSrc))
00072 {
00073 dest.x = (src.x = rSrc.left) + dx;
00074 dest.y = (src.y = rSrc.top) + dy;
00075
00076
00077
00078 DPtoLP( hdc, (LPPOINT)&rSrc, 2 );
00079 DPtoLP( hdc, &src, 1 );
00080 DPtoLP( hdc, &dest, 1 );
00081
00082 if (!BitBlt( hdc, dest.x, dest.y,
00083 rSrc.right - rSrc.left, rSrc.bottom - rSrc.top,
00084 hdc, src.x, src.y, SRCCOPY))
00085 {
00086 return FALSE;
00087 }
00088 }
00089
00090
00091
00092 if (hrgnUpdate || rcUpdate)
00093 {
00094 HRGN hrgn =
00095 (hrgnUpdate) ? hrgnUpdate : CreateRectRgn( 0,0,0,0 );
00096 HRGN hrgn2;
00097
00098 hrgn2 = CreateRectRgnIndirect( &rect );
00099 SetRectRgn( hrgn, rClip.left, rClip.top,
00100 rClip.right, rClip.bottom );
00101 CombineRgn( hrgn, hrgn, hrgn2, RGN_AND );
00102 OffsetRgn( hrgn2, dx, dy );
00103 CombineRgn( hrgn, hrgn, hrgn2, RGN_DIFF );
00104
00105 if( rcUpdate )
00106 {
00107 GetRgnBox( hrgn, rcUpdate );
00108
00109
00110 DPtoLP( hdc, (LPPOINT)rcUpdate, 2 );
00111 }
00112 if (!hrgnUpdate) DeleteObject( hrgn );
00113 DeleteObject( hrgn2 );
00114
00115 }
00116
00117 return TRUE;
00118
00119 }
00120
00121