winedos / Fix text mode scrolling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changelog:
  Add scrolling support for VGA text mode.




Index: dlls/winedos/vga.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/vga.c,v
retrieving revision 1.34
diff -u -r1.34 vga.c
--- dlls/winedos/vga.c	1 Apr 2003 00:12:50 -0000	1.34
+++ dlls/winedos/vga.c	6 May 2003 19:10:12 -0000
@@ -781,9 +781,19 @@
         vga_text_x++;
     }
 
-    /*
-     * FIXME: add line wrapping and scrolling
-     */
+    if (vga_text_x >= vga_text_width)
+    {
+        vga_text_x = 0;
+        vga_text_y++;
+    }
+
+    if (vga_text_y >= vga_text_height)
+    {
+        vga_text_y = vga_text_height - 1;
+        VGA_ScrollUpText( 0, 0, 
+                          vga_text_height - 1, vga_text_width - 1, 
+                          1, vga_text_attr );
+    }
 
     /*
      * If we don't have a console, write directly to standard output.
@@ -814,18 +824,56 @@
     LeaveCriticalSection(&vga_lock);
 }
 
-void VGA_ScrollUpText(unsigned row1, unsigned col1,
-                     unsigned row2, unsigned col2,
-                     unsigned lines, BYTE attr)
+void VGA_ScrollUpText(unsigned row1,  unsigned col1,
+                      unsigned row2,  unsigned col2,
+                      unsigned lines, BYTE attr)
 {
-    FIXME("not implemented\n");
+    char    *buffer = VGA_AlphaBuffer();
+    unsigned y;
+
+    EnterCriticalSection(&vga_lock);
+
+    /*
+     * Scroll buffer.
+     */
+    for (y = row1; y <= row2 - lines; y++)
+        memmove( buffer + col1 + y * vga_text_width * 2,
+                 buffer + col1 + (y + lines) * vga_text_width * 2,
+                 (col2 - col1 + 1) * 2 );
+
+    /*
+     * Fill exposed lines.
+     */
+    for (y = max(row1, row2 - lines + 1); y <= row2; y++)
+        VGA_WriteChars( col1, y, ' ', attr, col2 - col1 + 1 );
+
+    LeaveCriticalSection(&vga_lock);
 }
 
-void VGA_ScrollDownText(unsigned row1, unsigned col1,
-                       unsigned row2, unsigned col2,
-                       unsigned lines, BYTE attr)
+void VGA_ScrollDownText(unsigned row1,  unsigned col1,
+                        unsigned row2,  unsigned col2,
+                        unsigned lines, BYTE attr)
 {
-    FIXME("not implemented\n");
+    char    *buffer = VGA_AlphaBuffer();
+    unsigned y;
+
+    EnterCriticalSection(&vga_lock);
+
+    /*
+     * Scroll buffer.
+     */
+    for (y = row2; y >= row1 + lines; y--)
+        memmove( buffer + col1 + y * vga_text_width * 2,
+                 buffer + col1 + (y - lines) * vga_text_width * 2,
+                 (col2 - col1 + 1) * 2 );
+
+    /*
+     * Fill exposed lines.
+     */
+    for (y = row1; y <= min(row1 + lines - 1, row2); y++)
+        VGA_WriteChars( col1, y, ' ', attr, col2 - col1 + 1 );
+
+    LeaveCriticalSection(&vga_lock);
 }
 
 void VGA_GetCharacterAtCursor(BYTE *ascii, BYTE *attr)




-- 
Jukka Heinonen <http://www.iki.fi/jhei/>


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux