[Scummvm-cvs-logs] scummvm master -> d85eb8ded68a20de383d84064aacd1a4c81db4e9

m-kiewitz m_kiewitz at users.sourceforge.net
Sun Mar 13 13:12:56 CET 2016


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:
d85eb8ded6 SCI32: Fix small inaccuracy in the scaling drawing code


Commit: d85eb8ded68a20de383d84064aacd1a4c81db4e9
    https://github.com/scummvm/scummvm/commit/d85eb8ded68a20de383d84064aacd1a4c81db4e9
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-03-13T13:12:36+01:00

Commit Message:
SCI32: Fix small inaccuracy in the scaling drawing code

Previously sourcePos was always originating from plain 0, 0
which made some pixels not always getting drawn at the right
spot when uneven scaling was used (for example 5:12).
Seems to fix gabriel knight 1 hires graphic issues

Changed paths:
    engines/sci/graphics/celobj32.cpp



diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp
index 389270e..acf4993 100644
--- a/engines/sci/graphics/celobj32.cpp
+++ b/engines/sci/graphics/celobj32.cpp
@@ -117,8 +117,8 @@ struct SCALER_NoScale {
 	_reader(celObj, FLIP ? celObj._width : maxWidth),
 	_lastIndex(celObj._width - 1) {}
 
-	inline void setSource(const int16 x, const int16 y) {
-		_row = _reader.getRow(y);
+	inline void setSource(const int16 x, const int16 targetY, const int16 scaledPosY) {
+		_row = _reader.getRow(targetY - scaledPosY);
 
 		if (FLIP) {
 			_row += _lastIndex - x;
@@ -153,8 +153,11 @@ struct SCALER_Scale {
 	_table(CelObj::_scaler->getScalerTable(scaleX, scaleY)),
 	_lastIndex(maxWidth - 1) {}
 
-	inline void setSource(const int16 x, const int16 y) {
-		_row = _reader.getRow(_table->valuesY[y]);
+	inline void setSource(const int16 x, const int16 targetY, const int16 scaledPosY) {
+		// look up both targetY + scaledPosY in here, only subtract afterwards
+		// otherwise y won't be correct all the time when uneven scaling is used (for example 5:12)
+		int16 y = _table->valuesY[targetY] - _table->valuesY[scaledPosY];
+		_row = _reader.getRow(y);
 		if (FLIP) {
 			_x = _lastIndex - x;
 		} else {
@@ -575,7 +578,7 @@ struct RENDERER {
 
 	inline void draw(Buffer &target, const Common::Rect &targetRect, const Common::Point &scaledPosition) const {
 		const int16 sourceX = targetRect.left - scaledPosition.x;
-		const int16 sourceY = targetRect.top - scaledPosition.y;
+		//const int16 sourceY = targetRect.top - scaledPosition.y;
 
 		byte *targetPixel = (byte *)target.getPixels() + target.screenWidth * targetRect.top + targetRect.left;
 
@@ -583,7 +586,7 @@ struct RENDERER {
 		const int16 targetWidth = targetRect.width();
 		const int16 targetHeight = targetRect.height();
 		for (int y = 0; y < targetHeight; ++y) {
-			_scaler.setSource(sourceX, sourceY + y);
+			_scaler.setSource(sourceX, targetRect.top + y, scaledPosition.y);
 
 			for (int x = 0; x < targetWidth; ++x) {
 				_mapper.draw(targetPixel++, _scaler.read(), _skipColor);






More information about the Scummvm-git-logs mailing list