[Scummvm-git-logs] scummvm branch-2-7 -> 794ada8c44026218b435014fed8012c719c6a2c7

criezy noreply at scummvm.org
Fri Apr 14 00:16:52 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
794ada8c44 AGS: Fix video stretch


Commit: 794ada8c44026218b435014fed8012c719c6a2c7
    https://github.com/scummvm/scummvm/commit/794ada8c44026218b435014fed8012c719c6a2c7
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-04-14T01:16:37+01:00

Commit Message:
AGS: Fix video stretch

The original AGS uses a proportional stretch that preserves the
video aspect ratio, but we were doing a stretch to the full game
screen. As a result if the video and game do not have the same
aspect ratio we were losing the video aspect ratio. This could
for example be seen with the AGDI logo at the start of all the
AGDI games. The games re at 320x200, but the video are 320x160.
Before this commit the video was stretched incorrectly to
320x200.

Changed paths:
    engines/ags/engine/media/video/video.cpp


diff --git a/engines/ags/engine/media/video/video.cpp b/engines/ags/engine/media/video/video.cpp
index e4124edd0c1..2faf4e0826c 100644
--- a/engines/ags/engine/media/video/video.cpp
+++ b/engines/ags/engine/media/video/video.cpp
@@ -87,16 +87,18 @@ static bool play_video(Video::VideoDecoder *decoder, const char *name, int flags
 			const Graphics::Surface *frame = decoder->decodeNextFrame();
 
 			if (frame && enableVideo) {
-				if (stretchVideo && frame->w == scr.w && frame->h == scr.h)
+				Rect dstRect = PlaceInRect(RectWH(0, 0, scr.w, scr.h), RectWH(0, 0, frame->w, frame->h),
+					(stretchVideo ? kPlaceStretchProportional : kPlaceCenter));
+
+				if (stretchVideo && frame->w == dstRect.GetWidth() && frame->h == dstRect.GetHeight())
 					// Don't need to stretch video after all
 					stretchVideo = false;
 
 				if (stretchVideo) {
 					scr.transBlitFrom(*frame, Common::Rect(0, 0, frame->w, frame->h),
-					                  Common::Rect(0, 0, scr.w, scr.h));
+					                  Common::Rect(dstRect.Left, dstRect.Top, dstRect.Right + 1, dstRect.Bottom + 1));
 				} else {
-					scr.blitFrom(*frame, Common::Point((scr.w - frame->w) / 2,
-					                                   (scr.h - frame->h) / 2));
+					scr.blitFrom(*frame, Common::Point(dstRect.Left, dstRect.Top));
 				}
 			}
 




More information about the Scummvm-git-logs mailing list