HOPKINS: Preparatory work for a refresh rect list

This commit is contained in:
Paul Gilbert 2013-03-02 18:56:14 -05:00
parent d738802bc1
commit 7c862d586e
3 changed files with 53 additions and 10 deletions

View File

@ -222,7 +222,7 @@ void EventsManager::checkForNextFrameCounter() {
if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) {
++_gameCounter;
_priorFrameTime = milli;
g_system->updateScreen();
_vm->_graphicsManager.DD_VBL();
// Signal the ScummVM debugger
_vm->_debugger.onFrame();
@ -465,7 +465,9 @@ void EventsManager::VBL() {
_vm->_graphicsManager.lockScreen();
_vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._scrollPosX, 20, SCREEN_WIDTH, 440, 0, 20);
_vm->_graphicsManager.unlockScreen();
_vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, 460);
_vm->_graphicsManager.resetRefreshRects();
_vm->_graphicsManager.addRefreshRect(Common::Rect(0, 20, SCREEN_WIDTH, 460));
_vm->_graphicsManager.resetVesaSegment();

View File

@ -612,7 +612,7 @@ void GraphicsManager::fadeOut(const byte *palette, int step, const byte *surface
setPaletteVGA256(palData);
m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
return DD_VBL();
DD_VBL();
}
/**
@ -735,7 +735,10 @@ uint16 GraphicsManager::mapRGB(byte r, byte g, byte b) {
}
void GraphicsManager::DD_VBL() {
// TODO: Is this okay here?
// Display any aras of the screen that need refreshing
displayRefreshRects();
// Update the screen
g_system->updateScreen();
}
@ -1093,7 +1096,11 @@ void GraphicsManager::resetVesaSegment() {
_dirtyRects.clear();
}
// Add VESA Segment
void GraphicsManager::resetRefreshRects() {
_refreshRects.clear();
}
// Add a game area dirty rectangle
void GraphicsManager::addDirtyRect(int x1, int y1, int x2, int y2) {
x1 = CLIP(x1, _minX, _maxX);
y1 = CLIP(y1, _minY, _maxY);
@ -1115,7 +1122,19 @@ void GraphicsManager::addDirtyRect(int x1, int y1, int x2, int y2) {
_dirtyRects.push_back(newRect);
}
// Display VESA Segment
// Add a refresh rect
void GraphicsManager::addRefreshRect(const Common::Rect &r) {
// Ensure that an existing dest rectangle doesn't already contain the new one
for (uint idx = 0; idx < _refreshRects.size(); ++idx) {
if (_refreshRects[idx].contains(r))
return;
}
assert(_refreshRects.size() < DIRTY_RECTS_SIZE);
_refreshRects.push_back(r);
}
// Draw any game dirty rects onto the screen intermediate surface
void GraphicsManager::displayVesaSegment() {
if (_dirtyRects.size() == 0)
return;
@ -1124,7 +1143,7 @@ void GraphicsManager::displayVesaSegment() {
for (uint idx = 0; idx < _dirtyRects.size(); ++idx) {
Common::Rect &r = _dirtyRects[idx];
Common::Rect &dstRect = dstrect[idx];
Common::Rect dstRect;
if (_vm->_eventsManager._breakoutFl) {
Copy_Vga16(_vesaBuffer, r.left, r.top, r.right - r.left, r.bottom - r.top, r.left, r.top);
@ -1159,6 +1178,19 @@ void GraphicsManager::displayVesaSegment() {
resetVesaSegment();
}
void GraphicsManager::displayRefreshRects() {
if (_refreshRects.size() == 0)
return;
/*
for (uint idx = 0; idx < _refreshRects.size(); ++idx) {
const Common::Rect &r = _refreshRects[idx];
g_system->copyRectToScreen(_screenBuffer, WinScan,)
}
*/
resetRefreshRects();
}
void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx, bool addSegment) {
int width = _vm->_objectsManager.getWidth(objectData, idx);
int height = _vm->_objectsManager.getHeight(objectData, idx);

View File

@ -99,12 +99,18 @@ public:
int _minX, _minY;
int _maxX, _maxY;
bool _noFadingFl;
Common::Rect dstrect[50];
int _scrollStatus;
bool _skipVideoLockFl;
int _fadeDefaultSpeed;
/**
* The _dirtyRects list contains paletted game areas that need to be redrawn.
* The _dstrect array is the list of areas of the screen that ScummVM needs to be redrawn.
* Some areas, such as the animation managers, skip the _dirtyRects and use _dstrec directly.
*/
Common::Array<Common::Rect> _dirtyRects;
Common::Array<Common::Rect> _refreshRects;
int WinScan;
byte *PAL_PIXELS;
bool MANU_SCROLL;
@ -118,7 +124,12 @@ public:
void unlockScreen();
void clearPalette();
void clearScreen();
void resetVesaSegment();
void resetRefreshRects();
void addDirtyRect(int x1, int y1, int x2, int y2);
void addRefreshRect(const Common::Rect &r);
void displayVesaSegment();
void displayRefreshRects();
void copySurface(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY);
void loadImage(const Common::String &file);
void loadVgaImage(const Common::String &file);
@ -131,8 +142,6 @@ public:
void fadeOutLong();
void fadeOutShort();
void fastDisplay(const byte *spriteData, int xp, int yp, int spriteIndex, bool addSegment = true);
void displayVesaSegment();
void resetVesaSegment();
void copyWinscanVbe3(const byte *srcData, byte *destSurface);
void copyWinscanVbe(const byte *srcP, byte *destP);
void copyVideoVbe16(const byte *srcData);