mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-07 19:36:21 +00:00
MTROPOLIS: add fallback palette to MovieElement blitting (#5811)
* MTROPOLIS: add fallback palette to MovieElement blitting Without a palette, there would be assertions and nullptr segfaults in Graphics::ManagedSurface::blitFromInner. Observed in MindGym and The Day The World Broke The palette content is not correct yet. Mind Gym renders the video with the wrong colors. * MTROPOLIS: use global palette as fallback for MovieElement
This commit is contained in:
parent
209adeda68
commit
6777f200f9
@ -781,7 +781,9 @@ void MovieElement::render(Window *window) {
|
||||
Graphics::ManagedSurface *target = window->getSurface().get();
|
||||
Common::Rect srcRect(0, 0, displaySurface->w, displaySurface->h);
|
||||
Common::Rect destRect(_cachedAbsoluteOrigin.x, _cachedAbsoluteOrigin.y, _cachedAbsoluteOrigin.x + _rect.width(), _cachedAbsoluteOrigin.y + _rect.height());
|
||||
target->blitFrom(*displaySurface, srcRect, destRect);
|
||||
|
||||
initFallbackPalette();
|
||||
target->blitFrom(*displaySurface, srcRect, destRect, _fallbackPalette.get());
|
||||
}
|
||||
}
|
||||
|
||||
@ -963,6 +965,13 @@ void MovieElement::stopSubtitles() {
|
||||
_subtitles->stop();
|
||||
}
|
||||
|
||||
void MovieElement::initFallbackPalette() {
|
||||
if (!_fallbackPalette) {
|
||||
const Palette &globalPalette = getRuntime()->getGlobalPalette();
|
||||
_fallbackPalette = Common::ScopedPtr<Graphics::Palette>(new Graphics::Palette(globalPalette.getPalette(), globalPalette.kNumColors));
|
||||
}
|
||||
}
|
||||
|
||||
void MovieElement::onPauseStateChanged() {
|
||||
VisualElement::onPauseStateChanged();
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define MTROPOLIS_ELEMENTS_H
|
||||
|
||||
#include "graphics/fontman.h"
|
||||
#include "graphics/palette.h"
|
||||
|
||||
#include "mtropolis/data.h"
|
||||
#include "mtropolis/runtime.h"
|
||||
@ -120,6 +121,8 @@ private:
|
||||
|
||||
void stopSubtitles();
|
||||
|
||||
void initFallbackPalette();
|
||||
|
||||
MiniscriptInstructionOutcome scriptSetRange(MiniscriptThread *thread, const DynamicValue &value);
|
||||
MiniscriptInstructionOutcome scriptSetRangeStart(MiniscriptThread *thread, const DynamicValue &value);
|
||||
MiniscriptInstructionOutcome scriptSetRangeEnd(MiniscriptThread *thread, const DynamicValue &value);
|
||||
@ -173,6 +176,8 @@ private:
|
||||
Common::SharedPtr<SubtitlePlayer> _subtitles;
|
||||
|
||||
Common::Array<int> _damagedFrames;
|
||||
|
||||
Common::ScopedPtr<Graphics::Palette> _fallbackPalette;
|
||||
};
|
||||
|
||||
class ImageElement : public VisualElement {
|
||||
|
Loading…
x
Reference in New Issue
Block a user