aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2009-03-19 21:27:01 +0000
committerFilippos Karapetis2009-03-19 21:27:01 +0000
commit3d5ad1e6a37d9b35eb6f87ca469deed1e597e62d (patch)
treee9df2d671edac594d44fcd54e150c10e36626944
parent21e35c4f6790e316c95c1f69841dc7a422bc31cc (diff)
downloadscummvm-rg350-3d5ad1e6a37d9b35eb6f87ca469deed1e597e62d.tar.gz
scummvm-rg350-3d5ad1e6a37d9b35eb6f87ca469deed1e597e62d.tar.bz2
scummvm-rg350-3d5ad1e6a37d9b35eb6f87ca469deed1e597e62d.zip
Cleaned up gfxop_draw_rectangle(). Also, removed a check insode BASIC_CHECKS() which is impossible to occur
svn-id: r39540
-rw-r--r--engines/sci/gfx/operations.cpp24
1 files changed, 5 insertions, 19 deletions
diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp
index 41510c89a6..4dd60fa46b 100644
--- a/engines/sci/gfx/operations.cpp
+++ b/engines/sci/gfx/operations.cpp
@@ -66,10 +66,6 @@ gfx_pixmap_color_t default_colors[DEFAULT_COLORS_NR] = {{GFX_COLOR_SYSTEM, 0x00,
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_line(gfx_state_t *state, Common::Point start, Common::Point end,
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 @@ int gfxop_draw_rectangle(gfx_state_t *state, rect_t rect, gfx_color_t color, gfx
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);