mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-21 19:51:49 +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) {
|
void OSystem_3DS::setPalette(const byte *colors, uint start, uint num) {
|
||||||
assert(start + num <= 256);
|
assert(start + num <= 256);
|
||||||
memcpy(_palette + 3 * start, colors, 3 * num);
|
memcpy(_palette + 3 * start, colors, 3 * num);
|
||||||
|
_gameTextureDirty = true;
|
||||||
// Manually update all color that were changed
|
|
||||||
if (_gameScreen.format.bytesPerPixel == 1) {
|
|
||||||
flushGameScreen();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_3DS::grabPalette(byte *colors, uint start, uint num) const {
|
void OSystem_3DS::grabPalette(byte *colors, uint start, uint num) const {
|
||||||
assert(start + num <= 256);
|
assert(start + num <= 256);
|
||||||
memcpy(colors, _palette + 3 * start, 3 * num);
|
memcpy(colors, _palette + 3 * start, 3 * num);
|
||||||
@ -391,7 +388,7 @@ Graphics::Surface *OSystem_3DS::lockScreen() {
|
|||||||
return &_gameScreen;
|
return &_gameScreen;
|
||||||
}
|
}
|
||||||
void OSystem_3DS::unlockScreen() {
|
void OSystem_3DS::unlockScreen() {
|
||||||
flushGameScreen();
|
_gameTextureDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_3DS::updateScreen() {
|
void OSystem_3DS::updateScreen() {
|
||||||
@ -399,6 +396,11 @@ void OSystem_3DS::updateScreen() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_gameTextureDirty) {
|
||||||
|
flushGameScreen();
|
||||||
|
_gameTextureDirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
// updateFocus();
|
// updateFocus();
|
||||||
updateMagnify();
|
updateMagnify();
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ OSystem_3DS::OSystem_3DS():
|
|||||||
_magY(0),
|
_magY(0),
|
||||||
_magWidth(400),
|
_magWidth(400),
|
||||||
_magHeight(240),
|
_magHeight(240),
|
||||||
|
_gameTextureDirty(false),
|
||||||
_overlayVisible(false),
|
_overlayVisible(false),
|
||||||
_screenChangeId(0),
|
_screenChangeId(0),
|
||||||
_magnifyMode(MODE_MAGOFF),
|
_magnifyMode(MODE_MAGOFF),
|
||||||
|
@ -222,6 +222,7 @@ private:
|
|||||||
byte _cursorPalette[3 * 256];
|
byte _cursorPalette[3 * 256];
|
||||||
|
|
||||||
Graphics::Surface _gameScreen;
|
Graphics::Surface _gameScreen;
|
||||||
|
bool _gameTextureDirty;
|
||||||
Sprite _gameTopTexture;
|
Sprite _gameTopTexture;
|
||||||
Sprite _gameBottomTexture;
|
Sprite _gameBottomTexture;
|
||||||
Sprite _overlay;
|
Sprite _overlay;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user