[Scummvm-cvs-logs] CVS: scummvm/sword2/driver d_draw.h,1.19,1.20 render.cpp,1.47,1.48
Torbj?rn Andersson
eriktorbjorn at users.sourceforge.net
Thu Jan 8 23:54:01 CET 2004
Update of /cvsroot/scummvm/scummvm/sword2/driver
In directory sc8-pr-cvs1:/tmp/cvs-serv10266
Modified Files:
d_draw.h render.cpp
Log Message:
Fix a harmless clipping bug (block surfaces were drawn even when their
width or height was 0), and use consistent naming for clip rect parameters.
Index: d_draw.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/d_draw.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- d_draw.h 6 Jan 2004 13:44:17 -0000 1.19
+++ d_draw.h 9 Jan 2004 07:53:08 -0000 1.20
@@ -178,7 +178,7 @@
void updateRect(Common::Rect *r);
- void blitBlockSurface(BlockSurface *s, Common::Rect *r, Common::Rect *clip_rect);
+ void blitBlockSurface(BlockSurface *s, Common::Rect *r, Common::Rect *clipRect);
void mirrorSprite(uint8 *dst, uint8 *src, int16 w, int16 h);
int32 decompressRLE256(uint8 *dest, uint8 *source, int32 decompSize);
Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/render.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- render.cpp 6 Jan 2004 13:44:17 -0000 1.47
+++ render.cpp 9 Jan 2004 07:53:08 -0000 1.48
@@ -35,24 +35,24 @@
r->bottom - r->top);
}
-void Graphics::blitBlockSurface(BlockSurface *s, Common::Rect *r, Common::Rect *clip_rect) {
- if (r->top > clip_rect->bottom || r->left > clip_rect->right || r->bottom <= clip_rect->top || r->right <= clip_rect->left)
+void Graphics::blitBlockSurface(BlockSurface *s, Common::Rect *r, Common::Rect *clipRect) {
+ if (!r->intersects(*clipRect))
return;
byte *src = s->data;
- if (r->top < clip_rect->top) {
- src -= BLOCKWIDTH * (r->top - clip_rect->top);
- r->top = clip_rect->top;
+ if (r->top < clipRect->top) {
+ src -= BLOCKWIDTH * (r->top - clipRect->top);
+ r->top = clipRect->top;
}
- if (r->left < clip_rect->left) {
- src -= (r->left - clip_rect->left);
- r->left = clip_rect->left;
+ if (r->left < clipRect->left) {
+ src -= (r->left - clipRect->left);
+ r->left = clipRect->left;
}
- if (r->bottom > clip_rect->bottom)
- r->bottom = clip_rect->bottom;
- if (r->right > clip_rect->right)
- r->right = clip_rect->right;
+ if (r->bottom > clipRect->bottom)
+ r->bottom = clipRect->bottom;
+ if (r->right > clipRect->right)
+ r->right = clipRect->right;
byte *dst = _buffer + r->top * _screenWide + r->left;
int i, j;
@@ -73,9 +73,6 @@
dst += _screenWide;
}
}
-
- // UploadRect(r);
- // setNeedFullRedraw();
}
// I've made the scaling two separate functions because there were cases from
@@ -541,14 +538,14 @@
else
y = ((int32) ((p->h - (_screenDeep - MENUDEEP * 2)) * _scrollY) / (int32) (_locationDeep - (_screenDeep - MENUDEEP * 2)));
- Common::Rect clip_rect;
+ Common::Rect clipRect;
// Leave enough space for the top and bottom menues
- clip_rect.left = 0;
- clip_rect.right = _screenWide;
- clip_rect.top = MENUDEEP;
- clip_rect.bottom = _screenDeep - MENUDEEP;
+ clipRect.left = 0;
+ clipRect.right = _screenWide;
+ clipRect.top = MENUDEEP;
+ clipRect.bottom = _screenDeep - MENUDEEP;
for (int j = 0; j < _yBlocks[l]; j++) {
for (int i = 0; i < _xBlocks[l]; i++) {
@@ -557,7 +554,7 @@
r.right = r.left + BLOCKWIDTH;
r.top = j * BLOCKHEIGHT - y + 40;
r.bottom = r.top + BLOCKHEIGHT;
- blitBlockSurface(_blockSurfaces[l][i + j * _xBlocks[l]], &r, &clip_rect);
+ blitBlockSurface(_blockSurfaces[l][i + j * _xBlocks[l]], &r, &clipRect);
}
}
}
More information about the Scummvm-git-logs
mailing list