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

lordhoto lordhoto at gmail.com
Fri Jan 25 02:40:20 CET 2013


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

Summary:
fa9dd0f6c0 OPENGL: Fix linear filtering when the texture size doesn't match the real size
fefa3bdd3f Merge pull request #302 from clone2727/gl-linear-fix


Commit: fa9dd0f6c0ca61fe6d0247128e1c9ba1dd9cf0e3
    https://github.com/scummvm/scummvm/commit/fa9dd0f6c0ca61fe6d0247128e1c9ba1dd9cf0e3
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2013-01-24T09:49:21-08:00

Commit Message:
OPENGL: Fix linear filtering when the texture size doesn't match the real size

Changed paths:
    backends/graphics/opengl/gltexture.cpp



diff --git a/backends/graphics/opengl/gltexture.cpp b/backends/graphics/opengl/gltexture.cpp
index ce69dc4..351c8f9 100644
--- a/backends/graphics/opengl/gltexture.cpp
+++ b/backends/graphics/opengl/gltexture.cpp
@@ -108,9 +108,18 @@ void GLTexture::allocBuffer(GLuint w, GLuint h) {
 	_realWidth = w;
 	_realHeight = h;
 
-	if (w <= _textureWidth && h <= _textureHeight && !_refresh)
-		// Already allocated a sufficiently large buffer
-		return;
+	if (!_refresh) {
+		if (npot_supported && _filter == GL_LINEAR) {
+			// Check if we already allocated a correctly-sized buffer
+			// This is so we don't need to duplicate the last row/column
+			if (w == _textureWidth && h == _textureHeight)
+				return;
+		} else {
+			// Check if we already have a large enough buffer
+			if (w <= _textureWidth && h <= _textureHeight)
+				return;
+		}
+	}
 
 	if (npot_supported) {
 		_textureWidth = w;
@@ -151,12 +160,37 @@ void GLTexture::updateBuffer(const void *buf, int pitch, GLuint x, GLuint y, GLu
 	} else {
 		// Update the texture row by row
 		const byte *src = (const byte *)buf;
+		GLuint curY = y;
+		GLuint height = h;
 		do {
-			glTexSubImage2D(GL_TEXTURE_2D, 0, x, y,
+			glTexSubImage2D(GL_TEXTURE_2D, 0, x, curY,
 			                w, 1, _glFormat, _glType, src); CHECK_GL_ERROR();
-			++y;
+			curY++;
 			src += pitch;
-		} while (--h);
+		} while (--height);
+	}
+
+	// If we're in linear filter mode, repeat the last row/column if the real dimensions
+	// doesn't match the texture dimensions.
+	if (_filter == GL_LINEAR) {
+		if (_realWidth != _textureWidth && x + w == _realWidth) {
+			const byte *src = (const byte *)buf + (w - 1) * _bytesPerPixel;
+			GLuint curY = y;
+			GLuint height = h;
+
+			do {
+				glTexSubImage2D(GL_TEXTURE_2D, 0, x + w,
+						curY, 1, 1, _glFormat, _glType, src); CHECK_GL_ERROR();
+
+				curY++;
+				src += pitch;
+			} while (--height);
+		}
+
+		if (_realHeight != _textureHeight && y + h == _realHeight) {
+			glTexSubImage2D(GL_TEXTURE_2D, 0, x, y + h,
+					w, 1, _glFormat, _glType, (const byte *)buf + pitch * (h - 1)); CHECK_GL_ERROR();
+		}
 	}
 }
 


Commit: fefa3bdd3f4dce5b1d65fb73a59d5713efd52fd6
    https://github.com/scummvm/scummvm/commit/fefa3bdd3f4dce5b1d65fb73a59d5713efd52fd6
Author: Johannes Schickel (lordhoto at gmail.com)
Date: 2013-01-24T17:39:30-08:00

Commit Message:
Merge pull request #302 from clone2727/gl-linear-fix

OPENGL: Fix linear filtering when the texture size doesn't match the real size

Changed paths:
    backends/graphics/opengl/gltexture.cpp









More information about the Scummvm-git-logs mailing list