mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-20 19:21:46 +00:00
3DS: Defer texture updates when the palette changes
Fixes a performance issue with the Gob engine where the palette is updated a large number of times during a single frame.
This commit is contained in:
parent
ac87c01895
commit
e1358b966a
@ -329,12 +329,9 @@ float OSystem_3DS::getScaleRatio() const {
|
||||
void OSystem_3DS::setPalette(const byte *colors, uint start, uint num) {
|
||||
assert(start + num <= 256);
|
||||
memcpy(_palette + 3 * start, colors, 3 * num);
|
||||
|
||||
// Manually update all color that were changed
|
||||
if (_gameScreen.format.bytesPerPixel == 1) {
|
||||
flushGameScreen();
|
||||
}
|
||||
_gameTextureDirty = true;
|
||||
}
|
||||
|
||||
void OSystem_3DS::grabPalette(byte *colors, uint start, uint num) const {
|
||||
assert(start + num <= 256);
|
||||
memcpy(colors, _palette + 3 * start, 3 * num);
|
||||
@ -391,7 +388,7 @@ Graphics::Surface *OSystem_3DS::lockScreen() {
|
||||
return &_gameScreen;
|
||||
}
|
||||
void OSystem_3DS::unlockScreen() {
|
||||
flushGameScreen();
|
||||
_gameTextureDirty = true;
|
||||
}
|
||||
|
||||
void OSystem_3DS::updateScreen() {
|
||||
@ -399,6 +396,11 @@ void OSystem_3DS::updateScreen() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_gameTextureDirty) {
|
||||
flushGameScreen();
|
||||
_gameTextureDirty = false;
|
||||
}
|
||||
|
||||
// updateFocus();
|
||||
updateMagnify();
|
||||
|
||||
|
@ -78,6 +78,7 @@ OSystem_3DS::OSystem_3DS():
|
||||
_magY(0),
|
||||
_magWidth(400),
|
||||
_magHeight(240),
|
||||
_gameTextureDirty(false),
|
||||
_overlayVisible(false),
|
||||
_screenChangeId(0),
|
||||
_magnifyMode(MODE_MAGOFF),
|
||||
|
@ -222,6 +222,7 @@ private:
|
||||
byte _cursorPalette[3 * 256];
|
||||
|
||||
Graphics::Surface _gameScreen;
|
||||
bool _gameTextureDirty;
|
||||
Sprite _gameTopTexture;
|
||||
Sprite _gameBottomTexture;
|
||||
Sprite _overlay;
|
||||
|
Loading…
x
Reference in New Issue
Block a user