OSYSTEM: Get rid of kFeatureAutoComputeDirtyRects

svn-id: r49388
This commit is contained in:
Max Horn 2010-06-02 00:52:57 +00:00
parent c4c63223cc
commit 767edc91fa
13 changed files with 52 additions and 360 deletions

View file

@ -191,10 +191,6 @@ protected:
bool _overlayVisible; bool _overlayVisible;
Graphics::PixelFormat _overlayFormat; Graphics::PixelFormat _overlayFormat;
enum {
DF_WANT_RECT_OPTIM = 1 << 0
};
enum { enum {
kTransactionNone = 0, kTransactionNone = 0,
kTransactionActive = 1, kTransactionActive = 1,
@ -235,7 +231,6 @@ protected:
Graphics::Surface _framebuffer; Graphics::Surface _framebuffer;
/** Current video mode flags (see DF_* constants) */ /** Current video mode flags (see DF_* constants) */
uint32 _modeFlags;
bool _modeChanged; bool _modeChanged;
int _screenChangeCount; int _screenChangeCount;
@ -252,9 +247,6 @@ protected:
// Dirty rect management // Dirty rect management
SDL_Rect _dirtyRectList[NUM_DIRTY_RECT]; SDL_Rect _dirtyRectList[NUM_DIRTY_RECT];
int _numDirtyRects; int _numDirtyRects;
uint32 *_dirtyChecksums;
bool _cksumValid;
int _cksumNum;
// Keyboard mouse emulation. Disabled by fingolfin 2004-12-18. // Keyboard mouse emulation. Disabled by fingolfin 2004-12-18.
// I am keeping the rest of the code in for now, since the joystick // I am keeping the rest of the code in for now, since the joystick
@ -351,9 +343,6 @@ protected:
Common::TimerManager *_timer; Common::TimerManager *_timer;
protected: protected:
void addDirtyRgnAuto(const byte *buf);
void makeChecksums(const byte *buf);
virtual void addDirtyRect(int x, int y, int w, int h, bool realCoordinates = false); virtual void addDirtyRect(int x, int y, int w, int h, bool realCoordinates = false);
void drawMouse(); void drawMouse();

View file

@ -193,13 +193,11 @@ void OSystem_GP2X::initBackend() {
memset(&_videoMode, 0, sizeof(_videoMode)); memset(&_videoMode, 0, sizeof(_videoMode));
memset(&_transactionDetails, 0, sizeof(_transactionDetails)); memset(&_transactionDetails, 0, sizeof(_transactionDetails));
_cksumValid = false;
_videoMode.mode = GFX_NORMAL; _videoMode.mode = GFX_NORMAL;
_videoMode.scaleFactor = 1; _videoMode.scaleFactor = 1;
_scalerProc = Normal1x; _scalerProc = Normal1x;
_videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio"); _videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio");
_scalerType = 0; _scalerType = 0;
_modeFlags = 0;
_adjustZoomOnMouse = false; _adjustZoomOnMouse = false;
ConfMan.setBool("FM_low_quality", true); ConfMan.setBool("FM_low_quality", true);
@ -246,7 +244,7 @@ OSystem_GP2X::OSystem_GP2X()
_hwscreen(0), _screen(0), _tmpscreen(0), _hwscreen(0), _screen(0), _tmpscreen(0),
_overlayVisible(false), _overlayVisible(false),
_overlayscreen(0), _tmpscreen2(0), _overlayscreen(0), _tmpscreen2(0),
_scalerProc(0), _modeChanged(false), _screenChangeCount(0), _dirtyChecksums(0), _scalerProc(0), _modeChanged(false), _screenChangeCount(0),
_mouseVisible(false), _mouseNeedsRedraw(false), _mouseData(0), _mouseSurface(0), _mouseVisible(false), _mouseNeedsRedraw(false), _mouseData(0), _mouseSurface(0),
_mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true), _mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true),
_joystick(0), _joystick(0),
@ -281,7 +279,6 @@ OSystem_GP2X::~OSystem_GP2X() {
SDL_RemoveTimer(_timerID); SDL_RemoveTimer(_timerID);
closeMixer(); closeMixer();
free(_dirtyChecksums);
free(_currentPalette); free(_currentPalette);
free(_cursorPalette); free(_cursorPalette);
free(_mouseData); free(_mouseData);
@ -380,7 +377,6 @@ bool OSystem_GP2X::hasFeature(Feature f) {
return return
(f == kFeatureFullscreenMode) || (f == kFeatureFullscreenMode) ||
(f == kFeatureAspectRatioCorrection) || (f == kFeatureAspectRatioCorrection) ||
(f == kFeatureAutoComputeDirtyRects) ||
(f == kFeatureCursorHasPalette); (f == kFeatureCursorHasPalette);
} }
@ -391,12 +387,6 @@ void OSystem_GP2X::setFeatureState(Feature f, bool enable) {
case kFeatureAspectRatioCorrection: case kFeatureAspectRatioCorrection:
setAspectRatioCorrection(enable); setAspectRatioCorrection(enable);
break; break;
case kFeatureAutoComputeDirtyRects:
if (enable)
_modeFlags |= DF_WANT_RECT_OPTIM;
else
_modeFlags &= ~DF_WANT_RECT_OPTIM;
break;
case kFeatureDisableKeyFiltering: case kFeatureDisableKeyFiltering:
// TODO: Extend as more support for this is added to engines. // TODO: Extend as more support for this is added to engines.
return; return;
@ -413,8 +403,6 @@ bool OSystem_GP2X::getFeatureState(Feature f) {
return false; return false;
case kFeatureAspectRatioCorrection: case kFeatureAspectRatioCorrection:
return _videoMode.aspectRatioCorrection; return _videoMode.aspectRatioCorrection;
case kFeatureAutoComputeDirtyRects:
return _modeFlags & DF_WANT_RECT_OPTIM;
default: default:
return false; return false;
} }
@ -431,7 +419,6 @@ void OSystem_GP2X::quit() {
SDL_RemoveTimer(_timerID); SDL_RemoveTimer(_timerID);
closeMixer(); closeMixer();
free(_dirtyChecksums);
free(_currentPalette); free(_currentPalette);
free(_cursorPalette); free(_cursorPalette);
free(_mouseData); free(_mouseData);

View file

@ -270,12 +270,7 @@ void OSystem_GP2X::initSize(uint w, uint h, const Graphics::PixelFormat *format)
_videoMode.screenWidth = w; _videoMode.screenWidth = w;
_videoMode.screenHeight = h; _videoMode.screenHeight = h;
_cksumNum = (w * h / (8 * 8));
_transactionDetails.sizeChanged = true; _transactionDetails.sizeChanged = true;
free(_dirtyChecksums);
_dirtyChecksums = (uint32 *)calloc(_cksumNum * 2, sizeof(uint32));
} }
int OSystem_GP2X::effectiveScreenHeight() const { int OSystem_GP2X::effectiveScreenHeight() const {
@ -724,41 +719,32 @@ void OSystem_GP2X::copyRectToScreen(const byte *src, int pitch, int x, int y, in
assert(h > 0 && y + h <= _videoMode.screenHeight); assert(h > 0 && y + h <= _videoMode.screenHeight);
assert(w > 0 && x + w <= _videoMode.screenWidth); assert(w > 0 && x + w <= _videoMode.screenWidth);
if (IS_ALIGNED(src, 4) && pitch == _videoMode.screenWidth && x == 0 && y == 0 && /* Clip the coordinates */
w == _videoMode.screenWidth && h == _videoMode.screenHeight && _modeFlags & DF_WANT_RECT_OPTIM) { if (x < 0) {
/* Special, optimized case for full screen updates. w += x;
* It tries to determine what areas were actually changed, src -= x;
* and just updates those, on the actual display. */ x = 0;
addDirtyRgnAuto(src);
} else {
/* Clip the coordinates */
if (x < 0) {
w += x;
src -= x;
x = 0;
}
if (y < 0) {
h += y;
src -= y * pitch;
y = 0;
}
if (w > _videoMode.screenWidth - x) {
w = _videoMode.screenWidth - x;
}
if (h > _videoMode.screenHeight - y) {
h = _videoMode.screenHeight - y;
}
if (w <= 0 || h <= 0)
return;
_cksumValid = false;
addDirtyRect(x, y, w, h);
} }
if (y < 0) {
h += y;
src -= y * pitch;
y = 0;
}
if (w > _videoMode.screenWidth - x) {
w = _videoMode.screenWidth - x;
}
if (h > _videoMode.screenHeight - y) {
h = _videoMode.screenHeight - y;
}
if (w <= 0 || h <= 0)
return;
addDirtyRect(x, y, w, h);
// Try to lock the screen surface // Try to lock the screen surface
if (SDL_LockSurface(_screen) == -1) if (SDL_LockSurface(_screen) == -1)
error("SDL_LockSurface failed: %s", SDL_GetError()); error("SDL_LockSurface failed: %s", SDL_GetError());
@ -885,88 +871,6 @@ void OSystem_GP2X::addDirtyRect(int x, int y, int w, int h, bool realCoordinates
} }
} }
void OSystem_GP2X::makeChecksums(const byte *buf) {
assert(buf);
uint32 *sums = _dirtyChecksums;
uint x,y;
const uint last_x = (uint)_videoMode.screenWidth / 8;
const uint last_y = (uint)_videoMode.screenHeight / 8;
const uint BASE = 65521; /* largest prime smaller than 65536 */
/* the 8x8 blocks in buf are enumerated starting in the top left corner and
* reading each line at a time from left to right */
for (y = 0; y != last_y; y++, buf += _videoMode.screenWidth * (8 - 1))
for (x = 0; x != last_x; x++, buf += 8) {
// Adler32 checksum algorithm (from RFC1950, used by gzip and zlib).
// This computes the Adler32 checksum of a 8x8 pixel block. Note
// that we can do the modulo operation (which is the slowest part)
// of the algorithm) at the end, instead of doing each iteration,
// since we only have 64 iterations in total - and thus s1 and
// s2 can't overflow anyway.
uint32 s1 = 1;
uint32 s2 = 0;
const byte *ptr = buf;
for (int subY = 0; subY < 8; subY++) {
for (int subX = 0; subX < 8; subX++) {
s1 += ptr[subX];
s2 += s1;
}
ptr += _videoMode.screenWidth;
}
s1 %= BASE;
s2 %= BASE;
/* output the checksum for this block */
*sums++ = (s2 << 16) + s1;
}
}
void OSystem_GP2X::addDirtyRgnAuto(const byte *buf) {
assert(buf);
assert(IS_ALIGNED(buf, 4));
/* generate a table of the checksums */
makeChecksums(buf);
if (!_cksumValid) {
_forceFull = true;
_cksumValid = true;
}
/* go through the checksum list, compare it with the previous checksums,
and add all dirty rectangles to a list. try to combine small rectangles
into bigger ones in a simple way */
if (!_forceFull) {
int x, y, w;
uint32 *ck = _dirtyChecksums;
for (y = 0; y != _videoMode.screenHeight / 8; y++) {
for (x = 0; x != _videoMode.screenWidth / 8; x++, ck++) {
if (ck[0] != ck[_cksumNum]) {
/* found a dirty 8x8 block, now go as far to the right as possible,
and at the same time, unmark the dirty status by setting old to new. */
w=0;
do {
ck[w + _cksumNum] = ck[w];
w++;
} while (x + w != _videoMode.screenWidth / 8 && ck[w] != ck[w + _cksumNum]);
addDirtyRect(x * 8, y * 8, w * 8, 8);
if (_forceFull)
goto get_out;
}
}
}
} else {
get_out:;
/* Copy old checksums to new */
memcpy(_dirtyChecksums + _cksumNum, _dirtyChecksums, _cksumNum * sizeof(uint32));
}
}
int16 OSystem_GP2X::getHeight() { int16 OSystem_GP2X::getHeight() {
return _videoMode.screenHeight; return _videoMode.screenHeight;
} }
@ -1175,7 +1079,6 @@ void OSystem_GP2X::copyRectToOverlay(const OverlayColor *buf, int pitch, int x,
return; return;
// Mark the modified region as dirty // Mark the modified region as dirty
_cksumValid = false;
addDirtyRect(x, y, w, h); addDirtyRect(x, y, w, h);
if (SDL_LockSurface(_overlayscreen) == -1) if (SDL_LockSurface(_overlayscreen) == -1)

View file

@ -127,12 +127,7 @@ void OSystem_GP2XWIZ::initSize(uint w, uint h) {
toggleMouseGrab(); toggleMouseGrab();
} }
_cksumNum = (w * h / (8 * 8));
_transactionDetails.sizeChanged = true; _transactionDetails.sizeChanged = true;
free(_dirtyChecksums);
_dirtyChecksums = (uint32 *)calloc(_cksumNum * 2, sizeof(uint32));
} }
bool OSystem_GP2XWIZ::loadGFXMode() { bool OSystem_GP2XWIZ::loadGFXMode() {

View file

@ -128,12 +128,7 @@ void OSystem_LINUXMOTO::initSize(uint w, uint h) {
toggleMouseGrab(); toggleMouseGrab();
} }
_cksumNum = (w * h / (8 * 8));
_transactionDetails.sizeChanged = true; _transactionDetails.sizeChanged = true;
free(_dirtyChecksums);
_dirtyChecksums = (uint32 *)calloc(_cksumNum * 2, sizeof(uint32));
} }
bool OSystem_LINUXMOTO::loadGFXMode() { bool OSystem_LINUXMOTO::loadGFXMode() {

View file

@ -30,7 +30,6 @@
bool OSystem_SDL_SamsungTV::hasFeature(Feature f) { bool OSystem_SDL_SamsungTV::hasFeature(Feature f) {
return return
(f == kFeatureAspectRatioCorrection) || (f == kFeatureAspectRatioCorrection) ||
(f == kFeatureAutoComputeDirtyRects) ||
(f == kFeatureCursorHasPalette); (f == kFeatureCursorHasPalette);
} }
@ -39,12 +38,6 @@ void OSystem_SDL_SamsungTV::setFeatureState(Feature f, bool enable) {
case kFeatureAspectRatioCorrection: case kFeatureAspectRatioCorrection:
setAspectRatioCorrection(enable); setAspectRatioCorrection(enable);
break; break;
case kFeatureAutoComputeDirtyRects:
if (enable)
_modeFlags |= DF_WANT_RECT_OPTIM;
else
_modeFlags &= ~DF_WANT_RECT_OPTIM;
break;
default: default:
break; break;
} }
@ -56,8 +49,6 @@ bool OSystem_SDL_SamsungTV::getFeatureState(Feature f) {
switch (f) { switch (f) {
case kFeatureAspectRatioCorrection: case kFeatureAspectRatioCorrection:
return _videoMode.aspectRatioCorrection; return _videoMode.aspectRatioCorrection;
case kFeatureAutoComputeDirtyRects:
return _modeFlags & DF_WANT_RECT_OPTIM;
default: default:
return false; return false;
} }

View file

@ -469,12 +469,7 @@ void OSystem_SDL::initSize(uint w, uint h, const Graphics::PixelFormat *format)
_videoMode.screenWidth = w; _videoMode.screenWidth = w;
_videoMode.screenHeight = h; _videoMode.screenHeight = h;
_cksumNum = (w * h / (8 * 8));
_transactionDetails.sizeChanged = true; _transactionDetails.sizeChanged = true;
free(_dirtyChecksums);
_dirtyChecksums = (uint32 *)calloc(_cksumNum * 2, sizeof(uint32));
} }
int OSystem_SDL::effectiveScreenHeight() const { int OSystem_SDL::effectiveScreenHeight() const {
@ -976,16 +971,7 @@ void OSystem_SDL::copyRectToScreen(const byte *src, int pitch, int x, int y, int
assert(h > 0 && y + h <= _videoMode.screenHeight); assert(h > 0 && y + h <= _videoMode.screenHeight);
assert(w > 0 && x + w <= _videoMode.screenWidth); assert(w > 0 && x + w <= _videoMode.screenWidth);
if (IS_ALIGNED(src, 4) && pitch == _videoMode.screenWidth && x == 0 && y == 0 && addDirtyRect(x, y, w, h);
w == _videoMode.screenWidth && h == _videoMode.screenHeight && _modeFlags & DF_WANT_RECT_OPTIM) {
/* Special, optimized case for full screen updates.
* It tries to determine what areas were actually changed,
* and just updates those, on the actual display. */
addDirtyRgnAuto(src);
} else {
_cksumValid = false;
addDirtyRect(x, y, w, h);
}
// Try to lock the screen surface // Try to lock the screen surface
if (SDL_LockSurface(_screen) == -1) if (SDL_LockSurface(_screen) == -1)
@ -1131,89 +1117,6 @@ void OSystem_SDL::addDirtyRect(int x, int y, int w, int h, bool realCoordinates)
} }
} }
void OSystem_SDL::makeChecksums(const byte *buf) {
assert(buf);
uint32 *sums = _dirtyChecksums;
uint x,y;
const uint last_x = (uint)_videoMode.screenWidth / 8;
const uint last_y = (uint)_videoMode.screenHeight / 8;
const uint BASE = 65521; /* largest prime smaller than 65536 */
/* the 8x8 blocks in buf are enumerated starting in the top left corner and
* reading each line at a time from left to right */
for (y = 0; y != last_y; y++, buf += _videoMode.screenWidth * (8 - 1))
for (x = 0; x != last_x; x++, buf += 8) {
// Adler32 checksum algorithm (from RFC1950, used by gzip and zlib).
// This computes the Adler32 checksum of a 8x8 pixel block. Note
// that we can do the modulo operation (which is the slowest part)
// of the algorithm) at the end, instead of doing each iteration,
// since we only have 64 iterations in total - and thus s1 and
// s2 can't overflow anyway.
uint32 s1 = 1;
uint32 s2 = 0;
const byte *ptr = buf;
for (int subY = 0; subY < 8; subY++) {
for (int subX = 0; subX < 8; subX++) {
s1 += ptr[subX];
s2 += s1;
}
ptr += _videoMode.screenWidth;
}
s1 %= BASE;
s2 %= BASE;
/* output the checksum for this block */
*sums++ = (s2 << 16) + s1;
}
}
void OSystem_SDL::addDirtyRgnAuto(const byte *buf) {
assert(buf);
assert(IS_ALIGNED(buf, 4));
/* generate a table of the checksums */
makeChecksums(buf);
if (!_cksumValid) {
_forceFull = true;
_cksumValid = true;
}
/* go through the checksum list, compare it with the previous checksums,
and add all dirty rectangles to a list. try to combine small rectangles
into bigger ones in a simple way */
if (!_forceFull) {
int x, y, w;
uint32 *ck = _dirtyChecksums;
for (y = 0; y != _videoMode.screenHeight / 8; y++) {
for (x = 0; x != _videoMode.screenWidth / 8; x++, ck++) {
if (ck[0] != ck[_cksumNum]) {
/* found a dirty 8x8 block, now go as far to the right as possible,
and at the same time, unmark the dirty status by setting old to new. */
w=0;
do {
ck[w + _cksumNum] = ck[w];
w++;
} while (x + w != _videoMode.screenWidth / 8 && ck[w] != ck[w + _cksumNum]);
addDirtyRect(x * 8, y * 8, w * 8, 8);
if (_forceFull)
goto get_out;
}
}
}
} else {
get_out:;
/* Copy old checksums to new */
memcpy(_dirtyChecksums + _cksumNum, _dirtyChecksums, _cksumNum * sizeof(uint32));
}
}
int16 OSystem_SDL::getHeight() { int16 OSystem_SDL::getHeight() {
return _videoMode.screenHeight; return _videoMode.screenHeight;
} }
@ -1432,7 +1335,6 @@ void OSystem_SDL::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, i
return; return;
// Mark the modified region as dirty // Mark the modified region as dirty
_cksumValid = false;
addDirtyRect(x, y, w, h); addDirtyRect(x, y, w, h);
if (SDL_LockSurface(_overlayscreen) == -1) if (SDL_LockSurface(_overlayscreen) == -1)

View file

@ -149,7 +149,6 @@ void OSystem_SDL::initBackend() {
memset(&_videoMode, 0, sizeof(_videoMode)); memset(&_videoMode, 0, sizeof(_videoMode));
memset(&_transactionDetails, 0, sizeof(_transactionDetails)); memset(&_transactionDetails, 0, sizeof(_transactionDetails));
_cksumValid = false;
#if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && defined(USE_SCALERS) #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && defined(USE_SCALERS)
_videoMode.mode = GFX_DOUBLESIZE; _videoMode.mode = GFX_DOUBLESIZE;
_videoMode.scaleFactor = 2; _videoMode.scaleFactor = 2;
@ -163,7 +162,6 @@ void OSystem_SDL::initBackend() {
_scalerProc = Normal1x; _scalerProc = Normal1x;
#endif #endif
_scalerType = 0; _scalerType = 0;
_modeFlags = 0;
#if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
_videoMode.fullscreen = ConfMan.getBool("fullscreen"); _videoMode.fullscreen = ConfMan.getBool("fullscreen");
@ -233,7 +231,7 @@ OSystem_SDL::OSystem_SDL()
#endif #endif
_overlayVisible(false), _overlayVisible(false),
_overlayscreen(0), _tmpscreen2(0), _overlayscreen(0), _tmpscreen2(0),
_cdrom(0), _scalerProc(0), _modeChanged(false), _screenChangeCount(0), _dirtyChecksums(0), _cdrom(0), _scalerProc(0), _modeChanged(false), _screenChangeCount(0),
_scrollLock(false), _scrollLock(false),
_mouseVisible(false), _mouseNeedsRedraw(false), _mouseData(0), _mouseSurface(0), _mouseVisible(false), _mouseNeedsRedraw(false), _mouseData(0), _mouseSurface(0),
_mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true), _mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true),
@ -281,7 +279,6 @@ OSystem_SDL::~OSystem_SDL() {
SDL_RemoveTimer(_timerID); SDL_RemoveTimer(_timerID);
closeMixer(); closeMixer();
free(_dirtyChecksums);
free(_mouseData); free(_mouseData);
delete _savefile; delete _savefile;
@ -451,7 +448,6 @@ bool OSystem_SDL::hasFeature(Feature f) {
return return
(f == kFeatureFullscreenMode) || (f == kFeatureFullscreenMode) ||
(f == kFeatureAspectRatioCorrection) || (f == kFeatureAspectRatioCorrection) ||
(f == kFeatureAutoComputeDirtyRects) ||
(f == kFeatureCursorHasPalette) || (f == kFeatureCursorHasPalette) ||
(f == kFeatureIconifyWindow); (f == kFeatureIconifyWindow);
} }
@ -464,12 +460,6 @@ void OSystem_SDL::setFeatureState(Feature f, bool enable) {
case kFeatureAspectRatioCorrection: case kFeatureAspectRatioCorrection:
setAspectRatioCorrection(enable); setAspectRatioCorrection(enable);
break; break;
case kFeatureAutoComputeDirtyRects:
if (enable)
_modeFlags |= DF_WANT_RECT_OPTIM;
else
_modeFlags &= ~DF_WANT_RECT_OPTIM;
break;
case kFeatureIconifyWindow: case kFeatureIconifyWindow:
if (enable) if (enable)
SDL_WM_IconifyWindow(); SDL_WM_IconifyWindow();
@ -487,8 +477,6 @@ bool OSystem_SDL::getFeatureState(Feature f) {
return _videoMode.fullscreen; return _videoMode.fullscreen;
case kFeatureAspectRatioCorrection: case kFeatureAspectRatioCorrection:
return _videoMode.aspectRatioCorrection; return _videoMode.aspectRatioCorrection;
case kFeatureAutoComputeDirtyRects:
return _modeFlags & DF_WANT_RECT_OPTIM;
default: default:
return false; return false;
} }
@ -510,7 +498,6 @@ void OSystem_SDL::deinit() {
SDL_RemoveTimer(_timerID); SDL_RemoveTimer(_timerID);
closeMixer(); closeMixer();
free(_dirtyChecksums);
free(_mouseData); free(_mouseData);
delete _timer; delete _timer;

View file

@ -290,10 +290,6 @@ protected:
int _cdTrack, _cdNumLoops, _cdStartFrame, _cdDuration; int _cdTrack, _cdNumLoops, _cdStartFrame, _cdDuration;
uint32 _cdEndTime, _cdStopTime; uint32 _cdEndTime, _cdStopTime;
enum {
DF_WANT_RECT_OPTIM = 1 << 0
};
enum { enum {
kTransactionNone = 0, kTransactionNone = 0,
kTransactionActive = 1, kTransactionActive = 1,
@ -342,7 +338,6 @@ protected:
Graphics::Surface _framebuffer; Graphics::Surface _framebuffer;
/** Current video mode flags (see DF_* constants) */ /** Current video mode flags (see DF_* constants) */
uint32 _modeFlags;
bool _modeChanged; bool _modeChanged;
int _screenChangeCount; int _screenChangeCount;
@ -354,9 +349,6 @@ protected:
// Dirty rect management // Dirty rect management
SDL_Rect _dirtyRectList[NUM_DIRTY_RECT]; SDL_Rect _dirtyRectList[NUM_DIRTY_RECT];
int _numDirtyRects; int _numDirtyRects;
uint32 *_dirtyChecksums;
bool _cksumValid;
int _cksumNum;
// Keyboard mouse emulation. Disabled by fingolfin 2004-12-18. // Keyboard mouse emulation. Disabled by fingolfin 2004-12-18.
// I am keeping the rest of the code in for now, since the joystick // I am keeping the rest of the code in for now, since the joystick
@ -459,9 +451,6 @@ protected:
Common::TimerManager *_timer; Common::TimerManager *_timer;
protected: protected:
void addDirtyRgnAuto(const byte *buf);
void makeChecksums(const byte *buf);
virtual void addDirtyRect(int x, int y, int w, int h, bool realCoordinates = false); // overloaded by CE backend virtual void addDirtyRect(int x, int y, int w, int h, bool realCoordinates = false); // overloaded by CE backend
virtual void drawMouse(); // overloaded by CE backend virtual void drawMouse(); // overloaded by CE backend

View file

@ -83,7 +83,6 @@ bool OSystem_SDL_Symbian::hasFeature(Feature f) {
switch (f) { switch (f) {
case kFeatureFullscreenMode: case kFeatureFullscreenMode:
case kFeatureAspectRatioCorrection: case kFeatureAspectRatioCorrection:
case kFeatureAutoComputeDirtyRects:
case kFeatureCursorHasPalette: case kFeatureCursorHasPalette:
#ifdef USE_VIBRA_SE_PXXX #ifdef USE_VIBRA_SE_PXXX
case kFeatureVibration: case kFeatureVibration:

View file

@ -926,7 +926,7 @@ const OSystem::GraphicsMode *OSystem_WINCE3::getSupportedGraphicsModes() const {
} }
bool OSystem_WINCE3::hasFeature(Feature f) { bool OSystem_WINCE3::hasFeature(Feature f) {
return (f == kFeatureAutoComputeDirtyRects || f == kFeatureVirtualKeyboard); return (f == kFeatureVirtualKeyboard);
} }
void OSystem_WINCE3::setFeatureState(Feature f, bool enable) { void OSystem_WINCE3::setFeatureState(Feature f, bool enable) {
@ -1151,14 +1151,12 @@ bool OSystem_WINCE3::update_scalers() {
_scaleFactorYm = 1; _scaleFactorYm = 1;
_scaleFactorYd = 1; _scaleFactorYd = 1;
_scalerProc = DownscaleHorizByThreeQuarters; _scalerProc = DownscaleHorizByThreeQuarters;
_modeFlags = 0;
} else { } else {
_scaleFactorXm = 1; _scaleFactorXm = 1;
_scaleFactorXd = 1; _scaleFactorXd = 1;
_scaleFactorYm = 1; _scaleFactorYm = 1;
_scaleFactorYd = 1; _scaleFactorYd = 1;
_scalerProc = Normal1x; _scalerProc = Normal1x;
_modeFlags = 0;
} }
} else if ( _orientationLandscape && (_videoMode.screenWidth == 320 || !_videoMode.screenWidth)) { } else if ( _orientationLandscape && (_videoMode.screenWidth == 320 || !_videoMode.screenWidth)) {
if (!_panelVisible && !_hasSmartphoneResolution && !_overlayVisible && _canBeAspectScaled) { if (!_panelVisible && !_hasSmartphoneResolution && !_overlayVisible && _canBeAspectScaled) {
@ -1167,7 +1165,6 @@ bool OSystem_WINCE3::update_scalers() {
_scaleFactorYm = 6; _scaleFactorYm = 6;
_scaleFactorYd = 5; _scaleFactorYd = 5;
_scalerProc = Normal1xAspect; _scalerProc = Normal1xAspect;
_modeFlags = 0;
_videoMode.aspectRatioCorrection = true; _videoMode.aspectRatioCorrection = true;
} else { } else {
_scaleFactorXm = 1; _scaleFactorXm = 1;
@ -1175,7 +1172,6 @@ bool OSystem_WINCE3::update_scalers() {
_scaleFactorYm = 1; _scaleFactorYm = 1;
_scaleFactorYd = 1; _scaleFactorYd = 1;
_scalerProc = Normal1x; _scalerProc = Normal1x;
_modeFlags = 0;
} }
} else if (_videoMode.screenWidth == 640 && !(isOzone() && (getScreenWidth() >= 640 || getScreenHeight() >= 640))) { } else if (_videoMode.screenWidth == 640 && !(isOzone() && (getScreenWidth() >= 640 || getScreenHeight() >= 640))) {
_scaleFactorXm = 1; _scaleFactorXm = 1;
@ -1183,14 +1179,12 @@ bool OSystem_WINCE3::update_scalers() {
_scaleFactorYm = 1; _scaleFactorYm = 1;
_scaleFactorYd = 2; _scaleFactorYd = 2;
_scalerProc = DownscaleAllByHalf; _scalerProc = DownscaleAllByHalf;
_modeFlags = 0;
} else if (_videoMode.screenWidth == 640 && (isOzone() && (getScreenWidth() >= 640 || getScreenHeight() >= 640))) { } else if (_videoMode.screenWidth == 640 && (isOzone() && (getScreenWidth() >= 640 || getScreenHeight() >= 640))) {
_scaleFactorXm = 1; _scaleFactorXm = 1;
_scaleFactorXd = 1; _scaleFactorXd = 1;
_scaleFactorYm = 1; _scaleFactorYm = 1;
_scaleFactorYd = 1; _scaleFactorYd = 1;
_scalerProc = Normal1x; _scalerProc = Normal1x;
_modeFlags = 0;
} }
return true; return true;
@ -1203,7 +1197,6 @@ bool OSystem_WINCE3::update_scalers() {
_scaleFactorYm = 12; _scaleFactorYm = 12;
_scaleFactorYd = 5; _scaleFactorYd = 5;
_scalerProc = Normal2xAspect; _scalerProc = Normal2xAspect;
_modeFlags = 0;
_videoMode.aspectRatioCorrection = true; _videoMode.aspectRatioCorrection = true;
} else if ( (_panelVisible || _overlayVisible) && _canBeAspectScaled ) { } else if ( (_panelVisible || _overlayVisible) && _canBeAspectScaled ) {
_scaleFactorXm = 2; _scaleFactorXm = 2;
@ -1211,7 +1204,6 @@ bool OSystem_WINCE3::update_scalers() {
_scaleFactorYm = 2; _scaleFactorYm = 2;
_scaleFactorYd = 1; _scaleFactorYd = 1;
_scalerProc = Normal2x; _scalerProc = Normal2x;
_modeFlags = 0;
} }
return true; return true;
} }
@ -1232,7 +1224,6 @@ bool OSystem_WINCE3::update_scalers() {
_scaleFactorYm = 7; _scaleFactorYm = 7;
_scaleFactorYd = 8; _scaleFactorYd = 8;
_scalerProc = SmartphoneLandscape; _scalerProc = SmartphoneLandscape;
_modeFlags = 0;
initZones(); initZones();
return true; return true;
} }
@ -1824,7 +1815,6 @@ void OSystem_WINCE3::copyRectToOverlay(const OverlayColor *buf, int pitch, int x
return; return;
// Mark the modified region as dirty // Mark the modified region as dirty
_cksumValid = false;
addDirtyRect(x, y, w, h); addDirtyRect(x, y, w, h);
undrawMouse(); undrawMouse();
@ -1851,41 +1841,32 @@ void OSystem_WINCE3::copyRectToScreen(const byte *src, int pitch, int x, int y,
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
if (((long)src & 3) == 0 && pitch == _videoMode.screenWidth && x == 0 && y == 0 && /* Clip the coordinates */
w == _videoMode.screenWidth && h == _videoMode.screenHeight && _modeFlags & DF_WANT_RECT_OPTIM) { if (x < 0) {
/* Special, optimized case for full screen updates. w += x;
* It tries to determine what areas were actually changed, src -= x;
* and just updates those, on the actual display. */ x = 0;
addDirtyRgnAuto(src);
} else {
/* Clip the coordinates */
if (x < 0) {
w += x;
src -= x;
x = 0;
}
if (y < 0) {
h += y;
src -= y * pitch;
y = 0;
}
if (w > _videoMode.screenWidth - x) {
w = _videoMode.screenWidth - x;
}
if (h > _videoMode.screenHeight - y) {
h = _videoMode.screenHeight - y;
}
if (w <= 0 || h <= 0)
return;
_cksumValid = false;
addDirtyRect(x, y, w, h);
} }
if (y < 0) {
h += y;
src -= y * pitch;
y = 0;
}
if (w > _videoMode.screenWidth - x) {
w = _videoMode.screenWidth - x;
}
if (h > _videoMode.screenHeight - y) {
h = _videoMode.screenHeight - y;
}
if (w <= 0 || h <= 0)
return;
addDirtyRect(x, y, w, h);
undrawMouse(); undrawMouse();
// Try to lock the screen surface // Try to lock the screen surface

View file

@ -150,18 +150,6 @@ public:
*/ */
kFeatureVirtualKeyboard, kFeatureVirtualKeyboard,
/**
* This flag is a bit more obscure: it gives a hint to the backend that
* the frontend code is very inefficient in doing screen updates. So
* the frontend might do a lot of fullscreen blits even though only a
* tiny portion of the actual screen data changed. In that case, it
* might pay off for the backend to compute which parts actually changed,
* and then only mark those as dirty.
* Implementing this is purely optional, and no harm should arise
* when not doing so (except for decreased speed in said frontends).
*/
kFeatureAutoComputeDirtyRects,
/** /**
* This flag determines whether or not the cursor can have its own palette. * This flag determines whether or not the cursor can have its own palette.
* It is currently used only by some Macintosh versions of Humongous * It is currently used only by some Macintosh versions of Humongous

View file

@ -330,20 +330,6 @@ Common::Error SagaEngine::run() {
syncSoundSettings(); syncSoundSettings();
#if 0
// FIXME: Disabled this code for now. We want to get rid of OSystem::kFeatureAutoComputeDirtyRects
// and this is the last place to make use of it. We need to find out whether doing
// so causes any regressions. If it does, we can reenable it, if not, we can remove
// this code in 0.13.0.
// FIXME: This is the ugly way of reducing redraw overhead. It works
// well for 320x200 but it's unclear how well it will work for
// 640x480.
if (getGameId() == GID_ITE)
_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true);
#endif
int msec = 0; int msec = 0;
_previousTicks = _system->getMillis(); _previousTicks = _system->getMillis();