aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gfx
diff options
context:
space:
mode:
authorFilippos Karapetis2009-02-17 22:53:09 +0000
committerFilippos Karapetis2009-02-17 22:53:09 +0000
commit53ef1bd4fd6d588e460db54995d8aa24f30b6513 (patch)
treee4fa057e00f99518fa4eae672f3913155394f638 /engines/sci/gfx
parentddbad0197b158f2a27d9ca4eb5c9ecb542a9feeb (diff)
downloadscummvm-rg350-53ef1bd4fd6d588e460db54995d8aa24f30b6513.tar.gz
scummvm-rg350-53ef1bd4fd6d588e460db54995d8aa24f30b6513.tar.bz2
scummvm-rg350-53ef1bd4fd6d588e460db54995d8aa24f30b6513.zip
Removed already implemented graphic capability flags, and used CLIP inside scummvm_draw_line() to clean up the code a bit
svn-id: r38451
Diffstat (limited to 'engines/sci/gfx')
-rw-r--r--engines/sci/gfx/gfx_driver.cpp27
-rw-r--r--engines/sci/gfx/operations.cpp58
2 files changed, 23 insertions, 62 deletions
diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp
index 618d61ec84..453af11f9b 100644
--- a/engines/sci/gfx/gfx_driver.cpp
+++ b/engines/sci/gfx/gfx_driver.cpp
@@ -172,27 +172,10 @@ scummvm_draw_line(struct _gfx_driver *drv, Common::Point start, Common::Point en
if (color.mask & GFX_MASK_VISUAL) {
Common::Point nstart, nend;
- nstart.x = start.x;
- nstart.y = start.y;
- nend.x = end.x;
- nend.y = end.y;
-
- if (nstart.x < 0)
- nstart.x = 0;
- if (nend.x < 0)
- nstart.x = 0;
- if (nstart.y < 0)
- nstart.y = 0;
- if (nend.y < 0)
- nend.y = 0;
- if (nstart.x > xsize)
- nstart.x = xsize;
- if (nend.x >= xsize)
- nend.x = xsize - 1;
- if (nstart.y > ysize)
- nstart.y = ysize;
- if (nend.y >= ysize)
- nend.y = ysize - 1;
+ nstart.x = CLIP<int16>(start.x, 0, xsize);
+ nstart.y = CLIP<int16>(start.y, 0, ysize);
+ nend.x = CLIP<int16>(end.x, 0, xsize - 1);
+ nend.y = CLIP<int16>(end.y, 0, ysize - 1);
lineColor2(S->visual[1], (int16)nstart.x, (int16)nstart.y,
(int16)nend.x, (int16)nend.y, scolor);
@@ -544,7 +527,7 @@ gfx_driver_scummvm = {
SCI_GFX_DRIVER_VERSION,
NULL,
0, 0,
- GFX_CAPABILITY_MOUSE_POINTER | GFX_CAPABILITY_COLOR_MOUSE_POINTER | GFX_CAPABILITY_MOUSE_SUPPORT | GFX_CAPABILITY_FINE_LINES | GFX_CAPABILITY_WINDOWED,
+ 0, // flags here
0,
NULL,
scummvm_init_specific,
diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp
index 0419257748..edcf76f6dd 100644
--- a/engines/sci/gfx/operations.cpp
+++ b/engines/sci/gfx/operations.cpp
@@ -707,12 +707,6 @@ gfxop_exit(gfx_state_t *state) {
}
-int
-gfxop_have_mouse(gfx_state_t *state) {
- return state->driver->capabilities & GFX_CAPABILITY_MOUSE_SUPPORT;
-}
-
-
static int
_gfxop_scan_one_bitmask(gfx_pixmap_t *pixmap, rect_t zone) {
int retval = 0;
@@ -1117,10 +1111,6 @@ _gfxop_draw_line_clipped(gfx_state_t *state, Common::Point start, Common::Point
return simulate_stippled_line_draw(state->driver, skipone, start, end, color, line_mode);
}
- if (line_mode == GFX_LINE_MODE_FINE
- && !(state->driver->capabilities & GFX_CAPABILITY_FINE_LINES))
- line_mode = GFX_LINE_MODE_FAST;
-
if ((retval = state->driver->draw_line(state->driver, start, end, color, line_mode, line_style))) {
GFXERROR("Failed to draw line (%d,%d) -- (%d,%d)\n",
start.x, start.y, end.x, end.y);
@@ -1173,8 +1163,7 @@ gfxop_draw_rectangle(gfx_state_t *state, rect_t rect, gfx_color_t color, gfx_lin
xfact = state->driver->mode->xfact;
yfact = state->driver->mode->yfact;
- if (line_mode == GFX_LINE_MODE_FINE
- && state->driver->capabilities & GFX_CAPABILITY_FINE_LINES) {
+ if (line_mode == GFX_LINE_MODE_FINE) {
xunit = yunit = 1;
xl = 1 + (rect.xl - 1) * xfact;
yl = 1 + (rect.yl - 1) * yfact;
@@ -1551,37 +1540,26 @@ _gfxop_set_pointer(gfx_state_t *state, gfx_pixmap_t *pxm) {
draw_old = state->mouse_pointer != NULL;
- if (state->driver->capabilities & GFX_CAPABILITY_MOUSE_POINTER) {
+ if (draw_old && state->mouse_pointer->colors_nr > 2)
+ draw_old = 1;
- if (draw_old && state->mouse_pointer->colors_nr > 2)
- draw_old = state->driver->capabilities & GFX_CAPABILITY_COLOR_MOUSE_POINTER;
-
- if (!draw_old
- && state->mouse_pointer
- && (state->driver->capabilities & GFX_CAPABILITY_POINTER_PIXMAP_REGISTRY))
- if ((retval = state->driver->unregister_pixmap(state->driver, state->mouse_pointer))) {
- GFXERROR("Pointer un-registration failed!\n");
- return retval;
- }
-
- if (pxm == NULL
- || (state->driver->capabilities & GFX_CAPABILITY_COLOR_MOUSE_POINTER)
- || pxm->colors_nr <= 2) {
- if (state->driver->capabilities & GFX_CAPABILITY_POINTER_PIXMAP_REGISTRY) {
- if ((pxm) && (retval = state->driver->register_pixmap(state->driver, pxm))) {
- GFXERROR("Pixmap-registering a new mouse pointer failed!\n");
- return retval;
- }
- }
- draw_new = 0;
- state->driver->set_pointer(state->driver, pxm);
- state->mouse_pointer_in_hw = 1;
- } else {
- draw_new = 1;
- state->mouse_pointer_in_hw = 0;
+ if (!draw_old
+ && state->mouse_pointer
+ && (state->driver->capabilities & GFX_CAPABILITY_POINTER_PIXMAP_REGISTRY))
+ if ((retval = state->driver->unregister_pixmap(state->driver, state->mouse_pointer))) {
+ GFXERROR("Pointer un-registration failed!\n");
+ return retval;
}
- } else draw_new = 1;
+ if (state->driver->capabilities & GFX_CAPABILITY_POINTER_PIXMAP_REGISTRY) {
+ if ((pxm) && (retval = state->driver->register_pixmap(state->driver, pxm))) {
+ GFXERROR("Pixmap-registering a new mouse pointer failed!\n");
+ return retval;
+ }
+ }
+ draw_new = 0;
+ state->driver->set_pointer(state->driver, pxm);
+ state->mouse_pointer_in_hw = 1;
if (!state->mouse_pointer_in_hw)
draw_old = state->mouse_pointer != NULL;