[Scummvm-cvs-logs] CVS: scummvm/saga console.cpp,1.16,1.17 font.cpp,1.16,1.17 gfx.cpp,1.29,1.30 gfx.h,1.12,1.13 isomap.cpp,1.18,1.19 render.cpp,1.37,1.38 sprite.cpp,1.22,1.23 text.cpp,1.8,1.9

Max Horn fingolfin at users.sourceforge.net
Sat Oct 30 15:14:42 CEST 2004


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9913

Modified Files:
	console.cpp font.cpp gfx.cpp gfx.h isomap.cpp render.cpp 
	sprite.cpp text.cpp 
Log Message:
Let Saga::SURFACE inherit from SURFACE

Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/console.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- console.cpp	27 Oct 2004 21:32:27 -0000	1.16
+++ console.cpp	30 Oct 2004 22:13:48 -0000	1.17
@@ -206,7 +206,7 @@
 	fill_rect.top = 0;
 	fill_rect.left = 0;
 	fill_rect.bottom = _yPos + 1;
-	fill_rect.right = ds->buf_w;
+	fill_rect.right = ds->w;
 
 	_vm->_gfx->drawRect(ds, &fill_rect, _vm->_gfx->matchColor(CONSOLE_BGCOLOR));
 	txt_fgcolor = _vm->_gfx->matchColor(CONSOLE_TXTCOLOR);

Index: font.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/font.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- font.cpp	27 Oct 2004 21:32:27 -0000	1.16
+++ font.cpp	30 Oct 2004 22:13:48 -0000	1.17
@@ -422,7 +422,7 @@
 	int c_bit;
 	int ct;
 
-	if ((text_x > ds->buf_w) || (text_y > ds->buf_h)) {
+	if ((text_x > ds->w) || (text_y > ds->h)) {
 		// Output string can't be visible
 		return SUCCESS;
 	}
@@ -458,7 +458,7 @@
 
 		// Get length of character in bytes
 		c_byte_len = ((draw_font->fce[c_code].width - 1) / 8) + 1;
-		row_limit = (ds->buf_h < (text_y + draw_font->hdr.c_height)) ? ds->buf_h : text_y + draw_font->hdr.c_height;
+		row_limit = (ds->h < (text_y + draw_font->hdr.c_height)) ? ds->h : text_y + draw_font->hdr.c_height;
 		char_row = 0;
 
 		for (row = text_y; row < row_limit; row++, char_row++) {
@@ -467,9 +467,9 @@
 				continue;
 			}
 
-			output_ptr = ds->buf + (ds->buf_pitch * row) + text_x;
-			output_ptr_min = ds->buf + (ds->buf_pitch * row) + (text_x > 0 ? text_x : 0);
-			output_ptr_max = output_ptr + (ds->buf_pitch - text_x);
+			output_ptr = (byte *)ds->pixels + (ds->pitch * row) + text_x;
+			output_ptr_min = (byte *)ds->pixels + (ds->pitch * row) + (text_x > 0 ? text_x : 0);
+			output_ptr_max = output_ptr + (ds->pitch - text_x);
 
 			// If character starts off the screen, jump to next character
 			if (output_ptr < output_ptr_min) {

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- gfx.cpp	27 Oct 2004 21:32:27 -0000	1.29
+++ gfx.cpp	30 Oct 2004 22:13:48 -0000	1.30
@@ -43,10 +43,10 @@
 
 	debug(0, "Init screen %dx%d", width, height);
 	// Convert surface data to R surface data
-	back_buf.buf = (byte *)calloc(1, width * height);
-	back_buf.buf_w = width;
-	back_buf.buf_h = height;
-	back_buf.buf_pitch = width;
+	back_buf.pixels = calloc(1, width * height);
+	back_buf.w = width;
+	back_buf.h = height;
+	back_buf.pitch = width;
 
 	back_buf.clip_rect.left = 0;
 	back_buf.clip_rect.top = 0;
@@ -66,7 +66,7 @@
 
 /*
 ~Gfx() {
-  free(GfxModule.r_back_buf->buf);
+  free(GfxModule.r_back_buf->pixels);
 }
  */
 
@@ -99,16 +99,16 @@
 	int y, w, p;
 
 	assert((dst_s != NULL) && (src_s != NULL));
-	assert(dst_s->buf_w == src_s->buf_w);
-	assert(dst_s->buf_h == src_s->buf_h);
+	assert(dst_s->w == src_s->w);
+	assert(dst_s->h == src_s->h);
 
-	src_p = src_s->buf;
-	dst_p = dst_s->buf;
+	src_p = (byte *)src_s->pixels;
+	dst_p = (byte *)dst_s->pixels;
 
-	w = src_s->buf_w;
-	p = src_s->buf_pitch;
+	w = src_s->w;
+	p = src_s->pitch;
 
-	for (y = 0; y < src_s->buf_h; y++) {
+	for (y = 0; y < src_s->h; y++) {
 		memcpy(dst_p, src_p, w);
 
 		dst_p += p;
@@ -176,12 +176,12 @@
 
 	if (clip.left == clip.right) {
 		clip.left = 0;
-		clip.right = ds->buf_w;
+		clip.right = ds->w;
 	}
 
 	if (clip.top == clip.bottom) {
 		clip.top = 0;
-		clip.bottom = ds->buf_h;
+		clip.bottom = ds->h;
 	}
 
 	// Clip source rectangle to destination surface
@@ -244,12 +244,12 @@
 
 	// Transfer buffer data to surface
 	read_p = (src + src_off_x) + (src_w * src_off_y);
-	write_p = (ds->buf + dst_off_x) + (ds->buf_pitch * dst_off_y);
+	write_p = ((byte *)ds->pixels + dst_off_x) + (ds->pitch * dst_off_y);
 
 	for (row = 0; row < src_draw_h; row++) {
 		memcpy(write_p, read_p, src_draw_w);
 
-		write_p += ds->buf_pitch;
+		write_p += ds->pitch;
 		read_p += src_w;
 	}
 
@@ -387,7 +387,7 @@
 	int left, top, right, bottom;
 
 	if (dst_rect != NULL) {
-		dst_rect->clip(ds->buf_w, ds->buf_h);
+		dst_rect->clip(ds->w, ds->h);
 
 		left = dst_rect->left;
 		top = dst_rect->top;
@@ -401,18 +401,18 @@
 	} else {
 		left = 0;
 		top = 0;
-		right = ds->buf_w;
-		bottom = ds->buf_h;
+		right = ds->w;
+		bottom = ds->h;
 	}
 
 	w = right - left;
 	h = bottom - top;
 
-	write_p = ds->buf + (ds->buf_pitch * top) + left;
+	write_p = (byte *)ds->pixels + (ds->pitch * top) + left;
 
 	for (row = 0; row < h; row++) {
 		memset(write_p, color, w);
-		write_p += ds->buf_pitch;
+		write_p += ds->pitch;
 	}
 
 	return SUCCESS;
@@ -681,7 +681,7 @@
 		right = temp;
 	}
 
-	write_p = ds->buf + (top * ds->buf_pitch) + left;
+	write_p = (byte *)ds->pixels + (top * ds->pitch) + left;
 	dx = right - left;
 
 	if (dx < 0) {
@@ -696,7 +696,7 @@
 	if (dx == 0) {
 		for (i = 0; i <= dy; i++) {
 			*write_p = (byte) color;
-			write_p += ds->buf_pitch;
+			write_p += ds->pitch;
 		}
 		return;
 	}
@@ -710,7 +710,7 @@
 	if (dx == dy) {
 		for (i = 0; i <= dx; i++) {
 			*write_p = (byte) color;
-			write_p += x_vector + ds->buf_pitch;
+			write_p += x_vector + ds->pitch;
 		}
 		return;
 	}
@@ -735,7 +735,7 @@
 			*write_p = (byte) color;
 			write_p += x_vector;
 		}
-		write_p += ds->buf_pitch;
+		write_p += ds->pitch;
 
 		for (i = 0; i < (dy - 1); i++) {
 			run = min_run;
@@ -750,7 +750,7 @@
 				*write_p = (byte) color;
 				write_p += x_vector;
 			}
-			write_p += ds->buf_pitch;
+			write_p += ds->pitch;
 		}
 
 		// Horiz. seg
@@ -758,7 +758,7 @@
 			*write_p = (byte) color;
 			write_p += x_vector;
 		}
-		write_p += ds->buf_pitch;
+		write_p += ds->pitch;
 		return;
 
 	} else {
@@ -781,7 +781,7 @@
 		// Vertical seg
 		for (k = 0; k < init_run; k++) {
 			*write_p = (byte) color;
-			write_p += ds->buf_pitch;
+			write_p += ds->pitch;
 		}
 		write_p += x_vector;
 
@@ -795,7 +795,7 @@
 			// Vertical seg
 			for (k = 0; k < run; k++) {
 				*write_p = (byte) color;
-				write_p += ds->buf_pitch;
+				write_p += ds->pitch;
 			}
 			write_p += x_vector;
 		}
@@ -803,7 +803,7 @@
 		// Vertical seg
 		for (k = 0; k < end_run; k++) {
 			*write_p = (byte) color;
-			write_p += ds->buf_pitch;
+			write_p += ds->pitch;
 		}
 		write_p += x_vector;
 		return;

Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- gfx.h	27 Oct 2004 21:32:27 -0000	1.12
+++ gfx.h	30 Oct 2004 22:13:48 -0000	1.13
@@ -26,6 +26,8 @@
 #ifndef SAGA_GFX_H_
 #define SAGA_GFX_H_
 
+#include <graphics/surface.h>
+
 namespace Saga {
 
 using Common::Point;
@@ -60,11 +62,7 @@
 	int alpha;
 };
 
-struct SURFACE {
-	byte *buf;
-	int buf_w;
-	int buf_h;
-	int buf_pitch;
+struct SURFACE : Graphics::Surface {
 	Rect clip_rect;
 };
 

Index: isomap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/isomap.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- isomap.cpp	30 Oct 2004 10:31:00 -0000	1.18
+++ isomap.cpp	30 Oct 2004 22:13:48 -0000	1.19
@@ -236,7 +236,7 @@
 	tile_h = _tile_tbl[tile_i].tile_h;
 
 	read_p = tile_p;
-	draw_p = dst_s->buf + tile_x + (tile_y * dst_s->buf_pitch);
+	draw_p = (byte *)dst_s->pixels + tile_x + (tile_y * dst_s->pitch);
 
 	draw_x = tile_x;
 	draw_y = tile_y;
@@ -251,7 +251,7 @@
 	}
 
 	for (row = 0; row < tile_h; row++) {
-		draw_p = dst_s->buf + draw_x + ((draw_y + row) * dst_s->buf_pitch);
+		draw_p = (byte *)dst_s->pixels + draw_x + ((draw_y + row) * dst_s->pitch);
 		w_count = 0;
 
 		// temporary y clip

Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- render.cpp	27 Oct 2004 21:32:27 -0000	1.37
+++ render.cpp	30 Oct 2004 22:13:48 -0000	1.38
@@ -155,7 +155,7 @@
 	if (_flags & RF_SHOW_FPS) {
 		sprintf(txt_buf, "%d", _fps);
 		fps_width = _vm->_font->getStringWidth(SMALL_FONT_ID, txt_buf, 0, FONT_NORMAL);
-		_vm->_font->draw(SMALL_FONT_ID, backbuf_surface, txt_buf, 0, backbuf_surface->buf_w - fps_width, 2,
+		_vm->_font->draw(SMALL_FONT_ID, backbuf_surface, txt_buf, 0, backbuf_surface->w - fps_width, 2,
 					_vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
 	}
 
@@ -164,7 +164,7 @@
 		int msg_len = strlen(PAUSEGAME_MSG);
 		int msg_w = _vm->_font->getStringWidth(BIG_FONT_ID, PAUSEGAME_MSG, msg_len, FONT_OUTLINE);
 		_vm->_font->draw(BIG_FONT_ID, backbuf_surface, PAUSEGAME_MSG, msg_len,
-				(backbuf_surface->buf_w - msg_w) / 2, 90, _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
+				(backbuf_surface->w - msg_w) / 2, 90, _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
 	}
 
 	// Update user interface
@@ -185,8 +185,8 @@
 	// Draw console
 	_vm->_console->draw(backbuf_surface);
 
-	_system->copyRectToScreen(backbuf_surface->buf, backbuf_surface->buf_w, 0, 0, 
-							  backbuf_surface->buf_w, backbuf_surface->buf_h);
+	_system->copyRectToScreen((byte *)backbuf_surface->pixels, backbuf_surface->w, 0, 0, 
+							  backbuf_surface->w, backbuf_surface->h);
 
 	_system->updateScreen();
 	return SUCCESS;

Index: sprite.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sprite.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- sprite.cpp	27 Oct 2004 21:32:28 -0000	1.22
+++ sprite.cpp	30 Oct 2004 22:13:48 -0000	1.23
@@ -219,19 +219,19 @@
 
 	decodeRLESprite(sprite_data_p, 64000, _decodeBuf, s_width * s_height);
 
-	buf_row_p = ds->buf + ds->buf_pitch * spr_y;
+	buf_row_p = (byte *)ds->pixels + ds->pitch * spr_y;
 	src_row_p = _decodeBuf;
 
 	// Clip to right side of surface
 	clip_width = s_width;
-	if (s_width > (ds->buf_w - spr_x)) {
-		clip_width = (ds->buf_w - spr_x);
+	if (s_width > (ds->w - spr_x)) {
+		clip_width = (ds->w - spr_x);
 	}
 
 	// Clip to bottom side of surface
 	clip_height = s_height;
-	if (s_height > (ds->buf_h - spr_y)) {
-		clip_height = (ds->buf_h - spr_y);
+	if (s_height > (ds->h - spr_y)) {
+		clip_height = (ds->h - spr_y);
 	}
 
 	for (i = 0; i < clip_height; i++) {
@@ -240,7 +240,7 @@
 				*(buf_row_p + j + spr_x) = *(src_row_p + j);
 			}
 		}
-		buf_row_p += ds->buf_pitch;
+		buf_row_p += ds->pitch;
 		src_row_p += s_width;
 	}
 
@@ -360,7 +360,7 @@
 	// Finally, draw the occluded sprite
 	src_row_p = _decodeBuf + ci.src_draw_x + (ci.src_draw_y * s_width);
 
-	dst_row_p = ds->buf + ci.dst_draw_x + (ci.dst_draw_y * ds->buf_pitch);
+	dst_row_p = (byte *)ds->pixels + ci.dst_draw_x + (ci.dst_draw_y * ds->pitch);
 	mask_row_p = mask_buf + ci.dst_draw_x + (ci.dst_draw_y * mask_w);
 
 	for (y = 0; y < ci.draw_h; y++) {
@@ -378,7 +378,7 @@
 			dst_p++;
 			mask_p++;
 		}
-		dst_row_p += ds->buf_pitch;
+		dst_row_p += ds->pitch;
 		mask_row_p += mask_w;
 		src_row_p += s_width;
 	}

Index: text.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/text.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- text.cpp	27 Oct 2004 21:32:28 -0000	1.8
+++ text.cpp	30 Oct 2004 22:13:48 -0000	1.9
@@ -59,8 +59,8 @@
 			text_x = TEXT_CENTERLIMIT;
 		}
 
-		if (text_x > ds->buf_w - TEXT_CENTERLIMIT) {
-			text_x = ds->buf_w - TEXT_CENTERLIMIT;
+		if (text_x > ds->w - TEXT_CENTERLIMIT) {
+			text_x = ds->w - TEXT_CENTERLIMIT;
 		}
 
 		if (text_x < (TEXT_MARGIN * 2)) {
@@ -70,12 +70,12 @@
 
 		string_w = _font->getStringWidth(font_id, string, string_len, flags);
 
-		if (text_x < (ds->buf_w / 2)) {
+		if (text_x < (ds->w / 2)) {
 			// Fit to right side
 			fit_w = (text_x - TEXT_MARGIN) * 2;
 		} else {
 			// Fit to left side
-			fit_w = ((ds->buf_w - TEXT_MARGIN) - text_x) * 2;
+			fit_w = ((ds->w - TEXT_MARGIN) - text_x) * 2;
 		}
 
 		if (fit_w >= string_w) {





More information about the Scummvm-git-logs mailing list