Commit f68017b8 authored by Jukka Heinonen's avatar Jukka Heinonen Committed by Alexandre Julliard

Allow application to use VGA window that overlaps framebuffer only

partially.
parent 528e6e98
...@@ -363,6 +363,32 @@ typedef struct { ...@@ -363,6 +363,32 @@ typedef struct {
int ret; int ret;
} ModeSet; } ModeSet;
/**********************************************************************
* VGA_SyncWindow
*
* Copy VGA window into framebuffer (if argument is TRUE) or
* part of framebuffer into VGA window (if argument is FALSE).
*/
static void VGA_SyncWindow( BOOL target_is_fb )
{
int size = VGA_WINDOW_SIZE;
/* Window does not overlap framebuffer. */
if (vga_fb_window >= vga_fb_size)
return;
/* Check if window overlaps framebuffer only partially. */
if (vga_fb_size - vga_fb_window < VGA_WINDOW_SIZE)
size = vga_fb_size - vga_fb_window;
if (target_is_fb)
memmove( vga_fb_data + vga_fb_window, VGA_WINDOW_START, size );
else
memmove( VGA_WINDOW_START, vga_fb_data + vga_fb_window, size );
}
static void WINAPI VGA_DoExit(ULONG_PTR arg) static void WINAPI VGA_DoExit(ULONG_PTR arg)
{ {
VGA_DeinstallTimer(); VGA_DeinstallTimer();
...@@ -603,17 +629,15 @@ void VGA_SetWindowStart(int start) ...@@ -603,17 +629,15 @@ void VGA_SetWindowStart(int start)
if(vga_fb_window == -1) if(vga_fb_window == -1)
FIXME("Remove VGA memory emulation.\n"); FIXME("Remove VGA memory emulation.\n");
else if(vga_fb_window + VGA_WINDOW_SIZE < vga_fb_size) else
memmove(vga_fb_data + vga_fb_window, VGA_WINDOW_START, VGA_SyncWindow( TRUE );
VGA_WINDOW_SIZE);
vga_fb_window = start; vga_fb_window = start;
if(vga_fb_window == -1) if(vga_fb_window == -1)
FIXME("Install VGA memory emulation.\n"); FIXME("Install VGA memory emulation.\n");
else if(vga_fb_window + VGA_WINDOW_SIZE < vga_fb_size) else
memmove( VGA_WINDOW_START, vga_fb_data + vga_fb_window, VGA_SyncWindow( FALSE );
VGA_WINDOW_SIZE);
LeaveCriticalSection(&vga_lock); LeaveCriticalSection(&vga_lock);
} }
...@@ -925,9 +949,8 @@ static void VGA_Poll_Graphics(void) ...@@ -925,9 +949,8 @@ static void VGA_Poll_Graphics(void)
/* /*
* Synchronize framebuffer contents. * Synchronize framebuffer contents.
*/ */
if(vga_fb_window != -1 && vga_fb_window + VGA_WINDOW_SIZE < vga_fb_size) if (vga_fb_window != -1)
memmove(vga_fb_data + vga_fb_window, VGA_WINDOW_START, VGA_SyncWindow( TRUE );
VGA_WINDOW_SIZE);
/* /*
* Double VGA framebuffer (320x200 -> 640x400), if needed. * Double VGA framebuffer (320x200 -> 640x400), if needed.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment