aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/palette32.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/graphics/palette32.h')
-rw-r--r--engines/sci/graphics/palette32.h27
1 files changed, 27 insertions, 0 deletions
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<const byte> &rawPalette);
+ static void write(SciSpan<byte> &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.
*/