[Scummvm-cvs-logs] CVS: scummvm/saga console.cpp,1.14,1.15 gfx.cpp,1.27,1.28 interface.cpp,1.29,1.30 isomap.cpp,1.14,1.15 sprite.cpp,1.20,1.21
Torbjörn Andersson
eriktorbjorn at users.sourceforge.net
Fri Oct 22 00:26:01 CEST 2004
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29218
Modified Files:
console.cpp gfx.cpp interface.cpp isomap.cpp sprite.cpp
Log Message:
Made the usage of the Rect data type more consistent with the rest of
ScummVM.
Note that these are only the cases I was able to find in one morning. There
may be others left to fix. But I'm sure at least most of them will be found
when we start cleaning up the codebase a bit.
Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/console.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- console.cpp 4 Oct 2004 23:09:38 -0000 1.14
+++ console.cpp 22 Oct 2004 07:21:17 -0000 1.15
@@ -205,8 +205,8 @@
fill_rect.top = 0;
fill_rect.left = 0;
- fill_rect.bottom = _yPos;
- fill_rect.right = ds->buf_w - 1;
+ fill_rect.bottom = _yPos + 1;
+ fill_rect.right = ds->buf_w;
_vm->_gfx->drawRect(ds, &fill_rect, _vm->_gfx->matchColor(R_CONSOLE_BGCOLOR));
txt_fgcolor = _vm->_gfx->matchColor(R_CONSOLE_TXTCOLOR);
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- gfx.cpp 21 Oct 2004 06:47:21 -0000 1.27
+++ gfx.cpp 22 Oct 2004 07:21:17 -0000 1.28
@@ -50,8 +50,8 @@
r_back_buf.clip_rect.left = 0;
r_back_buf.clip_rect.top = 0;
- r_back_buf.clip_rect.right = width - 1;
- r_back_buf.clip_rect.bottom = height - 1;
+ r_back_buf.clip_rect.right = width;
+ r_back_buf.clip_rect.bottom = height;
// Set module data
_back_buf = r_back_buf;
@@ -148,19 +148,19 @@
// Clamp source rectangle to source buffer
if (src_rect != NULL) {
- src_rect->clip(src_w - 1, src_h - 1);
+ src_rect->clip(src_w, src_h);
s = *src_rect;
-
- if ((s.left >= s.right) || (s.top >= s.bottom)) {
- // Empty or negative region
- return R_FAILURE;
- }
} else {
s.left = 0;
s.top = 0;
- s.right = src_w - 1;
- s.bottom = src_h - 1;
+ s.right = src_w;
+ s.bottom = src_h;
+ }
+
+ if (s.width() <= 0 || s.height() <= 0) {
+ // Empty or negative region
+ return R_FAILURE;
}
// Get destination origin and clip rectangle
@@ -176,12 +176,12 @@
if (clip.left == clip.right) {
clip.left = 0;
- clip.right = ds->buf_w - 1;
+ clip.right = ds->buf_w;
}
if (clip.top == clip.bottom) {
clip.top = 0;
- clip.bottom = ds->buf_h - 1;
+ clip.bottom = ds->buf_h;
}
// Clip source rectangle to destination surface
@@ -189,8 +189,8 @@
dst_off_y = d_y;
src_off_x = s.left;
src_off_y = s.top;
- src_draw_w = (s.right - s.left) + 1;
- src_draw_h = (s.bottom - s.top) + 1;
+ src_draw_w = s.width();
+ src_draw_h = s.height();
// Clip to left edge
@@ -222,13 +222,13 @@
// Clip to right edge
- if (d_x > clip.right) {
+ if (d_x >= clip.right) {
// dst rect completely off right edge
return R_SUCCESS;
}
- if ((d_x + src_draw_w - 1) > clip.right) {
- src_draw_w = clip.right - d_x + 1;
+ if ((d_x + src_draw_w) > clip.right) {
+ src_draw_w = clip.right - d_x;
}
// Clip to bottom edge
@@ -238,8 +238,8 @@
return R_SUCCESS;
}
- if ((d_y + src_draw_h - 1) > clip.bottom) {
- src_draw_h = clip.bottom - d_y + 1;
+ if ((d_y + src_draw_h) > clip.bottom) {
+ src_draw_h = clip.bottom - d_y;
}
// Transfer buffer data to surface
@@ -272,22 +272,22 @@
// Clamp source rectangle to source buffer
if (src_rect != NULL) {
- src_rect->clip(src_w - 1, src_h - 1);
+ src_rect->clip(src_w, src_h);
s.left = src_rect->left;
s.top = src_rect->top;
s.right = src_rect->right;
s.bottom = src_rect->bottom;
-
- if ((s.left >= s.right) || (s.top >= s.bottom)) {
- // Empty or negative region
- return R_FAILURE;
- }
} else {
s.left = 0;
s.top = 0;
- s.right = src_w - 1;
- s.bottom = src_h - 1;
+ s.right = src_w;
+ s.bottom = src_h;
+ }
+
+ if (s.width() <= 0 || s.height() <= 0) {
+ // Empty or negative region
+ return R_FAILURE;
}
// Get destination origin and clip rectangle
@@ -301,16 +301,16 @@
clip.left = 0;
clip.top = 0;
- clip.right = dst_w - 1;
- clip.bottom = dst_h - 1;
+ clip.right = dst_w;
+ clip.bottom = dst_h;
// Clip source rectangle to destination surface
dst_off_x = d_x;
dst_off_y = d_y;
src_off_x = s.left;
src_off_y = s.top;
- src_draw_w = (s.right - s.left) + 1;
- src_draw_h = (s.bottom - s.top) + 1;
+ src_draw_w = s.width();
+ src_draw_h = s.height();
// Clip to left edge
@@ -342,24 +342,24 @@
// Clip to right edge
- if (d_x > clip.right) {
+ if (d_x >= clip.right) {
// dst rect completely off right edge
return R_SUCCESS;
}
- if ((d_x + src_draw_w - 1) > clip.right) {
- src_draw_w -= (clip.right - (d_x + src_draw_w - 1));
+ if ((d_x + src_draw_w) > clip.right) {
+ src_draw_w = clip.right - d_x;
}
// Clip to bottom edge
- if (d_y > clip.bottom) {
+ if (d_y >= clip.bottom) {
// dst rect completely off bottom edge
return R_SUCCESS;
}
- if ((d_y + src_draw_h - 1) > clip.bottom) {
- src_draw_h -= (clip.bottom - (d_y + src_draw_h - 1));
+ if ((d_y + src_draw_h) > clip.bottom) {
+ src_draw_h = clip.bottom - d_y;
}
// Transfer buffer data to surface
@@ -387,7 +387,7 @@
int left, top, right, bottom;
if (dst_rect != NULL) {
- dst_rect->clip(ds->buf_w - 1, ds->buf_h - 1);
+ dst_rect->clip(ds->buf_w, ds->buf_h);
left = dst_rect->left;
top = dst_rect->top;
@@ -401,12 +401,12 @@
} else {
left = 0;
top = 0;
- right = ds->buf_w - 1;
- bottom = ds->buf_h - 1;
+ right = ds->buf_w;
+ bottom = ds->buf_h;
}
- w = (right - left) + 1;
- h = (bottom - top) + 1;
+ w = right - left;
+ h = bottom - top;
write_p = ds->buf + (ds->buf_pitch * top) + left;
@@ -508,8 +508,8 @@
clipinfo->dst_draw_y = d_y;
clipinfo->src_draw_x = s.left;
clipinfo->src_draw_y = s.top;
- clipinfo->draw_w = (s.right - s.left) + 1;
- clipinfo->draw_h = (s.bottom - s.top) + 1;
+ clipinfo->draw_w = s.right - s.left;
+ clipinfo->draw_h = s.bottom - s.top;
clipinfo->nodraw = 0;
@@ -541,25 +541,25 @@
}
// Clip to right edge
- if (d_x > clip.right) {
+ if (d_x >= clip.right) {
// dst rect completely off right edge
clipinfo->nodraw = 1;
return R_SUCCESS;
}
- if ((d_x + clipinfo->draw_w - 1) > clip.right) {
- clipinfo->draw_w += (clip.right - (d_x + clipinfo->draw_w - 1));
+ if ((d_x + clipinfo->draw_w) > clip.right) {
+ clipinfo->draw_w = clip.right - d_x;
}
// Clip to bottom edge
- if (d_y > clip.bottom) {
+ if (d_y >= clip.bottom) {
// dst rect completely off bottom edge
clipinfo->nodraw = 1;
return R_SUCCESS;
}
- if ((d_y + clipinfo->draw_h - 1) > clip.bottom) {
- clipinfo->draw_h += (clip.bottom - (d_y + clipinfo->draw_h - 1));
+ if ((d_y + clipinfo->draw_h) > clip.bottom) {
+ clipinfo->draw_h = clip.bottom - d_y;
}
return R_SUCCESS;
Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- interface.cpp 21 Oct 2004 06:49:11 -0000 1.29
+++ interface.cpp 22 Oct 2004 07:21:17 -0000 1.30
@@ -304,10 +304,9 @@
// Erase background of status bar
rect.left = 0;
- rect.top = _iDesc.status_h - 1;
-
- rect.right = g_di.logical_w - 1;
- rect.bottom = _iDesc.status_y;
+ rect.top = _iDesc.status_y;
+ rect.right = g_di.logical_w;
+ rect.bottom = _iDesc.status_y + _iDesc.status_h;
_vm->_gfx->drawRect(back_buf, &rect, _iDesc.status_bgcol);
@@ -403,8 +402,8 @@
// Erase background of status bar
rect.left = 0;
rect.top = _iDesc.status_y;
- rect.right = g_di.logical_w - 1;
- rect.bottom = _iDesc.status_y + _iDesc.status_h - 1;
+ rect.right = g_di.logical_w;
+ rect.bottom = _iDesc.status_y + _iDesc.status_h;
_vm->_gfx->drawRect(ds, &rect, _iDesc.status_bgcol);
Index: isomap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/isomap.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- isomap.cpp 9 Oct 2004 07:39:45 -0000 1.14
+++ isomap.cpp 22 Oct 2004 07:21:17 -0000 1.15
@@ -134,7 +134,7 @@
int IsoMap::draw(R_SURFACE *dst_s) {
R_GAME_DISPLAYINFO disp_info;
GAME_GetDisplayInfo(&disp_info);
- Rect iso_rect(disp_info.logical_w - 1, disp_info.scene_h - 1);
+ Rect iso_rect(disp_info.logical_w, disp_info.scene_h);
_gfx->drawRect(dst_s, &iso_rect, 0);
drawMetamap(dst_s, -1000, -500);
Index: sprite.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sprite.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- sprite.cpp 4 Oct 2004 23:09:38 -0000 1.20
+++ sprite.cpp 22 Oct 2004 07:21:17 -0000 1.21
@@ -331,13 +331,13 @@
spr_src_rect.left = 0;
spr_src_rect.top = 0;
- spr_src_rect.right = s_width - 1;
- spr_src_rect.bottom = s_height - 1;
+ spr_src_rect.right = s_width;
+ spr_src_rect.bottom = s_height;
spr_dst_rect.left = 0;
spr_dst_rect.top = 0;
spr_dst_rect.right = ds->clip_rect.right;
- spr_dst_rect.bottom = MIN(ds->clip_rect.bottom, (int16)(mask_h - 1));
+ spr_dst_rect.bottom = MIN(ds->clip_rect.bottom, (int16)mask_h);
spr_pt.x = spr_x + x_align;
spr_pt.y = spr_y + y_align;
More information about the Scummvm-git-logs
mailing list