[Scummvm-cvs-logs] SF.net SVN: scummvm:[54947] scummvm/trunk/engines/mohawk/graphics.cpp

bgk at users.sourceforge.net bgk at users.sourceforge.net
Fri Dec 17 19:18:53 CET 2010


Revision: 54947
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54947&view=rev
Author:   bgk
Date:     2010-12-17 18:18:52 +0000 (Fri, 17 Dec 2010)

Log Message:
-----------
MOHAWK: Yet more Myst vertical alignment / clipping fixes.

Fixes the boiler wheels drawing incorrectly. Fixes the rocket piano's leftmost key drawing too high. Fixes the timeclock controls beeing misaligned.

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/graphics.cpp

Modified: scummvm/trunk/engines/mohawk/graphics.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/graphics.cpp	2010-12-17 15:37:43 UTC (rev 54946)
+++ scummvm/trunk/engines/mohawk/graphics.cpp	2010-12-17 18:18:52 UTC (rev 54947)
@@ -354,13 +354,22 @@
 	if (dest.right > _vm->_system->getWidth() || dest.bottom > _vm->_system->getHeight())
 		dest.debugPrint(4, "Clipping destination rect to the screen:");
 
+	Graphics::Surface *surface = findImage(image)->getSurface();
+
+	// Make sure the image is bottom aligned in the dest rect
+	dest.top = dest.bottom - MIN<int>(surface->h, dest.height());
+
+	// Convert from bitmap coordinates to surface coordinates
+	uint16 top = surface->h - (src.top + MIN<int>(surface->h, dest.height()));
+
+	// Do not draw the top pixels if the image is too tall
+	if (dest.height() > _viewport.height()) {
+		top += dest.height() - _viewport.height();
+	}
+
 	dest.right = CLIP<int>(dest.right, 0, _vm->_system->getWidth());
 	dest.bottom = CLIP<int>(dest.bottom, 0, _vm->_system->getHeight());
 
-	src.clip(_viewport);
-
-	Graphics::Surface *surface = findImage(image)->getSurface();
-
 	debug(3, "Image Blit:");
 	debug(3, "src.x: %d", src.left);
 	debug(3, "src.y: %d", src.top);
@@ -372,9 +381,6 @@
 	uint16 width = MIN<int>(surface->w, dest.width());
 	uint16 height = MIN<int>(surface->h, dest.height());
 
-	// Convert from bitmap coordinates to surface coordinates
-	uint16 top = surface->h - src.top - height;
-
 	_vm->_system->copyRectToScreen((byte *)surface->getBasePtr(src.left, top), surface->pitch, dest.left, dest.top, width, height);
 }
 
@@ -383,13 +389,22 @@
 	if (dest.right > _vm->_system->getWidth() || dest.bottom > _vm->_system->getHeight())
 		dest.debugPrint(4, "Clipping destination rect to the screen:");
 
+	Graphics::Surface *surface = findImage(image)->getSurface();
+
+	// Make sure the image is bottom aligned in the dest rect
+	dest.top = dest.bottom - MIN<int>(surface->h, dest.height());
+
+	// Convert from bitmap coordinates to surface coordinates
+	uint16 top = surface->h - (src.top + MIN<int>(surface->h, dest.height()));
+
+	// Do not draw the top pixels if the image is too tall
+	if (dest.height() > _viewport.height()) {
+		top += dest.height() - _viewport.height();
+	}
+
 	dest.right = CLIP<int>(dest.right, 0, _vm->_system->getWidth());
 	dest.bottom = CLIP<int>(dest.bottom, 0, _vm->_system->getHeight());
 
-	src.clip(_viewport);
-
-	Graphics::Surface *surface = findImage(image)->getSurface();
-
 	debug(3, "Image Blit:");
 	debug(3, "src.x: %d", src.left);
 	debug(3, "src.y: %d", src.top);
@@ -401,19 +416,16 @@
 	uint16 width = MIN<int>(surface->w, dest.width());
 	uint16 height = MIN<int>(surface->h, dest.height());
 
-	// Convert from bitmap coordinates to surface coordinates
-	uint16 top = surface->h - src.top - height;
-
 	for (uint16 i = 0; i < height; i++)
 		memcpy(_backBuffer->getBasePtr(dest.left, i + dest.top), surface->getBasePtr(src.left, top + i), width * surface->bytesPerPixel);
 }
 
 void MystGraphics::copyImageToScreen(uint16 image, Common::Rect dest) {
-	copyImageSectionToScreen(image, _viewport, dest);
+	copyImageSectionToScreen(image, Common::Rect(544, 333), dest);
 }
 
 void MystGraphics::copyImageToBackBuffer(uint16 image, Common::Rect dest) {
-	copyImageSectionToBackBuffer(image, _viewport, dest);
+	copyImageSectionToBackBuffer(image, Common::Rect(544, 333), dest);
 }
 
 void MystGraphics::copyBackBufferToScreen(Common::Rect r) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list