summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-05-14 15:20:50 +0000
committertruelight <truelight@openttd.org>2007-05-14 15:20:50 +0000
commitd7b4fb80d0e14ca3f8d56cda920e7f0d4e81419d (patch)
tree8b4e24cad04a15b76b5449bbb993f8b8fa1dccca /src/video
parent62fe9c2e420238ba4db54f8cf56afc25b1167051 (diff)
downloadopenttd-d7b4fb80d0e14ca3f8d56cda920e7f0d4e81419d.tar.xz
(svn r9835) -Codechange: use Pixel typedef instead of byte where ever possible
Diffstat (limited to 'src/video')
-rw-r--r--src/video/dedicated_v.cpp6
-rw-r--r--src/video/null_v.cpp6
-rw-r--r--src/video/sdl_v.cpp2
-rw-r--r--src/video/win32_v.cpp2
4 files changed, 8 insertions, 8 deletions
diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp
index b3e11a118..046dc2ac8 100644
--- a/src/video/dedicated_v.cpp
+++ b/src/video/dedicated_v.cpp
@@ -112,7 +112,7 @@ static void CloseWindowsConsoleThread()
#endif
-static void *_dedicated_video_mem;
+static Pixel *_dedicated_video_mem;
extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm);
extern void SwitchMode(int new_mode);
@@ -122,7 +122,7 @@ static const char *DedicatedVideoStart(const char * const *parm)
{
_screen.width = _screen.pitch = _cur_resolution[0];
_screen.height = _cur_resolution[1];
- _dedicated_video_mem = malloc(_cur_resolution[0]*_cur_resolution[1]);
+ _dedicated_video_mem = (Pixel *)malloc(_cur_resolution[0] * _cur_resolution[1] * sizeof(Pixel));
SetDebugString("net=6");
@@ -283,7 +283,7 @@ static void DedicatedVideoMainLoop()
next_tick = cur_ticks + 30;
GameLoop();
- _screen.dst_ptr = (Pixel*)_dedicated_video_mem;
+ _screen.dst_ptr = _dedicated_video_mem;
UpdateWindows();
}
CSleep(1);
diff --git a/src/video/null_v.cpp b/src/video/null_v.cpp
index cae43bc0c..fd15954d9 100644
--- a/src/video/null_v.cpp
+++ b/src/video/null_v.cpp
@@ -7,13 +7,13 @@
#include "../window.h"
#include "null_v.h"
-static void* _null_video_mem = NULL;
+static Pixel *_null_video_mem = NULL;
static const char* NullVideoStart(const char* const* parm)
{
_screen.width = _screen.pitch = _cur_resolution[0];
_screen.height = _cur_resolution[1];
- _null_video_mem = malloc(_cur_resolution[0] * _cur_resolution[1]);
+ _null_video_mem = (Pixel *)malloc(_cur_resolution[0] * _cur_resolution[1] * sizeof(Pixel));
return NULL;
}
@@ -27,7 +27,7 @@ static void NullVideoMainLoop()
for (i = 0; i < 1000; i++) {
GameLoop();
- _screen.dst_ptr = (Pixel*)_null_video_mem;
+ _screen.dst_ptr = _null_video_mem;
UpdateWindows();
}
}
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index 668d993b4..9a70b55a6 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -195,7 +195,7 @@ static bool CreateMainSurface(int w, int h)
_screen.width = newscreen->w;
_screen.height = newscreen->h;
- _screen.pitch = newscreen->pitch;
+ _screen.pitch = newscreen->pitch / sizeof(Pixel);
_sdl_screen = newscreen;
InitPalette();
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index 578f323c9..cee533c7c 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -671,7 +671,7 @@ static bool AllocateDibSection(int w, int h)
if (_wnd.double_size) {
w = ALIGN(w, 4);
- _wnd.alloced_bits = _wnd.buffer_bits = (Pixel*)malloc(w * h);
+ _wnd.alloced_bits = _wnd.buffer_bits = (Pixel *)malloc(w * h * sizeof(Pixel));
w *= 2;
h *= 2;
}