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

johndoe123 benjamin.haisch at t-online.de
Thu Jun 26 19:20:34 CEST 2014


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:
bdee71f279 NEVERHOOD: Implement clipping in BaseSurface::copyFrom


Commit: bdee71f27922d1ba146323374e4501ec462d687d
    https://github.com/scummvm/scummvm/commit/bdee71f27922d1ba146323374e4501ec462d687d
Author: johndoe123 (john_doe at techie.com)
Date: 2014-06-26T19:19:28+02:00

Commit Message:
NEVERHOOD: Implement clipping in BaseSurface::copyFrom

This should hopefully fix the crashes in the Hall of Records as mentioned in bug #6513.

Changed paths:
    engines/neverhood/graphics.cpp



diff --git a/engines/neverhood/graphics.cpp b/engines/neverhood/graphics.cpp
index 939428e..89792d2 100644
--- a/engines/neverhood/graphics.cpp
+++ b/engines/neverhood/graphics.cpp
@@ -114,7 +114,15 @@ void BaseSurface::drawMouseCursorResource(MouseCursorResource &mouseCursorResour
 }
 
 void BaseSurface::copyFrom(Graphics::Surface *sourceSurface, int16 x, int16 y, NDrawRect &sourceRect) {
-	// Copy a rectangle from sourceSurface, no clipping is performed, 0 is the transparent color
+	// Copy a rectangle from sourceSurface, 0 is the transparent color
+	// Clipping is performed against the right/bottom border since x, y will always be >= 0
+
+	if (x + sourceRect.width > _surface->w)
+		sourceRect.width = _surface->w - x - 1;
+
+	if (y + sourceRect.height > _surface->h)
+		sourceRect.height = _surface->h - y - 1;
+
 	byte *source = (byte*)sourceSurface->getBasePtr(sourceRect.x, sourceRect.y);
 	byte *dest = (byte*)_surface->getBasePtr(x, y);
 	int height = sourceRect.height;






More information about the Scummvm-git-logs mailing list