mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 14:51:40 +00:00
TSAGE: Do all screen drawing in an intermediate temporary screen surface.
This will be the first half of properly handling on screen dirty rects.
This commit is contained in:
parent
a837bb409a
commit
83acabfdbd
@ -163,7 +163,7 @@ void RightClickDialog::execute() {
|
||||
}
|
||||
|
||||
g_system->delayMillis(10);
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
}
|
||||
|
||||
// Deactivate the graphics manager used for the dialog
|
||||
@ -244,7 +244,7 @@ void AmmoBeltDialog::execute() {
|
||||
}
|
||||
|
||||
g_system->delayMillis(10);
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
}
|
||||
|
||||
_gfxManager.deactivate();
|
||||
|
@ -451,7 +451,7 @@ int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) {
|
||||
while (!g_globals->_events.getEvent(event, EVENT_KEYPRESS | EVENT_BUTTON_DOWN | EVENT_MOUSE_MOVE) &&
|
||||
!g_vm->shouldQuit()) {
|
||||
g_system->delayMillis(10);
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
}
|
||||
if (g_vm->shouldQuit())
|
||||
break;
|
||||
|
@ -1416,7 +1416,7 @@ void ScenePalette::fade(const byte *adjustData, bool fullAdjust, int percent) {
|
||||
|
||||
// Set the altered pale4tte
|
||||
g_system->getPaletteManager()->setPalette((const byte *)&tempPalette[0], 0, 256);
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
}
|
||||
|
||||
PaletteRotation *ScenePalette::addRotation(int start, int end, int rotationMode, int duration, Action *action) {
|
||||
@ -1714,7 +1714,7 @@ void SceneItem::display(int resNum, int lineNum, ...) {
|
||||
// Keep event on-screen until a mouse or keypress
|
||||
while (!g_vm->shouldQuit() && !g_globals->_events.getEvent(event,
|
||||
EVENT_BUTTON_DOWN | EVENT_KEYPRESS)) {
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
g_system->delayMillis(10);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ bool EventsClass::pollEvent() {
|
||||
++_frameNumber;
|
||||
|
||||
// Update screen
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
}
|
||||
|
||||
if (!g_system->getEventManager()->pollEvent(_event)) return false;
|
||||
@ -395,7 +395,7 @@ void EventsClass::delay(int numFrames) {
|
||||
_priorFrameTime = g_system->getMillis();
|
||||
}
|
||||
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
_prevDelayFrame = _frameNumber;
|
||||
_priorFrameTime = g_system->getMillis();
|
||||
}
|
||||
|
@ -220,10 +220,8 @@ void Rect::synchronize(Serializer &s) {
|
||||
|
||||
GfxSurface::GfxSurface() : _bounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) {
|
||||
_disableUpdates = false;
|
||||
_screenSurface = false;
|
||||
_lockSurfaceCtr = 0;
|
||||
_customSurface = NULL;
|
||||
_screenSurfaceP = NULL;
|
||||
_transColor = -1;
|
||||
}
|
||||
|
||||
@ -244,9 +242,17 @@ GfxSurface::~GfxSurface() {
|
||||
* Specifies that the surface will encapsulate the ScummVM screen surface
|
||||
*/
|
||||
void GfxSurface::setScreenSurface() {
|
||||
_screenSurface = true;
|
||||
_customSurface = NULL;
|
||||
_lockSurfaceCtr = 0;
|
||||
_trackDirtyRects = true;
|
||||
create(SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the physical screen with the screen surface buffer
|
||||
*/
|
||||
void GfxSurface::updateScreen() {
|
||||
g_system->copyRectToScreen((const byte *)this->_customSurface->pixels,
|
||||
SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
g_system->updateScreen();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -254,7 +260,7 @@ void GfxSurface::setScreenSurface() {
|
||||
*/
|
||||
void GfxSurface::create(int width, int height) {
|
||||
assert((width >= 0) && (height >= 0));
|
||||
_screenSurface = false;
|
||||
|
||||
if (_customSurface) {
|
||||
_customSurface->free();
|
||||
delete _customSurface;
|
||||
@ -271,13 +277,7 @@ void GfxSurface::create(int width, int height) {
|
||||
Graphics::Surface GfxSurface::lockSurface() {
|
||||
++_lockSurfaceCtr;
|
||||
|
||||
Graphics::Surface *src;
|
||||
if (_screenSurface) {
|
||||
if (_lockSurfaceCtr == 1)
|
||||
_screenSurfaceP = g_system->lockScreen();
|
||||
src = _screenSurfaceP;
|
||||
} else
|
||||
src = _customSurface;
|
||||
Graphics::Surface *src = _customSurface;
|
||||
assert(src);
|
||||
|
||||
// Setup the returned surface either as one pointing to the same pixels as the source, or
|
||||
@ -298,15 +298,10 @@ Graphics::Surface GfxSurface::lockSurface() {
|
||||
void GfxSurface::unlockSurface() {
|
||||
assert(_lockSurfaceCtr > 0);
|
||||
--_lockSurfaceCtr;
|
||||
|
||||
if ((_lockSurfaceCtr == 0) && _screenSurface) {
|
||||
g_system->unlockScreen();
|
||||
}
|
||||
}
|
||||
|
||||
void GfxSurface::synchronize(Serializer &s) {
|
||||
assert(!_lockSurfaceCtr);
|
||||
assert(!_screenSurface);
|
||||
|
||||
s.syncAsByte(_disableUpdates);
|
||||
_bounds.synchronize(s);
|
||||
@ -363,7 +358,6 @@ GfxSurface &GfxSurface::operator=(const GfxSurface &s) {
|
||||
}
|
||||
|
||||
_customSurface = s._customSurface;
|
||||
_screenSurface = s._screenSurface;
|
||||
_disableUpdates = s._disableUpdates;
|
||||
_bounds = s._bounds;
|
||||
_centroid = s._centroid;
|
||||
@ -1090,7 +1084,7 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) {
|
||||
}
|
||||
|
||||
g_system->delayMillis(10);
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
}
|
||||
|
||||
_gfxManager.deactivate();
|
||||
|
@ -74,9 +74,8 @@ public:
|
||||
class GfxSurface {
|
||||
private:
|
||||
Graphics::Surface *_customSurface;
|
||||
Graphics::Surface *_screenSurfaceP;
|
||||
int _lockSurfaceCtr;
|
||||
bool _screenSurface;
|
||||
bool _trackDirtyRects;
|
||||
|
||||
bool _disableUpdates;
|
||||
Rect _bounds;
|
||||
@ -89,6 +88,7 @@ public:
|
||||
~GfxSurface();
|
||||
|
||||
void setScreenSurface();
|
||||
void updateScreen();
|
||||
Graphics::Surface lockSurface();
|
||||
void unlockSurface();
|
||||
void synchronize(Serializer &s);
|
||||
@ -301,7 +301,6 @@ public:
|
||||
void copyFrom(GfxSurface &src, int destX, int destY) {
|
||||
_surface.setBounds(_bounds);
|
||||
_surface.copyFrom(src, destX, destY);
|
||||
g_system->updateScreen();
|
||||
}
|
||||
GfxSurface &getSurface() {
|
||||
_surface.setBounds(_bounds);
|
||||
|
@ -183,7 +183,7 @@ void RightClickDialog::execute() {
|
||||
}
|
||||
|
||||
g_system->delayMillis(10);
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
}
|
||||
|
||||
_gfxManager.deactivate();
|
||||
@ -394,7 +394,7 @@ void InventoryDialog::execute() {
|
||||
Event event;
|
||||
while (!g_globals->_events.getEvent(event) && !g_vm->shouldQuit()) {
|
||||
g_system->delayMillis(10);
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
}
|
||||
if (g_vm->shouldQuit())
|
||||
break;
|
||||
|
@ -315,7 +315,7 @@ void SceneArea::wait() {
|
||||
// Wait until a mouse or keypress
|
||||
Event event;
|
||||
while (!g_vm->shouldQuit() && !g_globals->_events.getEvent(event)) {
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
g_system->delayMillis(10);
|
||||
}
|
||||
|
||||
|
@ -532,7 +532,7 @@ void Scene2100::Action1::signal() {
|
||||
// Wait for an event
|
||||
Event event;
|
||||
if (!g_globals->_events.getEvent(event)) {
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
g_system->delayMillis(10);
|
||||
continue;
|
||||
}
|
||||
@ -2263,7 +2263,7 @@ void Scene2150::Action1::signal() {
|
||||
// Wait for an event
|
||||
Event event;
|
||||
if (!g_globals->_events.getEvent(event)) {
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
g_system->delayMillis(10);
|
||||
continue;
|
||||
}
|
||||
@ -5118,7 +5118,7 @@ void Scene2320::Action3::signal() {
|
||||
// Wait for an event
|
||||
Event event;
|
||||
if (!g_globals->_events.getEvent(event)) {
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
g_system->delayMillis(10);
|
||||
continue;
|
||||
}
|
||||
|
@ -2810,7 +2810,7 @@ void Scene4150::Action1::signal() {
|
||||
case 4: {
|
||||
for (int idx = 100; idx >= 0; idx -= 5) {
|
||||
g_globals->_scenePalette.fade(adjustData, false, idx);
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
g_system->delayMillis(10);
|
||||
}
|
||||
|
||||
@ -2838,7 +2838,7 @@ void Scene4150::Action1::signal() {
|
||||
case 7:
|
||||
for (int idx = 100; idx >= 0; idx -= 5) {
|
||||
g_globals->_scenePalette.fade(adjustData, false, idx);
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
g_system->delayMillis(10);
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ void RightClickDialog::execute() {
|
||||
}
|
||||
|
||||
g_system->delayMillis(10);
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
}
|
||||
|
||||
// Execute the specified action
|
||||
|
@ -133,7 +133,7 @@ void SceneManager::fadeInIfNecessary() {
|
||||
percent = 100;
|
||||
|
||||
g_globals->_scenePalette.fade((const byte *)&adjustData, false, percent);
|
||||
g_system->updateScreen();
|
||||
GLOBALS._screenSurface.updateScreen();
|
||||
g_system->delayMillis(10);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user