summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-12-19 18:46:40 +0000
committerfrosch <frosch@openttd.org>2009-12-19 18:46:40 +0000
commit29d6491605bb13e7a751b2a1a8b8728f17bbc54b (patch)
treed36add5885667a83011cef1fdbfe90d5ce548dfd /src
parent7572f95448308fd19cd91ea1416ddf6320f51247 (diff)
downloadopenttd-29d6491605bb13e7a751b2a1a8b8728f17bbc54b.tar.xz
(svn r18545) -Fix [FS#3292]: Assign '_screen.dst_ptr' as soon as it is allocated.
Diffstat (limited to 'src')
-rw-r--r--src/video/allegro_v.cpp5
-rw-r--r--src/video/cocoa/cocoa_v.mm1
-rw-r--r--src/video/cocoa/event.mm4
-rw-r--r--src/video/dedicated_v.cpp2
-rw-r--r--src/video/null_v.cpp2
-rw-r--r--src/video/sdl_v.cpp3
6 files changed, 6 insertions, 11 deletions
diff --git a/src/video/allegro_v.cpp b/src/video/allegro_v.cpp
index 4dc588159..d1717f9b1 100644
--- a/src/video/allegro_v.cpp
+++ b/src/video/allegro_v.cpp
@@ -211,9 +211,10 @@ static bool CreateMainSurface(uint w, uint h)
_screen.width = _allegro_screen->w;
_screen.height = _allegro_screen->h;
_screen.pitch = ((byte*)screen->line[1] - (byte*)screen->line[0]) / (bpp / 8);
+ _screen.dst_ptr = _allegro_screen->line[0];
/* Initialise the screen so we don't blit garbage to the screen */
- memset(_allegro_screen->line[0], 0, _screen.height * _screen.pitch);
+ memset(_screen.dst_ptr, 0, _screen.height * _screen.pitch);
/* Set the mouse at the place where we expect it */
poll_mouse();
@@ -520,7 +521,6 @@ void VideoDriver_Allegro::MainLoop()
GameLoop();
- _screen.dst_ptr = _allegro_screen->line[0];
UpdateWindows();
if (++pal_tick > 4) {
CheckPaletteAnim();
@@ -529,7 +529,6 @@ void VideoDriver_Allegro::MainLoop()
DrawSurfaceToScreen();
} else {
CSleep(1);
- _screen.dst_ptr = _allegro_screen->line[0];
NetworkDrawChatMessage();
DrawMouseCursor();
DrawSurfaceToScreen();
diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm
index 530e1ddb1..0a0834686 100644
--- a/src/video/cocoa/cocoa_v.mm
+++ b/src/video/cocoa/cocoa_v.mm
@@ -194,6 +194,7 @@ void QZ_GameSizeChanged()
_screen.width = _cocoa_subdriver->GetWidth();
_screen.height = _cocoa_subdriver->GetHeight();
_screen.pitch = _cocoa_subdriver->GetWidth();
+ _screen.dst_ptr = _cocoa_subdriver->GetPixelBuffer();
_fullscreen = _cocoa_subdriver->IsFullscreen();
GameSizeChanged();
diff --git a/src/video/cocoa/event.mm b/src/video/cocoa/event.mm
index fef866f53..284be0657 100644
--- a/src/video/cocoa/event.mm
+++ b/src/video/cocoa/event.mm
@@ -603,7 +603,6 @@ void QZ_GameLoop()
uint32 st = 0;
#endif
- _screen.dst_ptr = _cocoa_subdriver->GetPixelBuffer();
DisplaySplashImage();
QZ_CheckPaletteAnim();
_cocoa_subdriver->Draw(true);
@@ -611,7 +610,6 @@ void QZ_GameLoop()
for (int i = 0; i < 2; i++) GameLoop();
- _screen.dst_ptr = _cocoa_subdriver->GetPixelBuffer();
UpdateWindows();
QZ_CheckPaletteAnim();
_cocoa_subdriver->Draw();
@@ -651,7 +649,6 @@ void QZ_GameLoop()
GameLoop();
- _screen.dst_ptr = _cocoa_subdriver->GetPixelBuffer();
UpdateWindows();
if (++pal_tick > 4) {
QZ_CheckPaletteAnim();
@@ -666,7 +663,6 @@ void QZ_GameLoop()
#ifdef _DEBUG
st += GetTick() - st0;
#endif
- _screen.dst_ptr = _cocoa_subdriver->GetPixelBuffer();
NetworkDrawChatMessage();
DrawMouseCursor();
_cocoa_subdriver->Draw();
diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp
index a88904987..a6cb3dec2 100644
--- a/src/video/dedicated_v.cpp
+++ b/src/video/dedicated_v.cpp
@@ -145,6 +145,7 @@ const char *VideoDriver_Dedicated::Start(const char * const *parm)
_screen.width = _screen.pitch = _cur_resolution.width;
_screen.height = _cur_resolution.height;
+ _screen.dst_ptr = _dedicated_video_mem;
ScreenSizeChanged();
#if defined(WINCE)
@@ -302,7 +303,6 @@ void VideoDriver_Dedicated::MainLoop()
next_tick = cur_ticks + 30;
GameLoop();
- _screen.dst_ptr = _dedicated_video_mem;
UpdateWindows();
}
CSleep(1);
diff --git a/src/video/null_v.cpp b/src/video/null_v.cpp
index 745d0531d..f7f23c6d6 100644
--- a/src/video/null_v.cpp
+++ b/src/video/null_v.cpp
@@ -21,6 +21,7 @@ const char *VideoDriver_Null::Start(const char * const *parm)
this->ticks = GetDriverParamInt(parm, "ticks", 1000);
_screen.width = _screen.pitch = _cur_resolution.width;
_screen.height = _cur_resolution.height;
+ _screen.dst_ptr = NULL;
ScreenSizeChanged();
/* Do not render, nor blit */
@@ -39,7 +40,6 @@ void VideoDriver_Null::MainLoop()
for (i = 0; i < this->ticks; i++) {
GameLoop();
- _screen.dst_ptr = NULL;
UpdateWindows();
}
}
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index 1af499d0a..d252287fb 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -249,6 +249,7 @@ static bool CreateMainSurface(uint w, uint h)
_screen.width = newscreen->w;
_screen.height = newscreen->h;
_screen.pitch = newscreen->pitch / (bpp / 8);
+ _screen.dst_ptr = newscreen->pixels;
_sdl_screen = newscreen;
InitPalette();
@@ -587,7 +588,6 @@ void VideoDriver_SDL::MainLoop()
if (_draw_threaded) _draw_mutex->BeginCritical();
- _screen.dst_ptr = _sdl_screen->pixels;
UpdateWindows();
if (++pal_tick > 4) {
CheckPaletteAnim();
@@ -599,7 +599,6 @@ void VideoDriver_SDL::MainLoop()
CSleep(1);
if (_draw_threaded) _draw_mutex->BeginCritical();
- _screen.dst_ptr = _sdl_screen->pixels;
NetworkDrawChatMessage();
DrawMouseCursor();
}