summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2005-09-27 22:33:42 +0000
committerSimon Howard2005-09-27 22:33:42 +0000
commitf22561be3ef02d8b7c4f7c2720654aa797d6e24e (patch)
tree6aef89a91edea64738117dfe8390012c110417de
parentf69e905d9c7b0d4d3ec9f2d5f268173b916e0e60 (diff)
downloadchocolate-doom-f22561be3ef02d8b7c4f7c2720654aa797d6e24e.tar.gz
chocolate-doom-f22561be3ef02d8b7c4f7c2720654aa797d6e24e.tar.bz2
chocolate-doom-f22561be3ef02d8b7c4f7c2720654aa797d6e24e.zip
Always use SDL_Flip to update the screen. Fixes problems in Windows when
running fullscreen, introduced by fixes to the disk icon code. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 140
-rw-r--r--src/i_video.c78
1 files changed, 43 insertions, 35 deletions
diff --git a/src/i_video.c b/src/i_video.c
index 903883ff..d89c8561 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: i_video.c 134 2005-09-26 21:44:30Z fraggle $
+// $Id: i_video.c 140 2005-09-27 22:33:42Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,10 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.33 2005/09/27 22:33:42 fraggle
+// Always use SDL_Flip to update the screen. Fixes problems in Windows when
+// running fullscreen, introduced by fixes to the disk icon code.
+//
// Revision 1.32 2005/09/26 21:44:30 fraggle
// Fix melting crap on startup - oops
//
@@ -137,7 +141,7 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: i_video.c 134 2005-09-26 21:44:30Z fraggle $";
+rcsid[] = "$Id: i_video.c 140 2005-09-27 22:33:42Z fraggle $";
#include <SDL.h>
#include <ctype.h>
@@ -511,22 +515,14 @@ void UpdateGrab(void)
}
// Update a small portion of the screen
+//
+// Does 2x stretching and buffer blitting if neccessary
-static void UpdateArea(int x1, int y1, int x2, int y2, boolean always_update)
+static void BlitArea(int x1, int y1, int x2, int y2)
{
int w = x2 - x1;
int h = y2 - y1;
- if (palette_to_set && !always_update)
- {
- // If we have a palette to set, the only way to update is to
- // update the entire screen
- // If we are only updating part of the screen (disk icon), we
- // cannot update the screen
-
- return;
- }
-
if (screenmultiply == 1 && !native_surface)
{
byte *bufp, *screenp;
@@ -585,22 +581,21 @@ static void UpdateArea(int x1, int y1, int x2, int y2, boolean always_update)
SDL_UnlockSurface(screen);
}
+}
- // draw to screen
-
- if (palette_to_set)
- {
- SDL_SetColors(screen, palette, 0, 256);
- palette_to_set = 0;
- }
- else
- {
- SDL_UpdateRect(screen,
- x1 * screenmultiply,
- y1 * screenmultiply,
- w * screenmultiply,
- h * screenmultiply);
- }
+void UpdateRect(int x1, int y1, int x2, int y2)
+{
+ // Do stretching and blitting
+
+ BlitArea(x1, y1, x2, y2);
+
+ // Update the area
+
+ SDL_UpdateRect(screen,
+ x1 * screenmultiply,
+ y1 * screenmultiply,
+ (x2-x1) * screenmultiply,
+ (y2-y1) * screenmultiply);
}
void I_BeginRead(void)
@@ -625,9 +620,8 @@ void I_BeginRead(void)
memcpy(screenloc, disk_image + y * disk_image_w, disk_image_w);
}
- UpdateArea(SCREENWIDTH - disk_image_w, SCREENHEIGHT - disk_image_h,
- SCREENWIDTH, SCREENHEIGHT,
- false);
+ UpdateRect(SCREENWIDTH - disk_image_w, SCREENHEIGHT - disk_image_h,
+ SCREENWIDTH, SCREENHEIGHT);
}
void I_EndRead(void)
@@ -649,9 +643,8 @@ void I_EndRead(void)
memcpy(screenloc, saved_background + y * disk_image_w, disk_image_w);
}
- UpdateArea(SCREENWIDTH - disk_image_w, SCREENHEIGHT - disk_image_h,
- SCREENWIDTH, SCREENHEIGHT,
- false);
+ UpdateRect(SCREENWIDTH - disk_image_w, SCREENHEIGHT - disk_image_h,
+ SCREENWIDTH, SCREENHEIGHT);
}
//
@@ -689,7 +682,22 @@ void I_FinishUpdate (void)
}
- UpdateArea(0, 0, SCREENWIDTH, SCREENHEIGHT, true);
+ // draw to screen
+
+ BlitArea(0, 0, SCREENWIDTH, SCREENHEIGHT);
+
+ // If we have a palette to set, the act of setting the palette
+ // updates the screen
+
+ if (palette_to_set)
+ {
+ SDL_SetColors(screen, palette, 0, 256);
+ palette_to_set = 0;
+ }
+ else
+ {
+ SDL_Flip(screen);
+ }
}