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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon Oct 5 15:33:26 CEST 2009


Revision: 44663
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44663&view=rev
Author:   thebluegr
Date:     2009-10-05 13:33:26 +0000 (Mon, 05 Oct 2009)

Log Message:
-----------
Lines are no longer treated as fake rectangles and are shown correctly again

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/gui/gui.cpp
    scummvm/trunk/engines/sci/gui/gui.h
    scummvm/trunk/engines/sci/gui32/gui32.cpp
    scummvm/trunk/engines/sci/gui32/gui32.h

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-10-05 12:49:31 UTC (rev 44662)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-10-05 13:33:26 UTC (rev 44663)
@@ -406,22 +406,16 @@
 }
 
 reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
-	int rectLeft = 0, rectTop = 0, rectRight = 0, rectBottom = 0;
+	int x = 0, y = 0, x1 = 0, y1 = 0;
 	uint16 flags;
 	int16 priority, control, color, colorMask;
-
 	Common::Rect rect;
-	if (argc>=5) {
-		rectLeft = argv[2].toSint16(); rectTop = argv[1].toSint16();
-		rectRight = argv[4].toSint16(); rectBottom = argv[3].toSint16();
-		// Fixup data, so that a valid rectangle is formed
-		if (rectLeft > rectRight) {
-			rectRight = rectLeft; rectLeft = argv[4].toSint16();
-		}
-		if (rectTop > rectBottom) {
-			rectBottom = rectTop; rectTop = argv[3].toSint16();
-		}
-		rect = Common::Rect (rectLeft, rectTop, rectRight, rectBottom);
+
+	if (argc >= 5) {
+		x = argv[2].toSint16();
+		y = argv[1].toSint16();
+		x1 = argv[4].toSint16();
+		y1 = argv[3].toSint16();
 	}
 
 	// old code, may be removed later after class migration
@@ -443,10 +437,11 @@
 		color = argv[5].toSint16();
 
 		// FIXME: rect must be changed to 2 Common::Point
-		s->gui->graphDrawLine(rect, color, priority, control);
+		s->gui->graphDrawLine(Common::Point(x, y), Common::Point(x1, y1), color, priority, control);
 		break;
 
 	case K_GRAPH_SAVE_BOX:
+		rect = Common::Rect(x, y, x1, y1);
 		flags = (argc > 5) ? argv[5].toUint16() : 0;
 		return s->gui->graphSaveBox(rect, flags);
 		break;
@@ -456,10 +451,12 @@
 		break;
 
 	case K_GRAPH_FILL_BOX_BACKGROUND:
+		rect = Common::Rect(x, y, x1, y1);
 		s->gui->graphFillBoxBackground(rect);
 		break;
 
 	case K_GRAPH_FILL_BOX_FOREGROUND:
+		rect = Common::Rect(x, y, x1, y1);
 		s->gui->graphFillBoxForeground(rect);
 		break;
 
@@ -469,6 +466,7 @@
 		color = argv[6].toSint16();
 		colorMask = argv[5].toUint16();
 
+		rect = Common::Rect(x, y, x1, y1);
 		s->gui->graphFillBox(rect, colorMask, color, priority, control);
 		break;
 

Modified: scummvm/trunk/engines/sci/gui/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.cpp	2009-10-05 12:49:31 UTC (rev 44662)
+++ scummvm/trunk/engines/sci/gui/gui.cpp	2009-10-05 13:33:26 UTC (rev 44663)
@@ -304,8 +304,8 @@
 	_screen->copyToScreen();
 }
 
-void SciGui::graphDrawLine(Common::Rect rect, int16 color, int16 priority, int16 control) {
-	_gfx->Draw_Line(rect.left, rect.top, rect.right, rect.bottom, color, priority, control);
+void SciGui::graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) {
+	_gfx->Draw_Line(startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control);
 	_screen->copyToScreen();
 }
 

Modified: scummvm/trunk/engines/sci/gui/gui.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.h	2009-10-05 12:49:31 UTC (rev 44662)
+++ scummvm/trunk/engines/sci/gui/gui.h	2009-10-05 13:33:26 UTC (rev 44663)
@@ -70,7 +70,7 @@
 	virtual void graphFillBoxForeground(Common::Rect rect);
 	virtual void graphFillBoxBackground(Common::Rect rect);
 	virtual void graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control);
-	virtual void graphDrawLine(Common::Rect rect, int16 color, int16 priority, int16 control);
+	virtual void graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control);
 	virtual reg_t graphSaveBox(Common::Rect rect, uint16 flags);
 	virtual void graphRestoreBox(reg_t handle);
 

Modified: scummvm/trunk/engines/sci/gui32/gui32.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui32/gui32.cpp	2009-10-05 12:49:31 UTC (rev 44662)
+++ scummvm/trunk/engines/sci/gui32/gui32.cpp	2009-10-05 13:33:26 UTC (rev 44663)
@@ -663,17 +663,13 @@
 	s->picture_port->add((GfxContainer *)s->picture_port, gfxw_new_box(s->gfx_state, area, fillColor, fillColor, GFX_BOX_SHADE_FLAT));
 }
 
-void SciGui32::graphDrawLine(Common::Rect rect, int16 color, int16 priority, int16 control) {
+void SciGui32::graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) {
 	gfx_color_t gfxcolor = graph_map_color(s, color, priority, control);
 
 	debugC(2, kDebugLevelGraphics, "draw_line((%d, %d), (%d, %d), col=%d, p=%d, c=%d, mask=%d)\n",
-	          rect.left, rect.top, rect.right, rect.bottom, color, priority, control, gfxcolor.mask);
+	          startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control, gfxcolor.mask);
 
-	// Note: it's quite possible that the coordinates of the line will *not* form a valid rectangle (e.g. it might
-	// have negative width/height). The actual dirty rectangle is constructed in gfxdr_add_dirty().
-	// FIXME/TODO: We need to change the semantics of this call, so that no fake rectangles are used. As it is, it's
-	// not possible change rect_t to Common::Rect, as we assume that Common::Rect forms a *valid* rectangle.
-	ADD_TO_CURRENT_PICTURE_PORT(gfxw_new_line(Common::Point(rect.left, rect.top), Common::Point(rect.right, rect.bottom),
+	ADD_TO_CURRENT_PICTURE_PORT(gfxw_new_line(startPoint, endPoint,
 	                               gfxcolor, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
 	FULL_REDRAW();
 }

Modified: scummvm/trunk/engines/sci/gui32/gui32.h
===================================================================
--- scummvm/trunk/engines/sci/gui32/gui32.h	2009-10-05 12:49:31 UTC (rev 44662)
+++ scummvm/trunk/engines/sci/gui32/gui32.h	2009-10-05 13:33:26 UTC (rev 44663)
@@ -65,7 +65,7 @@
 	void graphFillBoxForeground(Common::Rect rect);
 	void graphFillBoxBackground(Common::Rect rect);	
 	void graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control);
-	void graphDrawLine(Common::Rect rect, int16 color, int16 priority, int16 control);
+	void graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control);
 	reg_t graphSaveBox(Common::Rect rect, uint16 flags);
 	void graphRestoreBox(reg_t handle);
 


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