aboutsummaryrefslogtreecommitdiff
path: root/x11.cpp
diff options
context:
space:
mode:
authorLionel Ulmer2002-05-01 09:41:54 +0000
committerLionel Ulmer2002-05-01 09:41:54 +0000
commit0fb4bcb0ebc06894aad0bb514fc1fa56737a870c (patch)
tree460d2fe489e93c15176ec75ae279ff997789cc58 /x11.cpp
parent04efaa91757446c84439ec2d91ab7e26ba938ec1 (diff)
downloadscummvm-rg350-0fb4bcb0ebc06894aad0bb514fc1fa56737a870c.tar.gz
scummvm-rg350-0fb4bcb0ebc06894aad0bb514fc1fa56737a870c.tar.bz2
scummvm-rg350-0fb4bcb0ebc06894aad0bb514fc1fa56737a870c.zip
Zero-initialize the palette and the frame buffer.
svn-id: r4154
Diffstat (limited to 'x11.cpp')
-rw-r--r--x11.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/x11.cpp b/x11.cpp
index e4e05083d2..c6d9dfd0f5 100644
--- a/x11.cpp
+++ b/x11.cpp
@@ -133,9 +133,9 @@ private:
int scumm_x, scumm_y;
#ifdef USE_XV_SCALING
- unsigned int palette[256];
+ unsigned int *palette;
#else
- unsigned short palette[256];
+ unsigned short *palette;
#endif
bool _palette_changed;
Display *display;
@@ -380,8 +380,13 @@ OSystem_X11::OSystem_X11()
out_of_loop:
create_empty_cursor();
- /* Initialize the 'local' frame buffer */
- local_fb = (unsigned char *)malloc(320 * 200 * sizeof(unsigned char));
+ /* Initialize the 'local' frame buffer and the palette */
+ local_fb = (unsigned char *)calloc(320 * 200, sizeof(unsigned char));
+#ifdef USE_XV_SCALING
+ palette = (unsigned int *)calloc(256, sizeof(unsigned int));
+#else
+ palette = (unsigned short *)calloc(256, sizeof(unsigned short));
+#endif
/* And finally start the local timer */
gettimeofday(&start_time, NULL);
@@ -483,6 +488,7 @@ void OSystem_X11::update_screen_helper(const dirty_square * d, dirty_square * do
#else
unsigned short *ptr_dst = ((unsigned short *)image->data) + (320 * d->y) + d->x;
#endif
+
for (y = 0; y < d->h; y++) {
for (x = 0; x < d->w; x++) {
*ptr_dst++ = palette[*ptr_src++];