aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2009-08-11 16:46:38 +0000
committerJohannes Schickel2009-08-11 16:46:38 +0000
commit1a59173a9b2e930ab7fbe6a1f0f79265dfa4d247 (patch)
tree343a21f51f51df5df669437c72193dd5698c6e4e /engines
parentc1511d3b44f02a234b8d47969714d970a9a4a31c (diff)
downloadscummvm-rg350-1a59173a9b2e930ab7fbe6a1f0f79265dfa4d247.tar.gz
scummvm-rg350-1a59173a9b2e930ab7fbe6a1f0f79265dfa4d247.tar.bz2
scummvm-rg350-1a59173a9b2e930ab7fbe6a1f0f79265dfa4d247.zip
Enable dirty rect handling for the Amiga version again.
svn-id: r43280
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/screen.cpp88
-rw-r--r--engines/kyra/screen.h1
2 files changed, 74 insertions, 15 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index c58b807695..8d4ea7e022 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -206,6 +206,8 @@ void Screen::setResolution() {
void Screen::updateScreen() {
if (_useOverlays)
updateDirtyRectsOvl();
+ else if (_isAmiga && _interfacePaletteEnabled)
+ updateDirtyRectsAmiga();
else
updateDirtyRects();
@@ -220,30 +222,86 @@ void Screen::updateScreen() {
}
void Screen::updateDirtyRects() {
- // TODO: Enable dirty rect handling for the AMIGA version
- if (_forceFullUpdate || _isAmiga) {
- if (_interfacePaletteEnabled) {
- _system->copyRectToScreen(getCPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, 136);
+ if (_forceFullUpdate) {
+ _system->copyRectToScreen(getCPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, SCREEN_H);
+ } else {
+ const byte *page0 = getCPagePtr(0);
+ Common::List<Common::Rect>::iterator it;
+ for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
+ _system->copyRectToScreen(page0 + it->top * SCREEN_W + it->left, SCREEN_W, it->left, it->top, it->width(), it->height());
+ }
+ }
+ _forceFullUpdate = false;
+ _dirtyRects.clear();
+}
- // Page 8 is not used by Kyra 1 AMIGA, thus we can use it to adjust the colors
- copyRegion(0, 136, 0, 0, 320, 64, 0, 8, CR_NO_P_CHECK);
+void Screen::updateDirtyRectsAmiga() {
+ if (_forceFullUpdate) {
+ _system->copyRectToScreen(getCPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, 136);
- uint8 *dst = getPagePtr(8);
- for (int y = 0; y < 64; ++y)
- for (int x = 0; x < 320; ++x)
- *dst++ += 32;
+ // Page 8 is not used by Kyra 1 AMIGA, thus we can use it to adjust the colors
+ copyRegion(0, 136, 0, 0, 320, 64, 0, 8, CR_NO_P_CHECK);
- _system->copyRectToScreen(getCPagePtr(8), SCREEN_W, 0, 136, SCREEN_W, 64);
- } else {
- _system->copyRectToScreen(getCPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, SCREEN_H);
- }
+ uint8 *dst = getPagePtr(8);
+ for (int y = 0; y < 64; ++y)
+ for (int x = 0; x < 320; ++x)
+ *dst++ += 32;
+
+ _system->copyRectToScreen(getCPagePtr(8), SCREEN_W, 0, 136, SCREEN_W, 64);
} else {
const byte *page0 = getCPagePtr(0);
Common::List<Common::Rect>::iterator it;
+
for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
- _system->copyRectToScreen(page0 + it->top * SCREEN_W + it->left, SCREEN_W, it->left, it->top, it->width(), it->height());
+ if (it->bottom <= 136) {
+ _system->copyRectToScreen(page0 + it->top * SCREEN_W + it->left, SCREEN_W, it->left, it->top, it->width(), it->height());
+ } else {
+ // Check whether the rectangle is part of both the screen and the interface
+ if (it->top < 136) {
+ // The rectangle covers both screen part and interface part
+
+ const int screenHeight = 136 - it->top;
+ const int interfaceHeight = it->bottom - 136;
+
+ const int width = it->width();
+ const int lineAdd = SCREEN_W - width;
+
+ // Copy the screen part verbatim
+ _system->copyRectToScreen(page0 + it->top * SCREEN_W + it->left, SCREEN_W, it->left, it->top, width, screenHeight);
+
+ // Adjust the interface part
+ copyRegion(it->left, 136, 0, 0, width, interfaceHeight, 0, 8, Screen::CR_NO_P_CHECK);
+
+ uint8 *dst = getPagePtr(8);
+ for (int y = 0; y < interfaceHeight; ++y) {
+ for (int x = 0; x < width; ++x)
+ *dst++ += 32;
+ dst += lineAdd;
+ }
+
+ _system->copyRectToScreen(getCPagePtr(8), SCREEN_W, it->left, 136, width, interfaceHeight);
+ } else {
+ // The rectangle only covers the interface part
+
+ const int width = it->width();
+ const int height = it->height();
+ const int lineAdd = SCREEN_W - width;
+
+ copyRegion(it->left, it->top, 0, 0, width, height, 0, 8, Screen::CR_NO_P_CHECK);
+
+ uint8 *dst = getPagePtr(8);
+ for (int y = 0; y < height; ++y) {
+ for (int x = 0; x < width; ++x)
+ *dst++ += 32;
+ dst += lineAdd;
+ }
+
+ _system->copyRectToScreen(getCPagePtr(8), SCREEN_W, it->left, it->top, width, height);
+ }
+ }
}
}
+
_forceFullUpdate = false;
_dirtyRects.clear();
}
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index 7da3cbb23c..73a29ee2c7 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -452,6 +452,7 @@ public:
protected:
uint8 *getPagePtr(int pageNum);
void updateDirtyRects();
+ void updateDirtyRectsAmiga();
void updateDirtyRectsOvl();
void scale2x(byte *dst, int dstPitch, const byte *src, int srcPitch, int w, int h);