ScrollDC doesn't need to be in the graphics driver.
authorAlexandre Julliard <julliard@winehq.org>
Mon, 12 Jan 2004 21:15:16 +0000 (21:15 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 12 Jan 2004 21:15:16 +0000 (21:15 +0000)
dlls/user/user_main.c
dlls/x11drv/scroll.c
dlls/x11drv/x11drv.spec
include/user.h
windows/scroll.c

index aebce243dca49ff5c24c0e4b665d57e2922c6fc4..d3add4713bb9812614377a83b6f89b7c201efc08 100644 (file)
@@ -111,7 +111,6 @@ static BOOL load_driver(void)
     GET_USER_FUNC(ForceWindowRaise);
     GET_USER_FUNC(MsgWaitForMultipleObjectsEx);
     GET_USER_FUNC(ReleaseDC);
-    GET_USER_FUNC(ScrollDC);
     GET_USER_FUNC(ScrollWindowEx);
     GET_USER_FUNC(SetFocus);
     GET_USER_FUNC(SetParent);
index 6d826e819d8c8eea8f87f3b03accb641988c7435..7bec346ea35ce1f984ca581020b194eb8e9129e4 100644 (file)
 WINE_DEFAULT_DEBUG_CHANNEL(scroll);
 
 
-/*************************************************************************
- *             ScrollDC   (X11DRV.@)
- *
- * dx, dy, lprcScroll and lprcClip are all in logical coordinates (msdn is wrong)
- * hrgnUpdate is returned in device coordinates with rcUpdate in logical coordinates.
- *
- */
-BOOL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *lprcScroll,
-                      const RECT *lprcClip, HRGN hrgnUpdate, LPRECT lprcUpdate )
-{
-    RECT rSrc, rClipped_src, rClip, rDst, offset;
-
-    TRACE( "%p %d,%d hrgnUpdate=%p lprcUpdate = %p\n", hdc, dx, dy, hrgnUpdate, lprcUpdate );
-    if (lprcClip) TRACE( "lprcClip = %s\n", wine_dbgstr_rect(lprcClip));
-    if (lprcScroll) TRACE( "lprcScroll = %s\n", wine_dbgstr_rect(lprcScroll));
-
-    /* compute device clipping region (in device coordinates) */
-
-    if (lprcScroll) rSrc = *lprcScroll;
-    else GetClipBox( hdc, &rSrc );
-    LPtoDP(hdc, (LPPOINT)&rSrc, 2);
-
-    if (lprcClip) rClip = *lprcClip;
-    else GetClipBox( hdc, &rClip );
-    LPtoDP(hdc, (LPPOINT)&rClip, 2);
-
-    IntersectRect( &rClipped_src, &rSrc, &rClip );
-    TRACE("rSrc %s rClip %s clipped rSrc %s\n", wine_dbgstr_rect(&rSrc),
-          wine_dbgstr_rect(&rClip), wine_dbgstr_rect(&rClipped_src));
-
-    rDst = rClipped_src;
-    SetRect(&offset, 0, 0, dx, dy);
-    LPtoDP(hdc, (LPPOINT)&offset, 2);
-    OffsetRect( &rDst, offset.right - offset.left,  offset.bottom - offset.top );
-    TRACE("rDst before clipping %s\n", wine_dbgstr_rect(&rDst));
-    IntersectRect( &rDst, &rDst, &rClip );
-    TRACE("rDst after clipping %s\n", wine_dbgstr_rect(&rDst));
-
-    if (!IsRectEmpty(&rDst))
-    {
-        /* copy bits */
-        RECT rDst_lp = rDst, rSrc_lp = rDst;
-
-        OffsetRect( &rSrc_lp, offset.left - offset.right, offset.top - offset.bottom );
-        DPtoLP(hdc, (LPPOINT)&rDst_lp, 2);
-        DPtoLP(hdc, (LPPOINT)&rSrc_lp, 2);
-
-        if (!BitBlt( hdc, rDst_lp.left, rDst_lp.top,
-                     rDst_lp.right - rDst_lp.left, rDst_lp.bottom - rDst_lp.top,
-                     hdc, rSrc_lp.left, rSrc_lp.top, SRCCOPY))
-            return FALSE;
-    }
-
-    /* compute update areas.  This is the clipped source or'ed with the unclipped source translated minus the
-     clipped src translated (rDst) all clipped to rClip */
-
-    if (hrgnUpdate || lprcUpdate)
-    {
-        HRGN hrgn = hrgnUpdate, hrgn2;
-
-        if (hrgn) SetRectRgn( hrgn, rClipped_src.left, rClipped_src.top, rClipped_src.right, rClipped_src.bottom );
-        else hrgn = CreateRectRgn( rClipped_src.left, rClipped_src.top, rClipped_src.right, rClipped_src.bottom );
-
-        hrgn2 = CreateRectRgnIndirect( &rSrc );
-        OffsetRgn(hrgn2, offset.right - offset.left,  offset.bottom - offset.top );
-        CombineRgn(hrgn, hrgn, hrgn2, RGN_OR);
-
-        SetRectRgn( hrgn2, rDst.left, rDst.top, rDst.right, rDst.bottom );
-        CombineRgn( hrgn, hrgn, hrgn2, RGN_DIFF );
-        
-        SetRectRgn( hrgn2, rClip.left, rClip.top, rClip.right, rClip.bottom );
-        CombineRgn( hrgn, hrgn, hrgn2, RGN_AND );
-
-        if( lprcUpdate )
-        {
-            GetRgnBox( hrgn, lprcUpdate );
-
-            /* Put the lprcUpdate in logical coordinate */
-            DPtoLP( hdc, (LPPOINT)lprcUpdate, 2 );
-            TRACE("returning lprcUpdate %s\n", wine_dbgstr_rect(lprcUpdate));
-        }
-        if (!hrgnUpdate) DeleteObject( hrgn );
-        DeleteObject( hrgn2 );
-    }
-    return TRUE;
-}
-
-
 /*************************************************************************
  *             ScrollWindowEx   (X11DRV.@)
  *
@@ -165,7 +77,7 @@ INT X11DRV_ScrollWindowEx( HWND hwnd, INT dx, INT dy,
     {
         HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
         X11DRV_StartGraphicsExposures( hDC );
-        X11DRV_ScrollDC( hDC, dx, dy, &rc, &cliprc, hrgnUpdate, rcUpdate );
+        ScrollDC( hDC, dx, dy, &rc, &cliprc, hrgnUpdate, rcUpdate );
         X11DRV_EndGraphicsExposures( hDC, hrgn );
         ReleaseDC( hwnd, hDC );
         if (bUpdate) CombineRgn( hrgnUpdate, hrgnUpdate, hrgn, RGN_OR );
index 3a22b0d54bea72c1c3b8d1dea79e73733ab3b448..3becd0ec74b7649c0f2f6aea9a31dfc10ce129e3 100644 (file)
@@ -98,7 +98,6 @@
 @ cdecl RegisterClipboardFormat(str) X11DRV_RegisterClipboardFormat
 @ cdecl ReleaseDC(long long) X11DRV_ReleaseDC
 @ cdecl ResetSelectionOwner(long long) X11DRV_ResetSelectionOwner
-@ cdecl ScrollDC(long long long ptr ptr long ptr) X11DRV_ScrollDC
 @ cdecl ScrollWindowEx(long long long ptr ptr long ptr long) X11DRV_ScrollWindowEx
 @ cdecl SetClipboardData(long long long) X11DRV_SetClipboardData
 @ cdecl SetFocus(long) X11DRV_SetFocus
index 46756b278257d8db52fc311b0e3c7cfc5c4a7d2e..d31be8c82584440f1c2ab761f305174f47819b66 100644 (file)
@@ -113,7 +113,6 @@ typedef struct tagUSER_DRIVER {
     void   (*pForceWindowRaise)(HWND);
     DWORD  (*pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
     void   (*pReleaseDC)(HWND,HDC);
-    BOOL   (*pScrollDC)(HDC,INT,INT,const RECT*,const RECT*,HRGN,LPRECT);
     INT    (*pScrollWindowEx)(HWND,INT,INT,const RECT*,const RECT*,HRGN,LPRECT,UINT);
     void   (*pSetFocus)(HWND);
     HWND   (*pSetParent)(HWND,HWND);
index 070c12b68c3048af92ed0a81a37723abe8881414..6d26caf9a744875d6eb136bad628999ef39cf6da 100644 (file)
@@ -77,17 +77,88 @@ BOOL WINAPI ScrollWindow( HWND hwnd, INT dx, INT dy,
 /*************************************************************************
  *             ScrollDC (USER32.@)
  *
- *   Only the hrgnUpdate is return in device coordinate.
- *   rcUpdate must be returned in logical coordinate to comply with win API.
- *
+ * dx, dy, lprcScroll and lprcClip are all in logical coordinates (msdn is wrong)
+ * hrgnUpdate is returned in device coordinates with rcUpdate in logical coordinates.
  */
-BOOL WINAPI ScrollDC( HDC hdc, INT dx, INT dy, const RECT *rc,
-                          const RECT *prLClip, HRGN hrgnUpdate,
-                          LPRECT rcUpdate )
+BOOL WINAPI ScrollDC( HDC hdc, INT dx, INT dy, const RECT *lprcScroll,
+                      const RECT *lprcClip, HRGN hrgnUpdate, LPRECT lprcUpdate )
+
 {
-    if (USER_Driver.pScrollDC)
-        return USER_Driver.pScrollDC( hdc, dx, dy, rc, prLClip, hrgnUpdate, rcUpdate );
-    return FALSE;
+    RECT rSrc, rClipped_src, rClip, rDst, offset;
+
+    TRACE( "%p %d,%d hrgnUpdate=%p lprcUpdate = %p\n", hdc, dx, dy, hrgnUpdate, lprcUpdate );
+    if (lprcClip) TRACE( "lprcClip = %s\n", wine_dbgstr_rect(lprcClip));
+    if (lprcScroll) TRACE( "lprcScroll = %s\n", wine_dbgstr_rect(lprcScroll));
+
+    /* compute device clipping region (in device coordinates) */
+
+    if (lprcScroll) rSrc = *lprcScroll;
+    else GetClipBox( hdc, &rSrc );
+    LPtoDP(hdc, (LPPOINT)&rSrc, 2);
+
+    if (lprcClip) rClip = *lprcClip;
+    else GetClipBox( hdc, &rClip );
+    LPtoDP(hdc, (LPPOINT)&rClip, 2);
+
+    IntersectRect( &rClipped_src, &rSrc, &rClip );
+    TRACE("rSrc %s rClip %s clipped rSrc %s\n", wine_dbgstr_rect(&rSrc),
+          wine_dbgstr_rect(&rClip), wine_dbgstr_rect(&rClipped_src));
+
+    rDst = rClipped_src;
+    SetRect(&offset, 0, 0, dx, dy);
+    LPtoDP(hdc, (LPPOINT)&offset, 2);
+    OffsetRect( &rDst, offset.right - offset.left,  offset.bottom - offset.top );
+    TRACE("rDst before clipping %s\n", wine_dbgstr_rect(&rDst));
+    IntersectRect( &rDst, &rDst, &rClip );
+    TRACE("rDst after clipping %s\n", wine_dbgstr_rect(&rDst));
+
+    if (!IsRectEmpty(&rDst))
+    {
+        /* copy bits */
+        RECT rDst_lp = rDst, rSrc_lp = rDst;
+
+        OffsetRect( &rSrc_lp, offset.left - offset.right, offset.top - offset.bottom );
+        DPtoLP(hdc, (LPPOINT)&rDst_lp, 2);
+        DPtoLP(hdc, (LPPOINT)&rSrc_lp, 2);
+
+        if (!BitBlt( hdc, rDst_lp.left, rDst_lp.top,
+                     rDst_lp.right - rDst_lp.left, rDst_lp.bottom - rDst_lp.top,
+                     hdc, rSrc_lp.left, rSrc_lp.top, SRCCOPY))
+            return FALSE;
+    }
+
+    /* compute update areas.  This is the clipped source or'ed with the unclipped source translated minus the
+     clipped src translated (rDst) all clipped to rClip */
+
+    if (hrgnUpdate || lprcUpdate)
+    {
+        HRGN hrgn = hrgnUpdate, hrgn2;
+
+        if (hrgn) SetRectRgn( hrgn, rClipped_src.left, rClipped_src.top, rClipped_src.right, rClipped_src.bottom );
+        else hrgn = CreateRectRgn( rClipped_src.left, rClipped_src.top, rClipped_src.right, rClipped_src.bottom );
+
+        hrgn2 = CreateRectRgnIndirect( &rSrc );
+        OffsetRgn(hrgn2, offset.right - offset.left,  offset.bottom - offset.top );
+        CombineRgn(hrgn, hrgn, hrgn2, RGN_OR);
+
+        SetRectRgn( hrgn2, rDst.left, rDst.top, rDst.right, rDst.bottom );
+        CombineRgn( hrgn, hrgn, hrgn2, RGN_DIFF );
+
+        SetRectRgn( hrgn2, rClip.left, rClip.top, rClip.right, rClip.bottom );
+        CombineRgn( hrgn, hrgn, hrgn2, RGN_AND );
+
+        if( lprcUpdate )
+        {
+            GetRgnBox( hrgn, lprcUpdate );
+
+            /* Put the lprcUpdate in logical coordinate */
+            DPtoLP( hdc, (LPPOINT)lprcUpdate, 2 );
+            TRACE("returning lprcUpdate %s\n", wine_dbgstr_rect(lprcUpdate));
+        }
+        if (!hrgnUpdate) DeleteObject( hrgn );
+        DeleteObject( hrgn2 );
+    }
+    return TRUE;
 }