[Scummvm-git-logs] scummvm master -> 6e05d981b02dc3f39cad064655acd21a893cd592

criezy noreply at scummvm.org
Fri Apr 14 00:16:13 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:
6e05d981b0 AGS: Fix video stretch


Commit: 6e05d981b02dc3f39cad064655acd21a893cd592
    https://github.com/scummvm/scummvm/commit/6e05d981b02dc3f39cad064655acd21a893cd592
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-04-14T01:16:05+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 a9725a37d6e..8a4e41d6934 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