SAGA2: Use OSystem::copyRectToScreen() and fillScreen() where possible

This commit is contained in:
Cameron Cawley 2023-12-29 17:54:33 +00:00 committed by Filippos Karapetis
parent eb265d8d34
commit 3c80ba8d95
2 changed files with 6 additions and 11 deletions

View File

@ -65,12 +65,9 @@ void Renderer::popSavedBackBuffer(BackBufferSource source) {
void Renderer::restoreSavedBackBuffer(BackBufferSource source) {
if (source >= 0 && source < kMaxBackBufferSources) {
if (_savedBackBuffers[source]) {
Graphics::Surface *surf = g_system->lockScreen();
int size = surf->w * surf->h;
memcpy(surf->getBasePtr(0, 0), _savedBackBuffers[source], size);
g_system->unlockScreen();
uint w = g_system->getWidth();
uint h = g_system->getHeight();
g_system->copyRectToScreen(_savedBackBuffers[source], w, 0, 0, w, h);
}
}
}

View File

@ -23,6 +23,7 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
#include "common/rect.h"
#include "graphics/surface.h"
#include "saga2/saga2.h"
@ -395,11 +396,8 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
}
void vDisplayPage::fillRect(Rect16 r, uint8 color) {
Graphics::Surface *surf = g_system->lockScreen();
_FillRect((byte *)surf->getBasePtr(r.x, r.y), surf->pitch, r.width, r.height, color);
g_system->unlockScreen();
Common::Rect rect(r.x, r.y, r.x + r.width, r.y + r.height);
g_system->fillScreen(rect, color);
}
void vDisplayPage::invertRect(Rect16 r, uint8 color) {