From 7057f232d75732c320fb470a8632a4c2f055a47f Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Mon, 3 Jul 2017 20:12:39 -0500 Subject: SCI32: Improve kPlayVMD rendering 1. Added a new game option for linear interpolation when scaling overlay-mode video in ScummVM builds with USE_RGB_COLOR; 2. Implemented SCI2.1-variant of the VMD player renderer (fixes Trac#9857), which bypasses the engine's normal rendering pipeline; 3. Improved accuracy of the SCI3-variant of the VMD player by writing HunkPalettes into the VMD's CelObjMem instead of submitting palettes directly to GfxPalette32. --- engines/sci/graphics/palette32.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'engines/sci/graphics/palette32.h') diff --git a/engines/sci/graphics/palette32.h b/engines/sci/graphics/palette32.h index fb0b226130..b8ba85eb4a 100644 --- a/engines/sci/graphics/palette32.h +++ b/engines/sci/graphics/palette32.h @@ -37,6 +37,16 @@ class HunkPalette { public: HunkPalette(const SciSpan &rawPalette); + static void write(SciSpan &out, const Palette &palette); + + static uint32 calculateHunkPaletteSize(const uint16 numIndexes = 256, const bool sharedUsed = true) { + const int numPalettes = 1; + return kHunkPaletteHeaderSize + + /* slack bytes between hunk header & palette offset table */ 2 + + /* palette offset table */ 2 * numPalettes + + /* palette data */ (kEntryHeaderSize + numIndexes * (/* RGB */ 3 + !sharedUsed)) * numPalettes; + } + /** * Gets the version of the palette. Used to avoid resubmitting a HunkPalette * which has already been submitted for the next frame. @@ -237,6 +247,14 @@ public: */ inline const Palette &getCurrentPalette() const { return _currentPalette; }; +#ifdef USE_RGB_COLOR + /** + * Gets the raw hardware palette in RGB format. This should be used instead + * of `::PaletteManager::grabPalette` when the OSystem screen is >8bpp. + */ + inline const uint8 *getHardwarePalette() const { return _hardwarePalette; }; +#endif + /** * Loads a palette into GfxPalette32 with the given resource ID. */ @@ -288,6 +306,15 @@ private: */ bool _needsUpdate; +#ifdef USE_RGB_COLOR + /** + * A local copy of the hardware palette. Used when the backend is in a true + * color mode and a change to the game's internal framebuffer occurs that + * needs to be reconverted from 8bpp to the backend's bit depth. + */ + uint8 _hardwarePalette[256 * 3]; +#endif + /** * The currently displayed palette. */ -- cgit v1.2.3