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
This commit is contained in:
Filippos Karapetis 2009-09-02 13:21:38 +00:00
parent 1bbab8f191
commit 2f99fea9a3
6 changed files with 15 additions and 57 deletions

View File

@ -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
};

View File

@ -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)) {

View File

@ -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)

View File

@ -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) {

View File

@ -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.

View File

@ -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;