]> git.eshelyaron.com Git - emacs.git/commitdiff
(x_scroll_run): Use ScrollWindowEx in place of BitBlt.
authorJason Rumney <jasonr@gnu.org>
Thu, 24 Jan 2002 20:29:39 +0000 (20:29 +0000)
committerJason Rumney <jasonr@gnu.org>
Thu, 24 Jan 2002 20:29:39 +0000 (20:29 +0000)
If region left to draw is not what was expected, mark the frame as
garbaged.

src/ChangeLog
src/w32term.c

index 8af6cb3adecd533dd4918a53906aa0c0b3131e27..147ee0c8fee7fdf56d1a3937970348098520168b 100644 (file)
@@ -1,3 +1,12 @@
+2002-01-24  Jason Rumney  <jasonr@gnu.org>
+
+       * w32term.c (x_scroll_run): Use ScrollWindowEx in place of BitBlt.
+       If region left to draw is not what was expected, mark the frame as
+       garbaged.
+
+       * w32fns.c (w32_wnd_proc) <WM_PAINT>: Initialize update_rect.
+       Combine the regions returned by BeginPaint and GetUpdateRect.
+
 2002-01-20  Eli Zaretskii  <eliz@is.elta.co.il>
 
        * unexelf.c (unexec) [__sgi]: Support the .got sections.
index 19c1d07853e72c8ad2b8495897d0159d2fe44851..88cbd325401be1036cf09b4df8b6031de9ba353d 100644 (file)
@@ -5479,7 +5479,8 @@ x_scroll_run (w, run)
 {
   struct frame *f = XFRAME (w->frame);
   int x, y, width, height, from_y, to_y, bottom_y;
-  HDC hdc = get_frame_dc (f);
+  HWND hwnd = FRAME_W32_WINDOW (f);
+  HRGN expect_dirty;
 
   /* Get frame-relative bounding box of the text display area of W,
      without mode lines.  Include in this box the flags areas to the
@@ -5500,6 +5501,7 @@ x_scroll_run (w, run)
        height = bottom_y - from_y;
       else
        height = run->height;
+      expect_dirty = CreateRectRgn (x, y + height, x + width, bottom_y);
     }
   else
     {
@@ -5509,6 +5511,7 @@ x_scroll_run (w, run)
        height = bottom_y - to_y;
       else
        height = run->height;
+      expect_dirty = CreateRectRgn (x, y, x + width, to_y);
     }
 
   BLOCK_INPUT;
@@ -5517,10 +5520,32 @@ x_scroll_run (w, run)
   updated_window = w;
   x_clear_cursor (w);
 
-  BitBlt (hdc, x, to_y, width, height, hdc, x, from_y, SRCCOPY);
-  
+  {
+    RECT from;
+    RECT to;
+    HRGN dirty = CreateRectRgn (0, 0, 0, 0);
+    HRGN combined = CreateRectRgn (0, 0, 0, 0);
+
+    from.left = to.left = x;
+    from.right = to.right = x + width;
+    from.top = from_y;
+    from.bottom = from_y + height;
+    to.top = y;
+    to.bottom = bottom_y;
+
+    ScrollWindowEx (hwnd, 0, to_y - from_y, &from, &to, dirty,
+                   NULL, SW_INVALIDATE);
+
+    /* Combine this with what we expect to be dirty. This covers the
+       case where not all of the region we expect is actually dirty.  */
+    CombineRgn (combined, dirty, expect_dirty, RGN_OR);
+
+    /* If the dirty region is not what we expected, redraw the entire frame.  */
+    if (!EqualRgn (combined, expect_dirty))
+      SET_FRAME_GARBAGED (f);
+  }
+
   UNBLOCK_INPUT;
-  release_frame_dc (f, hdc);
 }