From 97af18a5a3a69392d0b71d88e43dd0b801a1a98d Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 23 Sep 2011 13:44:40 -0400 Subject: PEGASUS: Allow for movies to be offset on a surface --- engines/pegasus/movie.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'engines/pegasus/movie.cpp') 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(MIN(frame->w, _movieBox.width()), _surface->w - _movieBox.left); + uint16 height = MIN(MIN(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 } -- cgit v1.2.3