aboutsummaryrefslogtreecommitdiff
path: root/engines/pegasus/movie.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2011-09-23 13:44:40 -0400
committerMatthew Hoops2011-09-23 13:44:40 -0400
commit97af18a5a3a69392d0b71d88e43dd0b801a1a98d (patch)
treedd405ad4ea0f7bea12c432af4b3845433b25b809 /engines/pegasus/movie.cpp
parent84731ef872ee3e704e0ed6d6ca2e88509c859d7b (diff)
downloadscummvm-rg350-97af18a5a3a69392d0b71d88e43dd0b801a1a98d.tar.gz
scummvm-rg350-97af18a5a3a69392d0b71d88e43dd0b801a1a98d.tar.bz2
scummvm-rg350-97af18a5a3a69392d0b71d88e43dd0b801a1a98d.zip
PEGASUS: Allow for movies to be offset on a surface
Diffstat (limited to 'engines/pegasus/movie.cpp')
-rwxr-xr-xengines/pegasus/movie.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/engines/pegasus/movie.cpp b/engines/pegasus/movie.cpp
index 2bf852a496..e102c70272 100755
--- a/engines/pegasus/movie.cpp
+++ b/engines/pegasus/movie.cpp
@@ -67,6 +67,7 @@ void Movie::initFromMovieFile(const Common::String &fileName, bool transparent)
Common::Rect bounds(0, 0, _video->getWidth(), _video->getHeight());
allocateSurface(bounds);
setBounds(bounds);
+ _movieBox = bounds;
setStart(0, getScale());
setStop(_video->getDuration() * getScale() / 1000, getScale());
@@ -90,8 +91,12 @@ void Movie::redrawMovieWorld() {
getBounds(bounds);
g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, bounds.left, bounds.top, frame->w, frame->h);
} else {
- // Just copy to our surface
- _surface->copyFrom(*frame);
+ // Copy to the surface using _movieBox
+ uint16 width = MIN<int>(MIN<int>(frame->w, _movieBox.width()), _surface->w - _movieBox.left);
+ uint16 height = MIN<int>(MIN<int>(frame->h, _movieBox.height()), _surface->h - _movieBox.top);
+
+ for (uint16 y = 0; y < height; y++)
+ memcpy((byte *)_surface->getBasePtr(_movieBox.left, _movieBox.top + y), (const byte *)frame->getBasePtr(0, y), width * frame->format.bytesPerPixel);
}
triggerRedraw();
@@ -114,6 +119,10 @@ void Movie::draw(const Common::Rect &r) {
drawImage(r2, r1);
}
+void Movie::moveMovieBoxTo(const tCoordType h, const tCoordType v) {
+ _movieBox.moveTo(h, v);
+}
+
void Movie::setVolume(uint16 volume) {
// TODO
}