[Scummvm-cvs-logs] SF.net SVN: scummvm:[39540] scummvm/trunk/engines/sci/gfx/operations.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu Mar 19 22:27:02 CET 2009


Revision: 39540
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39540&view=rev
Author:   thebluegr
Date:     2009-03-19 21:27:01 +0000 (Thu, 19 Mar 2009)

Log Message:
-----------
Cleaned up gfxop_draw_rectangle(). Also, removed a check insode BASIC_CHECKS() which is impossible to occur

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gfx/operations.cpp

Modified: scummvm/trunk/engines/sci/gfx/operations.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.cpp	2009-03-19 21:17:44 UTC (rev 39539)
+++ scummvm/trunk/engines/sci/gfx/operations.cpp	2009-03-19 21:27:01 UTC (rev 39540)
@@ -66,10 +66,6 @@
 if (!state) { \
 	GFXERROR("Null state!\n"); \
 	return error_retval; \
-} \
-if (!state->driver) { \
-	GFXERROR("GFX driver invalid!\n"); \
-	return error_retval; \
 }
 
 // How to determine whether colors have to be allocated
@@ -895,7 +891,6 @@
 int gfxop_draw_rectangle(gfx_state_t *state, rect_t rect, gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) {
 	int retval = 0;
 	int xfact, yfact;
-	int xunit, yunit;
 	int x, y, xl, yl;
 	Common::Point upper_left_u, upper_right_u, lower_left_u, lower_right_u;
 	Common::Point upper_left, upper_right, lower_left, lower_right;
@@ -906,20 +901,11 @@
 	xfact = state->driver->mode->xfact;
 	yfact = state->driver->mode->yfact;
 
-	if (line_mode == GFX_LINE_MODE_FINE) {
-		xunit = yunit = 1;
-		xl = 1 + (rect.width - 1) * xfact;
-		yl = 1 + (rect.height - 1) * yfact;
-		x = rect.x * xfact + (xfact - 1);
-		y = rect.y * yfact + (yfact - 1);
-	} else {
-		xunit = xfact;
-		yunit = yfact;
-		xl = rect.width * xfact;
-		yl = rect.height * yfact;
-		x = rect.x * xfact;
-		y = rect.y * yfact;
-	}
+	int offset = line_mode == GFX_LINE_MODE_FINE ? 1 : 0;
+	x = rect.x * xfact + (xfact - 1) * offset;
+	y = rect.y * yfact + (yfact - 1) * offset;
+	xl = offset + (rect.width - offset) * xfact;
+	yl = offset + (rect.height - offset) * yfact;
 
 	upper_left_u = Common::Point(rect.x, rect.y);
 	upper_right_u = Common::Point(rect.x + rect.width, rect.y);


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