aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2009-09-02 13:21:38 +0000
committerFilippos Karapetis2009-09-02 13:21:38 +0000
commit2f99fea9a3c5c7d0c83d8b4ba5fc33bd91abf5ec (patch)
treedc1867d54d2d820825cfb72a9d871aaca81f9e36
parent1bbab8f1915eebdb18365c64ec64eec2a8770bb6 (diff)
downloadscummvm-rg350-2f99fea9a3c5c7d0c83d8b4ba5fc33bd91abf5ec.tar.gz
scummvm-rg350-2f99fea9a3c5c7d0c83d8b4ba5fc33bd91abf5ec.tar.bz2
scummvm-rg350-2f99fea9a3c5c7d0c83d8b4ba5fc33bd91abf5ec.zip
Removed the dirty rectangle option of updating one huge rectangle, and only left the algorithm of updating the screen with multiple small rectangles, like we do in all the other engines that support dirty rectangle screen updates
svn-id: r43909
-rw-r--r--engines/sci/gfx/gfx_options.h8
-rw-r--r--engines/sci/gfx/gfx_widgets.cpp4
-rw-r--r--engines/sci/gfx/gfx_widgets.h7
-rw-r--r--engines/sci/gfx/operations.cpp49
-rw-r--r--engines/sci/gfx/operations.h3
-rw-r--r--engines/sci/sci.cpp1
6 files changed, 15 insertions, 57 deletions
diff --git a/engines/sci/gfx/gfx_options.h b/engines/sci/gfx/gfx_options.h
index ac8e700e5e..6060b30b4d 100644
--- a/engines/sci/gfx/gfx_options.h
+++ b/engines/sci/gfx/gfx_options.h
@@ -39,12 +39,6 @@
namespace Sci {
-/** Dirty rectangle heuristics. */
-enum {
- GFXOP_DIRTY_FRAMES_ONE = 1, /**< One: Redraw one rectangle surrounding the dirty area (insert is O(1)) */
- GFXOP_DIRTY_FRAMES_CLUSTERS = 2 /**< Clusters: Accumulate dirty rects, merging those that overlap (insert is O(n)) */
-};
-
/**
* All user options to the rendering pipeline
*
@@ -72,8 +66,6 @@ struct gfx_options_t {
gfx_xlate_filter_t text_xlate_filter;
gfx_res_fullconf_t res_conf; /* Resource customisation: Per-resource palettes etc. */
- int dirty_frames; // Dirty frames management
-
int workarounds; // Workaround flags - see below
#endif
};
diff --git a/engines/sci/gfx/gfx_widgets.cpp b/engines/sci/gfx/gfx_widgets.cpp
index fbe682bab4..0bea12fca8 100644
--- a/engines/sci/gfx/gfx_widgets.cpp
+++ b/engines/sci/gfx/gfx_widgets.cpp
@@ -1195,7 +1195,7 @@ static int _gfxwop_container_add_dirty(GfxContainer *container, rect_t dirty, in
#endif
DDIRTY(stderr, "Effectively adding dirty %d,%d,%d,%d %d to ID %d\n", GFX_PRINT_RECT(dirty), propagate, container->_ID);
- gfxdr_add_dirty(container->_dirtyRects, dirty, GFXW_DIRTY_STRATEGY);
+ gfxdr_add_dirty(container->_dirtyRects, dirty);
return 0;
}
@@ -1463,7 +1463,7 @@ int GfxPort::draw(const Common::Point &pos) {
DDIRTY(stderr, "Adding multiple dirty to #%d\n", _decorations->_ID);
for (DirtyRectList::iterator dirty = _dirtyRects.begin(); dirty != _dirtyRects.end(); ++dirty) {
- gfxdr_add_dirty(_decorations->_dirtyRects, *dirty, GFXW_DIRTY_STRATEGY);
+ gfxdr_add_dirty(_decorations->_dirtyRects, *dirty);
}
if (_decorations->draw(gfxw_point_zero)) {
diff --git a/engines/sci/gfx/gfx_widgets.h b/engines/sci/gfx/gfx_widgets.h
index ace13ff1b9..6369eabd19 100644
--- a/engines/sci/gfx/gfx_widgets.h
+++ b/engines/sci/gfx/gfx_widgets.h
@@ -55,9 +55,6 @@ struct GfxWidget;
** of members (/SLOW/) */
//#define GFXW_DEBUG_WIDGETS 2048
-/* Our strategy for dirty rectangle management */
-#define GFXW_DIRTY_STRATEGY GFXOP_DIRTY_FRAMES_CLUSTERS
-
/* Terminology
**
** Two special terms are used in here: /equivalent/ and /clear/. Their meanings
@@ -123,8 +120,6 @@ extern Common::Point gfxw_point_zero;
** Returns : (int) 0
** Transparent containers will usually pass this value to their next ancestor,
** because areas below them might have to be redrawn.
-** The dirty rectangle management strategy is defined in this file in
-** GFXW_DIRTY_STRATEGY.
**
**
** -- add_dirty_rel(GfxContainer *self, rect_t dirty, int propagate)
@@ -137,8 +132,6 @@ extern Common::Point gfxw_point_zero;
** Returns : (int) 0
** Transparent containers will usually pass this value to their next ancestor,
** because areas below them might have to be redrawn.
-** The dirty rectangle management strategy is defined in this file in
-** GFXW_DIRTY_STRATEGY.
**
**
** -- add(GfxContainer *self, GfxWidget *widget)
diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp
index 1e25b93531..0fad18d261 100644
--- a/engines/sci/gfx/operations.cpp
+++ b/engines/sci/gfx/operations.cpp
@@ -308,7 +308,7 @@ static void _gfxop_update_box(GfxState *state, rect_t box) {
_gfxop_buffer_propagate_box(state, box, GFX_BUFFER_FRONT);
}
-void gfxdr_add_dirty(DirtyRectList &list, rect_t box, int strategy) {
+void gfxdr_add_dirty(DirtyRectList &list, rect_t box) {
if (box.width < 0) {
box.x += box.width;
box.width = - box.width;
@@ -325,50 +325,25 @@ void gfxdr_add_dirty(DirtyRectList &list, rect_t box, int strategy) {
if (_gfxop_clip(&box, gfx_rect(0, 0, 320, 200)))
return;
- switch (strategy) {
-
- case GFXOP_DIRTY_FRAMES_ONE:
- if (!list.empty()) {
- Common::Rect tmp = toCommonRect(list.front());
- tmp.extend(toCommonRect(box));
- list.front() = toSCIRect(tmp);
- } else {
- list.push_back(box);
- }
- break;
-
- case GFXOP_DIRTY_FRAMES_CLUSTERS: {
- DirtyRectList::iterator dirty = list.begin();
- while (dirty != list.end()) {
- if (gfx_rects_overlap(*dirty, box)) {
- Common::Rect tmp = toCommonRect(box);
- tmp.extend(toCommonRect(*dirty));
- box = toSCIRect(tmp);
-
- dirty = list.erase(dirty);
- } else
- ++dirty;
- }
- list.push_back(box);
-
- }
- break;
-
- default:
- error("Attempt to use invalid dirty frame mode %d!\nPlease refer to gfx_options.h", strategy);
+ DirtyRectList::iterator dirty = list.begin();
+ while (dirty != list.end()) {
+ if (gfx_rects_overlap(*dirty, box)) {
+ Common::Rect tmp = toCommonRect(box);
+ tmp.extend(toCommonRect(*dirty));
+ box = toSCIRect(tmp);
+ dirty = list.erase(dirty);
+ } else
+ ++dirty;
}
+ list.push_back(box);
}
static void _gfxop_add_dirty(GfxState *state, rect_t box) {
if (state->disable_dirty)
return;
-#ifdef CUSTOM_GRAPHICS_OPTIONS
- gfxdr_add_dirty(state->_dirtyRects, box, state->options->dirty_frames);
-#else
- gfxdr_add_dirty(state->_dirtyRects, box, GFXOP_DIRTY_FRAMES_CLUSTERS);
-#endif
+ gfxdr_add_dirty(state->_dirtyRects, box);
}
static void _gfxop_add_dirty_x(GfxState *state, rect_t box) {
diff --git a/engines/sci/gfx/operations.h b/engines/sci/gfx/operations.h
index 5419388eb2..359b437d94 100644
--- a/engines/sci/gfx/operations.h
+++ b/engines/sci/gfx/operations.h
@@ -698,9 +698,8 @@ void gfxop_free_pixmap(GfxState *state, gfx_pixmap_t *pxm);
*
* @param[in] list the list to add to
* @param[in] box the dirty frame to addable
- * @param[in] strategy the dirty frame heuristic to use (see gfx_options.h)
*/
-void gfxdr_add_dirty(DirtyRectList &list, rect_t box, int strategy);
+void gfxdr_add_dirty(DirtyRectList &list, rect_t box);
/**
* Clips a rectangle against another one.
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 074c9d2568..9abe01f483 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -181,7 +181,6 @@ Common::Error SciEngine::run() {
gfx_options.view_xlate_filter = (gfx_xlate_filter_t)ConfMan.getInt("view_filter");
gfx_options.pic_xlate_filter = (gfx_xlate_filter_t)ConfMan.getInt("pic_filter");
gfx_options.text_xlate_filter = (gfx_xlate_filter_t)ConfMan.getInt("text_filter");
- gfx_options.dirty_frames = GFXOP_DIRTY_FRAMES_CLUSTERS;
for (int i = 0; i < GFX_RESOURCE_TYPES_NR; i++) {
gfx_options.res_conf.assign[i] = NULL;
gfx_options.res_conf.mod[i] = NULL;