Changeset - r2062:c4c0326f1777
[Not reviewed]
master
0 6 0
tron - 19 years ago 2005-07-15 14:16:14
tron@openttd.org
(svn r2571) Add explicit type Pixel for ... Pixels
6 files changed with 32 insertions and 33 deletions:
0 comments (0 inline, 0 general)
gfx.c
Show inline comments
 
@@ -11,7 +11,7 @@ Colour _cur_palette[256];
 
static void GfxMainBlitter(const Sprite *sprite, int x, int y, int mode);
 

	
 
static int _stringwidth_out;
 
static byte _cursor_backup[64*64];
 
static Pixel _cursor_backup[64 * 64];
 
static Rect _invalid_rect;
 
static const byte *_color_remap_ptr;
 
static byte _string_colorremap[3];
 
@@ -37,8 +37,8 @@ void memcpy_pitch(void *d, void *s, int 
 

	
 
void GfxScroll(int left, int top, int width, int height, int xo, int yo)
 
{
 
	byte *src;
 
	byte *dst;
 
	const Pixel *src;
 
	Pixel *dst;
 
	int p;
 
	int ht;
 

	
 
@@ -109,7 +109,7 @@ void GfxScroll(int left, int top, int wi
 
void GfxFillRect(int left, int top, int right, int bottom, int color)
 
{
 
	DrawPixelInfo *dpi = _cur_dpi;
 
	byte *dst;
 
	Pixel *dst;
 
	const int otop = top;
 
	const int oleft = left;
 

	
 
@@ -574,7 +574,7 @@ typedef struct BlitterParams {
 
	int start_x, start_y;
 
	const byte* sprite;
 
	const byte* sprite_org;
 
	byte *dst;
 
	Pixel *dst;
 
	int mode;
 
	int width, height;
 
	int width_org;
 
@@ -589,7 +589,7 @@ static void GfxBlitTileZoomIn(BlitterPar
 
	const byte* src;
 
	int num, skip;
 
	byte done;
 
	byte *dst;
 
	Pixel *dst;
 
	const byte* ctab;
 

	
 
	if (bp->mode & 1) {
 
@@ -718,7 +718,7 @@ static void GfxBlitTileZoomIn(BlitterPar
 
static void GfxBlitZoomInUncomp(BlitterParams *bp)
 
{
 
	const byte *src = bp->sprite;
 
	byte *dst = bp->dst;
 
	Pixel *dst = bp->dst;
 
	int height = bp->height;
 
	int width = bp->width;
 
	int i;
 
@@ -791,7 +791,7 @@ static void GfxBlitTileZoomMedium(Blitte
 
	const byte* src;
 
	int num, skip;
 
	byte done;
 
	byte *dst;
 
	Pixel *dst;
 
	const byte* ctab;
 

	
 
	if (bp->mode & 1) {
 
@@ -945,7 +945,7 @@ static void GfxBlitTileZoomMedium(Blitte
 
static void GfxBlitZoomMediumUncomp(BlitterParams *bp)
 
{
 
	const byte *src = bp->sprite;
 
	byte *dst = bp->dst;
 
	Pixel *dst = bp->dst;
 
	int height = bp->height;
 
	int width = bp->width;
 
	int i;
 
@@ -996,7 +996,7 @@ static void GfxBlitTileZoomOut(BlitterPa
 
	const byte* src;
 
	int num, skip;
 
	byte done;
 
	byte *dst;
 
	Pixel *dst;
 
	const byte* ctab;
 

	
 
	if (bp->mode & 1) {
 
@@ -1209,7 +1209,7 @@ static void GfxBlitTileZoomOut(BlitterPa
 
static void GfxBlitZoomOutUncomp(BlitterParams *bp)
 
{
 
	const byte* src = bp->sprite;
 
	byte *dst = bp->dst;
 
	Pixel *dst = bp->dst;
 
	int height = bp->height;
 
	int width = bp->width;
 
	int i;
gfx.h
Show inline comments
 
#ifndef GFX_H
 
#define GFX_H
 

	
 
typedef byte Pixel;
 

	
 
typedef struct ColorList {
 
	byte unk0, unk1, unk2;
 
@@ -10,7 +11,7 @@ typedef struct ColorList {
 
} ColorList;
 

	
 
struct DrawPixelInfo {
 
	byte *dst_ptr;
 
	Pixel *dst_ptr;
 
	int left, top, width, height;
 
	int pitch;
 
	uint16 zoom;
screenshot.c
Show inline comments
 
@@ -57,7 +57,7 @@ static bool MakeBmpImage(const char *nam
 
	BitmapFileHeader bfh;
 
	BitmapInfoHeader bih;
 
	RgbQuad rq[256];
 
	byte *buff;
 
	Pixel *buff;
 
	FILE *f;
 
	uint i, padw;
 
	uint n, maxlines;
 
@@ -159,7 +159,7 @@ static void PNGAPI png_my_warning(png_st
 
static bool MakePNGImage(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette)
 
{
 
	png_color rq[256];
 
	byte *buff;
 
	Pixel *buff;
 
	FILE *f;
 
	uint i, y, n;
 
	uint maxlines;
 
@@ -272,7 +272,7 @@ assert_compile(sizeof(PcxHeader) == 128)
 

	
 
static bool MakePCXImage(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette)
 
{
 
	byte *buff;
 
	Pixel *buff;
 
	FILE *f;
 
	uint maxlines;
 
	uint y;
 
@@ -330,14 +330,14 @@ static bool MakePCXImage(const char *nam
 

	
 
		// write them to pcx
 
		for (i = 0; i != n; i++) {
 
			const byte* bufp = buff + i * w;
 
			const Pixel* bufp = buff + i * w;
 
			byte runchar = bufp[0];
 
			uint runcount = 1;
 
			uint j;
 

	
 
			// for each pixel...
 
			for (j = 1; j < w; j++) {
 
				byte ch = bufp[j];
 
				Pixel ch = bufp[j];
 

	
 
				if (ch != runchar || runcount >= 0x3f) {
 
					if (runcount > 1 || (runchar & 0xC0) == 0xC0)
 
@@ -426,7 +426,7 @@ void SetScreenshotFormat(int i)
 
}
 

	
 
// screenshot generator that dumps the current video buffer
 
static void CurrentScreenCallback(void *userdata, byte *buf, uint y, uint pitch, uint n)
 
static void CurrentScreenCallback(void *userdata, Pixel *buf, uint y, uint pitch, uint n)
 
{
 
	for (; n > 0; --n) {
 
		memcpy(buf, _screen.dst_ptr + y * _screen.pitch, _screen.width);
 
@@ -436,7 +436,7 @@ static void CurrentScreenCallback(void *
 
}
 

	
 
// generate a large piece of the world
 
static void LargeWorldCallback(void *userdata, byte *buf, uint y, uint pitch, uint n)
 
static void LargeWorldCallback(void *userdata, Pixel *buf, uint y, uint pitch, uint n)
 
{
 
	ViewPort *vp = (ViewPort *)userdata;
 
	DrawPixelInfo dpi, *old_dpi;
smallmap_gui.c
Show inline comments
 
@@ -190,9 +190,8 @@ static const uint16 * const _legend_tabl
 
};
 

	
 
#if defined(TTD_ALIGNMENT_4)
 
	static inline void WRITE_PIXELS(void *dst, uint32 val)
 
	static inline void WRITE_PIXELS(Pixel* d, uint32 val)
 
	{
 
		byte *d = (byte*)dst;
 
#	if defined(TTD_BIG_ENDIAN)
 
		d[0] = (byte)(val >> 24);
 
		d[1] = (byte)(val >> 16);
 
@@ -207,9 +206,8 @@ static const uint16 * const _legend_tabl
 
	}
 

	
 
/* need to use OR, otherwise we will overwrite the wrong pixels at the edges :( */
 
	static inline void WRITE_PIXELS_OR(void *dst, uint32 val)
 
	static inline void WRITE_PIXELS_OR(Pixel* d, uint32 val)
 
	{
 
		byte *d = (byte*)dst;
 
#	if defined(TTD_BIG_ENDIAN)
 
		d[0] |= (byte)(val >> 24);
 
		d[1] |= (byte)(val >> 16);
 
@@ -324,9 +322,9 @@ typedef uint32 GetSmallMapPixels(TileInd
 
 * @param proc Pointer to the colour function
 
 * @see GetSmallMapPixels(TileIndex)
 
 */
 
static void DrawSmallMapStuff(byte *dst, uint xc, uint yc, int pitch, int reps, uint32 mask, GetSmallMapPixels *proc)
 
static void DrawSmallMapStuff(Pixel *dst, uint xc, uint yc, int pitch, int reps, uint32 mask, GetSmallMapPixels *proc)
 
{
 
	byte *dst_ptr_end = _screen.dst_ptr + _screen.width * _screen.height - _screen.width;
 
	Pixel *dst_ptr_end = _screen.dst_ptr + _screen.width * _screen.height - _screen.width;
 

	
 
	do {
 
		// check if the tile (xc,yc) is within the map range
 
@@ -589,7 +587,7 @@ static void DrawSmallMap(DrawPixelInfo *
 
{
 
	DrawPixelInfo *old_dpi;
 
	int dx,dy, x, y, x2, y2;
 
	byte *ptr;
 
	Pixel *ptr;
 
	int tile_x;
 
	int tile_y;
 
	ViewPort *vp;
texteff.c
Show inline comments
 
@@ -43,7 +43,7 @@ const int _textmessage_box_y = 150;  // 
 
const int _textmessage_box_bottom = 30; // Pixels from bottom
 
const int _textmessage_box_max_width = 400; // Max width of box
 

	
 
static byte _textmessage_backup[150*400]; // (y * max_width)
 
static Pixel _textmessage_backup[150 * 400]; // (y * max_width)
 

	
 
extern void memcpy_pitch(void *d, void *s, int w, int h, int spitch, int dpitch);
 

	
win32.c
Show inline comments
 
@@ -21,9 +21,9 @@
 
static struct {
 
	HWND main_wnd;
 
	HBITMAP dib_sect;
 
	void *bitmap_bits;
 
	void *buffer_bits;
 
	void *alloced_bits;
 
	Pixel *bitmap_bits;
 
	Pixel *buffer_bits;
 
	Pixel *alloced_bits;
 
	HPALETTE gdi_palette;
 
	int width,height;
 
	int width_org, height_org;
 
@@ -568,7 +568,7 @@ static bool AllocateDibSection(int w, in
 
		DeleteObject(_wnd.dib_sect);
 

	
 
	dc = GetDC(0);
 
	_wnd.dib_sect = CreateDIBSection(dc, bi, DIB_RGB_COLORS, &_wnd.bitmap_bits, NULL, 0);
 
	_wnd.dib_sect = CreateDIBSection(dc, bi, DIB_RGB_COLORS, (void**)&_wnd.bitmap_bits, NULL, 0);
 
	if (_wnd.dib_sect == NULL)
 
		error("CreateDIBSection failed");
 
	ReleaseDC(0, dc);
 
@@ -665,8 +665,8 @@ static void Win32GdiStop(void)
 
static void filter(int left, int top, int width, int height)
 
{
 
	uint p = _screen.pitch;
 
	byte *s = (byte*)_wnd.buffer_bits + top * p + left;
 
	byte *d = (byte*)_wnd.bitmap_bits + top * p * 4 + left * 2;
 
	const Pixel *s = _wnd.buffer_bits + top * p + left;
 
	Pixel *d = _wnd.bitmap_bits + top * p * 4 + left * 2;
 

	
 
	for (; height > 0; height--) {
 
		int i;
0 comments (0 inline, 0 general)