aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base/gfx
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2013-10-06 14:14:01 +0200
committerWillem Jan Palenstijn2013-10-06 17:34:19 +0200
commit14cb1f09c0bc2cace830eaa793227f195acb06bc (patch)
tree5faee1b31f854ffd741c287fd78c6f43154191f8 /engines/wintermute/base/gfx
parentfa51ef214c2c57114a8b56906576e0b72ddfc139 (diff)
downloadscummvm-rg350-14cb1f09c0bc2cace830eaa793227f195acb06bc.tar.gz
scummvm-rg350-14cb1f09c0bc2cace830eaa793227f195acb06bc.tar.bz2
scummvm-rg350-14cb1f09c0bc2cace830eaa793227f195acb06bc.zip
WINTERMUTE: Partially fix rotoscale coordinate confusion
This fixes two issues: * The rendering rectangle was not rotated, causing garbage to be drawn if the rotated rectangle did not fully cover the unrotated rectangle, or sprites to be clipped in the opposite case. * The order of mirror/scale/rotation operations was inconsistent. This commit does scaling first, followed by rotation. (This is only an issue because scaling is specified separately in X and Y directions.) For now only FIXMEs are added for mirroring.
Diffstat (limited to 'engines/wintermute/base/gfx')
-rw-r--r--engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp16
-rw-r--r--engines/wintermute/base/gfx/osystem/render_ticket.cpp11
2 files changed, 17 insertions, 10 deletions
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
index c00dd56085..f1412157c3 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
@@ -37,6 +37,7 @@
#include "graphics/decoders/jpeg.h"
#include "graphics/decoders/tga.h"
#include "engines/wintermute/graphics/transparent_surface.h"
+#include "engines/wintermute/graphics/transform_tools.h"
#include "graphics/pixelformat.h"
#include "graphics/surface.h"
#include "common/stream.h"
@@ -418,8 +419,19 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect,
position.setWidth(newRect->width());
position.setHeight(newRect->height());
} else {
- position.setWidth((int16)((float)srcRect.width() * transform._zoom.x / kDefaultZoomX) * transform._numTimesX);
- position.setHeight((int16)((float)srcRect.height() * transform._zoom.y / kDefaultZoomY) * transform._numTimesY);
+
+ Rect32 r;
+ r.top = 0;
+ r.left = 0;
+ r.setWidth(rect->width());
+ r.setHeight(rect->height());
+
+ r = TransformTools::newRect(r, transform, 0);
+
+ position.top = r.top + y;
+ position.left = r.left + x;
+ position.setWidth(r.width() * transform._numTimesX);
+ position.setHeight(r.height() * transform._numTimesY);
}
renderer->modTargetRect(&position);
diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp
index 7a926c3e36..0fb68bc819 100644
--- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp
+++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp
@@ -54,6 +54,9 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s
// NB: The numTimesX/numTimesY properties don't yet mix well with
// scaling and rotation, but there is no need for that functionality at
// the moment.
+ // NB: Mirroring and rotation are probably done in the wrong order.
+ // (Mirroring should most likely be done before rotation. See also
+ // TransformTools.)
if (_transform._angle != kDefaultAngle) {
TransparentSurface src(*_surface, false);
Graphics::Surface *temp = src.rotoscale(transform);
@@ -71,14 +74,6 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s
}
} else {
_surface = nullptr;
-
- if (transform._angle != kDefaultAngle) { // Make sure comparison-tickets get the correct width
- Rect32 newDstRect;
- Point32 newHotspot;
- newDstRect = TransformTools::newRect(_srcRect, transform, &newHotspot);
- _dstRect.setWidth(newDstRect.right - newDstRect.left);
- _dstRect.setHeight(newDstRect.bottom - newDstRect.top);
- }
}
}