[Scummvm-git-logs] scummvm master -> 662bec9d20e27b4425c73fc0e3bb6202074d9c1d

sev- noreply at scummvm.org
Fri Jan 24 00:09:53 UTC 2025


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:
662bec9d20 VIDEO: Prevent out-of-index for edge cases in QTVR object rotation


Commit: 662bec9d20e27b4425c73fc0e3bb6202074d9c1d
    https://github.com/scummvm/scummvm/commit/662bec9d20e27b4425c73fc0e3bb6202074d9c1d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-01-24T01:09:31+01:00

Commit Message:
VIDEO: Prevent out-of-index for edge cases in QTVR object rotation

Changed paths:
    video/qt_decoder.cpp


diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index b2f9c959e39..eeaa07eb435 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -626,7 +626,7 @@ void QuickTimeDecoder::handleMouseMove(int16 x, int16 y) {
 
 	// HACK: FIXME: Hard coded for now
 	const int sensitivity = 10;
-	const float speedFactor = 0.1f; 
+	const float speedFactor = 0.1f;
 
 	int16 mouseDeltaX = x - _prevMouseX;
 	int16 mouseDeltaY = y - _prevMouseY;
@@ -639,10 +639,10 @@ void QuickTimeDecoder::handleMouseMove(int16 x, int16 y) {
 	if (ABS(mouseDeltaY) >= sensitivity) {
 		int newFrame = track->getCurFrame() - round(speedY) * _nav.columns;
 
-		if (newFrame >= 0 && newFrame < track->getFrameCount())
+		if (newFrame >= 0 && newFrame < track->getFrameCount()) {
 			track->setCurFrame(newFrame);
-
-		changed = true;
+			changed = true;
+		}
 	}
 
 	if (ABS(mouseDeltaX) >= sensitivity) {
@@ -651,9 +651,10 @@ void QuickTimeDecoder::handleMouseMove(int16 x, int16 y) {
 
 		int newFrame = (track->getCurFrame() - (int)roundf(speedX) - currentRowStart) % _nav.columns + currentRowStart;
 
-		track->setCurFrame(newFrame);
-
-		changed = true;
+		if (newFrame >= 0 && newFrame < track->getFrameCount()) {
+			track->setCurFrame(newFrame);
+			changed = true;
+		}
 	}
 
 	if (changed) {




More information about the Scummvm-git-logs mailing list