aboutsummaryrefslogtreecommitdiff
path: root/scumm/wiz_he.cpp
diff options
context:
space:
mode:
authorTravis Howell2005-03-30 13:34:24 +0000
committerTravis Howell2005-03-30 13:34:24 +0000
commit41f910b5adf58f387ed491e2fbf17468ec4b3490 (patch)
treeb863ce31ab9e62d1db25c60d7b21c94fd7708d90 /scumm/wiz_he.cpp
parent6bb533f936f7cf9cd41cdb6a83d62733935afc32 (diff)
downloadscummvm-rg350-41f910b5adf58f387ed491e2fbf17468ec4b3490.tar.gz
scummvm-rg350-41f910b5adf58f387ed491e2fbf17468ec4b3490.tar.bz2
scummvm-rg350-41f910b5adf58f387ed491e2fbf17468ec4b3490.zip
Revert cleanup from scumm/gfx.cpp revision 2.348.
Clipping isn't compatible, due to negative values. Fixes many sprite glitches, since code is used to calculating offsets for images. svn-id: r17293
Diffstat (limited to 'scumm/wiz_he.cpp')
-rw-r--r--scumm/wiz_he.cpp35
1 files changed, 28 insertions, 7 deletions
diff --git a/scumm/wiz_he.cpp b/scumm/wiz_he.cpp
index 101f7acd86..77240387ba 100644
--- a/scumm/wiz_he.cpp
+++ b/scumm/wiz_he.cpp
@@ -231,23 +231,44 @@ void Wiz::copyAuxImage(uint8 *dst1, uint8 *dst2, const uint8 *src, int dstw, int
}
static bool calcClipRects(int dst_w, int dst_h, int src_x, int src_y, int src_w, int src_h, const Common::Rect *rect, Common::Rect &srcRect, Common::Rect &dstRect) {
+ srcRect = Common::Rect(0, 0, src_w, src_h);
+ dstRect = Common::Rect(src_x, src_y, src_x + src_w, src_y + src_h);
Common::Rect r3;
+ int diff;
+
if (rect) {
r3 = *rect;
- Common::Rect r4(dst_w, dst_h);
+ Common::Rect r4(0, 0, dst_w, dst_h);
if (r3.intersects(r4)) {
r3.clip(r4);
} else {
return false;
}
} else {
- r3 = Common::Rect(dst_w, dst_h);
+ r3 = Common::Rect(0, 0, dst_w, dst_h);
}
- dstRect = Common::Rect(src_x, src_y, src_x + src_w, src_y + src_h);
- dstRect.clip(r3);
- srcRect = dstRect;
- srcRect.moveTo(0, 0);
- return srcRect.isValidRect() && dstRect.isValidRect();
+ diff = dstRect.left - r3.left;
+ if (diff < 0) {
+ srcRect.left -= diff;
+ dstRect.left -= diff;
+ }
+ diff = dstRect.right - r3.right;
+ if (diff > 0) {
+ srcRect.right -= diff;
+ dstRect.right -= diff;
+ }
+ diff = dstRect.top - r3.top;
+ if (diff < 0) {
+ srcRect.top -= diff;
+ dstRect.top -= diff;
+ }
+ diff = dstRect.bottom - r3.bottom;
+ if (diff > 0) {
+ srcRect.bottom -= diff;
+ dstRect.bottom -= diff;
+ }
+
+ return true;
}
void Wiz::copyWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, const Common::Rect *rect) {