[Scummvm-cvs-logs] SF.net SVN: scummvm:[47319] scummvm/trunk/engines/sci/graphics

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sat Jan 16 15:20:01 CET 2010


Revision: 47319
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47319&view=rev
Author:   m_kiewitz
Date:     2010-01-16 14:20:00 +0000 (Sat, 16 Jan 2010)

Log Message:
-----------
SCI: created getCelScaledRect() inside view class

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/view.cpp
    scummvm/trunk/engines/sci/graphics/view.h

Modified: scummvm/trunk/engines/sci/graphics/view.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.cpp	2010-01-16 00:22:22 UTC (rev 47318)
+++ scummvm/trunk/engines/sci/graphics/view.cpp	2010-01-16 14:20:00 UTC (rev 47319)
@@ -266,6 +266,26 @@
 	}
 }
 
+void View::getCelScaledRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, int16 scaleX, int16 scaleY, Common::Rect *outRect) {
+	int16 scaledDisplaceX, scaledDisplaceY;
+	int16 scaledWidth, scaledHeight;
+	CelInfo *celInfo = getCelInfo(loopNo, celNo);
+	if (celInfo) {
+		// Scaling displaceX/Y, Width/Height
+		scaledDisplaceX = (celInfo->displaceX * scaleX) >> 7;
+		scaledDisplaceY = (celInfo->displaceY * scaleY) >> 7;
+		scaledWidth = (celInfo->width * scaleX) >> 7;
+		scaledHeight = (celInfo->height * scaleY) >> 7;
+		scaledWidth = CLIP<int16>(scaledWidth, 0, _screen->getWidth());
+		scaledHeight = CLIP<int16>(scaledHeight, 0, _screen->getHeight());
+
+		outRect->left = x + scaledDisplaceX - (scaledWidth >> 1);
+		outRect->right = outRect->left + scaledWidth;
+		outRect->bottom = y + scaledDisplaceY - z + 1;
+		outRect->top = outRect->bottom - scaledHeight;
+	}
+}
+
 void View::unpackCel(int16 loopNo, int16 celNo, byte *outPtr, uint16 pixelCount) {
 	CelInfo *celInfo = getCelInfo(loopNo, celNo);
 	byte *rlePtr;

Modified: scummvm/trunk/engines/sci/graphics/view.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.h	2010-01-16 00:22:22 UTC (rev 47318)
+++ scummvm/trunk/engines/sci/graphics/view.h	2010-01-16 14:20:00 UTC (rev 47319)
@@ -59,6 +59,7 @@
 	CelInfo *getCelInfo(int16 loopNo, int16 celNo);
 	LoopInfo *getLoopInfo(int16 loopNo);
 	void getCelRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect *outRect);
+	void getCelScaledRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, int16 scaleX, int16 scaleY, Common::Rect *outRect);
 	byte *getBitmap(int16 loopNo, int16 celNo);
 	void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires, uint16 scaleX = 128, uint16 scaleY = 128);
 	uint16 getLoopCount() const { return _loopCount; }


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