aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-10-21 06:47:21 +0000
committerTorbjörn Andersson2004-10-21 06:47:21 +0000
commited089f7f389e64ddccd751d1d4e30f81c445497e (patch)
treed378d191a52526402575cf880f0f2e6448805ede /saga
parent47face89e512ed8af1aebc510e61b7d16d4ccf75 (diff)
downloadscummvm-rg350-ed089f7f389e64ddccd751d1d4e30f81c445497e.tar.gz
scummvm-rg350-ed089f7f389e64ddccd751d1d4e30f81c445497e.tar.bz2
scummvm-rg350-ed089f7f389e64ddccd751d1d4e30f81c445497e.zip
Fixed some clipping problems. I think there are more still in there, but I
am sorely tempted to rewrite so that we use the Rect datatype consistently with how most of the rest of ScummVM does. (E.g. a rectangle covering the entire ITE screen would have right and bottom as 320 and 200 respectively, not 319 and 199 like I think we do now.) svn-id: r15625
Diffstat (limited to 'saga')
-rw-r--r--saga/gfx.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/saga/gfx.cpp b/saga/gfx.cpp
index 7e07f75cb7..ac97424a59 100644
--- a/saga/gfx.cpp
+++ b/saga/gfx.cpp
@@ -118,6 +118,9 @@ int Gfx::simpleBlit(R_SURFACE *dst_s, R_SURFACE *src_s) {
return R_SUCCESS;
}
+// TODO: I've fixed at least one clipping bug here, but I have a feeling there
+// are several more.
+
// * Copies a rectangle from a raw 8 bit pixel buffer to the specified surface.
// The buffer is of width 'src_w' and height 'src_h'. The rectangle to be
// copied is defined by 'src_rect'.
@@ -225,18 +228,18 @@ int Gfx::bufToSurface(R_SURFACE *ds, const byte *src, int src_w, int src_h,
}
if ((d_x + src_draw_w - 1) > clip.right) {
- src_draw_w -= (clip.right - (d_x + src_draw_w - 1));
+ src_draw_w = clip.right - d_x + 1;
}
// Clip to bottom edge
- if (d_x > 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));
+ src_draw_h = clip.bottom - d_y + 1;
}
// Transfer buffer data to surface
@@ -350,7 +353,7 @@ int Gfx::bufToBuffer(byte *dst_buf, int dst_w, int dst_h, const byte *src,
// Clip to bottom edge
- if (d_x > clip.bottom) {
+ if (d_y > clip.bottom) {
// dst rect completely off bottom edge
return R_SUCCESS;
}