aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorRuediger Hanke2002-08-31 22:59:26 +0000
committerRuediger Hanke2002-08-31 22:59:26 +0000
commit79c1f284b72096768515a2ba39ce8dea45193a34 (patch)
tree349d0fccbf78e4ff54fc32b84304e8d19827ed21 /backends
parent93b630dcfe687a874f0933d5bcbbf94daa426696 (diff)
downloadscummvm-rg350-79c1f284b72096768515a2ba39ce8dea45193a34.tar.gz
scummvm-rg350-79c1f284b72096768515a2ba39ce8dea45193a34.tar.bz2
scummvm-rg350-79c1f284b72096768515a2ba39ce8dea45193a34.zip
Limit number of update rects to keep
svn-id: r4891
Diffstat (limited to 'backends')
-rw-r--r--backends/morphos/morphos.cpp11
-rw-r--r--backends/morphos/morphos.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/backends/morphos/morphos.cpp b/backends/morphos/morphos.cpp
index 0c2e9a7fce..22390b634e 100644
--- a/backends/morphos/morphos.cpp
+++ b/backends/morphos/morphos.cpp
@@ -115,6 +115,7 @@ OSystem_MorphOS::OSystem_MorphOS(int game_id, SCALERTYPE gfx_mode, bool full_scr
ScreenChanged = false;
DirtyBlocks = NULL;
BlockColors = NULL;
+ UpdateRects = 0;
Scaler = NULL;
FullScreenMode = full_screen;
CDrive = NULL;
@@ -928,6 +929,9 @@ void OSystem_MorphOS::copy_rect(const byte *src, int pitch, int x, int y, int w,
bool OSystem_MorphOS::AddUpdateRect(WORD x, WORD y, WORD w, WORD h)
{
+ if (UpdateRects > 20)
+ return false;
+
if (x < 0) { w+=x; x = 0; }
if (y < 0) { h+=y; y = 0; }
if (w >= ScummBufferWidth-x) { w = ScummBufferWidth - x; }
@@ -936,6 +940,12 @@ bool OSystem_MorphOS::AddUpdateRect(WORD x, WORD y, WORD w, WORD h)
if (w <= 0 || h <= 0)
return false;
+ if (++UpdateRects > 25)
+ {
+ x = 0; y = 0;
+ w = ScummBufferWidth; h = ScummBufferHeight;
+ }
+
Rectangle update_rect = { x, y, x+w, y+h };
OrRectRegion(NewUpdateRegion, &update_rect);
ScreenChanged = true;
@@ -1088,6 +1098,7 @@ void OSystem_MorphOS::update_screen()
ScreenChanged = false;
memset(DirtyBlocks, 0, BLOCKS_X*BLOCKS_Y*sizeof (bool));
+ UpdateRects = 0;
}
void OSystem_MorphOS::DrawMouse()
diff --git a/backends/morphos/morphos.h b/backends/morphos/morphos.h
index d89c2e7371..aead0c3aec 100644
--- a/backends/morphos/morphos.h
+++ b/backends/morphos/morphos.h
@@ -152,6 +152,7 @@ class OSystem_MorphOS : public OSystem
bool *DirtyBlocks;
Region *UpdateRegion;
Region *NewUpdateRegion;
+ ULONG UpdateRects;
/* Sound-related attributes */
Process *ScummMusicThread;