[Scummvm-git-logs] scummvm master -> ea0af08ccf62167daa9b095c4d24dc3813c058fd

bluegr noreply at scummvm.org
Fri Apr 17 07:54:58 UTC 2026


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
1ad1a49912 SCI: Simplify pixel format selection for SCI 0-1 QuickTime videos
d31c81feeb SCI: Extend pixel format support in renderLQToSurface()
5f02d702e2 SCI: Improve pixel format selection for SCI32 AVI and QuickTime videos
ea0af08ccf SCI: Remove USE_RGB_COLOR checks


Commit: 1ad1a49912fa44c1fd927c1b40d9380e73efbd17
    https://github.com/scummvm/scummvm/commit/1ad1a49912fa44c1fd927c1b40d9380e73efbd17
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2026-04-17T10:54:53+03:00

Commit Message:
SCI: Simplify pixel format selection for SCI 0-1 QuickTime videos

Changed paths:
    engines/sci/engine/kvideo.cpp
    engines/sci/graphics/drivers/common.cpp
    engines/sci/graphics/drivers/default.cpp
    engines/sci/graphics/drivers/ega.cpp
    engines/sci/graphics/drivers/gfxdriver.h
    engines/sci/graphics/drivers/gfxdriver_intern.h
    engines/sci/graphics/drivers/pc98_16col.cpp
    engines/sci/graphics/drivers/pc98_8col_sci0.cpp
    engines/sci/graphics/drivers/pc98_8col_sci1.cpp
    engines/sci/graphics/drivers/upscaled.cpp
    engines/sci/graphics/drivers/win16col.cpp
    engines/sci/graphics/drivers/win256col.cpp


diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp
index 207e06200d3..924e265e374 100644
--- a/engines/sci/engine/kvideo.cpp
+++ b/engines/sci/engine/kvideo.cpp
@@ -137,31 +137,19 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
 				return NULL_REG;
 			}
 
-			Graphics::PixelFormat screenFormat = g_system->getScreenFormat();
-
-			if (videoDecoder->getPixelFormat() != screenFormat) {
-				// Attempt to switch to a screen format with higher bpp
-				const Common::List<Graphics::PixelFormat> supportedFormats = g_system->getSupportedFormats();
-				Common::List<Graphics::PixelFormat>::const_iterator it;
-				for (it = supportedFormats.begin(); it != supportedFormats.end(); ++it) {
-					if (it->bytesPerPixel >= videoDecoder->getPixelFormat().bytesPerPixel) {
-						screenFormat = *it;
-						break;
-					}
-				}
-			}
-
-			if (screenFormat.isCLUT8()) {
+			// Try and select an optimal pixel format
+			videoDecoder->setOutputPixelFormats(g_system->getSupportedFormats());
+			Graphics::PixelFormat format = videoDecoder->getPixelFormat();
+
+			// Init the screen again with an RGB source format.
+			// This is needed so that the GFX driver is aware that we'll be
+			// sending RGB instead of paletted graphics.
+			if (!format.isCLUT8() && !g_sci->_gfxScreen->gfxDriver()->initScreen(&format)) {
 				// We got an indexed screen format, so dither the QuickTime video.
+				// TODO: Allow dithering to be configured separately
 				uint8 palette[256 * 3];
 				g_sci->_gfxScreen->grabPalette(palette, 0, 256);
 				videoDecoder->setDitheringPalette(palette);
-			} else {
-				// Init the screen again with an RGB source format.
-				// This is needed so that the GFX driver is aware that we'll be
-				// sending RGB instead of paletted graphics.
-				g_sci->_gfxScreen->gfxDriver()->initScreen(&screenFormat);
-				videoDecoder->setOutputPixelFormat(g_system->getScreenFormat());
 			}
 
 			// Switch back to the normal screen format, once the QT video is done playing.
diff --git a/engines/sci/graphics/drivers/common.cpp b/engines/sci/graphics/drivers/common.cpp
index b70f263a949..19ef8dd01e4 100644
--- a/engines/sci/graphics/drivers/common.cpp
+++ b/engines/sci/graphics/drivers/common.cpp
@@ -82,7 +82,7 @@ void SCI0_DOSPreVGADriver::assignPalette(const byte *colors) {
 	_colors = colors;
 }
 
-void SCI0_DOSPreVGADriver::initScreen(const Graphics::PixelFormat*) {
+bool SCI0_DOSPreVGADriver::initScreen(const Graphics::PixelFormat*) {
 	Graphics::PixelFormat format(Graphics::PixelFormat::createFormatCLUT8());
 	initGraphics(_screenW, _screenH, _requestRGBMode ? nullptr : &format);
 	format = g_system->getScreenFormat();
@@ -119,6 +119,8 @@ void SCI0_DOSPreVGADriver::initScreen(const Graphics::PixelFormat*) {
 	setupRenderProc();
 
 	_ready = true;
+
+	return true;
 }
 
 void SCI0_DOSPreVGADriver::replaceMacCursor(const Graphics::Cursor*) {
diff --git a/engines/sci/graphics/drivers/default.cpp b/engines/sci/graphics/drivers/default.cpp
index 190aa833701..9689309f59d 100644
--- a/engines/sci/graphics/drivers/default.cpp
+++ b/engines/sci/graphics/drivers/default.cpp
@@ -97,10 +97,23 @@ template <typename T> void colorConvertMod(byte *dst, const byte *src, int pitch
 }
 #undef applyMod
 
-void GfxDefaultDriver::initScreen(const Graphics::PixelFormat *srcRGBFormat) {
+bool GfxDefaultDriver::initScreen(const Graphics::PixelFormat *srcRGBFormat) {
 	Graphics::PixelFormat format8bt(Graphics::PixelFormat::createFormatCLUT8());
-	initGraphics(_screenW, _screenH, srcRGBFormat ? srcRGBFormat : (_requestRGBMode ? nullptr : &format8bt));
-	_format = g_system->getScreenFormat();
+
+	if (srcRGBFormat && !srcRGBFormat->isCLUT8()) {
+		// Also try CLUT8 as a fallback to prevent error dialogs
+		Common::List<Graphics::PixelFormat> formatList;
+		formatList.push_back(*srcRGBFormat);
+		formatList.push_back(format8bt);
+		initGraphics(_screenW, _screenH, formatList);
+	} else {
+		initGraphics(_screenW, _screenH, srcRGBFormat ? srcRGBFormat : (_requestRGBMode ? nullptr : &format8bt));
+	}
+
+	Graphics::PixelFormat format = g_system->getScreenFormat();
+	if (srcRGBFormat && *srcRGBFormat != format)
+		return false;
+	_format = format;
 
 	int srcPixelSize = srcRGBFormat ? _format.bytesPerPixel : 1;
 	if (srcPixelSize != _srcPixelSize || _pixelSize != _format.bytesPerPixel) {
@@ -158,6 +171,8 @@ void GfxDefaultDriver::initScreen(const Graphics::PixelFormat *srcRGBFormat) {
 	_colorConvMod = colorConvModProcs[_pixelSize >> 1];
 
 	_ready = true;
+
+	return true;
 }
 
 void GfxDefaultDriver::setPalette(const byte *colors, uint start, uint num, bool update, const PaletteMod *palMods, const byte *palModMapping) {
diff --git a/engines/sci/graphics/drivers/ega.cpp b/engines/sci/graphics/drivers/ega.cpp
index 8decef6c8e7..0b8c5dcebaf 100644
--- a/engines/sci/graphics/drivers/ega.cpp
+++ b/engines/sci/graphics/drivers/ega.cpp
@@ -67,7 +67,7 @@ template <typename T> void ega640RenderLine(byte *&dst, const byte *src, int w,
 	dst = reinterpret_cast<byte*>(d2);
 }
 
-void SCI1_EGADriver::initScreen(const Graphics::PixelFormat*) {
+bool SCI1_EGADriver::initScreen(const Graphics::PixelFormat*) {
 	if (!_ready)
 		loadData();
 
@@ -122,6 +122,8 @@ void SCI1_EGADriver::initScreen(const Graphics::PixelFormat*) {
 	_renderLine = lineProcs[_pixelSize >> 1];
 
 	_ready = true;
+
+	return true;
 }
 
 void SCI1_EGADriver::setPalette(const byte *colors, uint start, uint num, bool update, const PaletteMod*, const byte*) {
diff --git a/engines/sci/graphics/drivers/gfxdriver.h b/engines/sci/graphics/drivers/gfxdriver.h
index 7328af5c37a..20b1e04f766 100644
--- a/engines/sci/graphics/drivers/gfxdriver.h
+++ b/engines/sci/graphics/drivers/gfxdriver.h
@@ -45,7 +45,7 @@ public:
 
 	GfxDriver(uint16 screenWidth, uint16 screenHeight, int numColors) : _screenW(screenWidth), _screenH(screenHeight), _numColors(numColors), _ready(false), _pixelSize(1) {}
 	virtual ~GfxDriver() {}
-	virtual void initScreen(const Graphics::PixelFormat *srcRGBFormat = nullptr) = 0; // srcRGBFormat: expect incoming data to have the specified rgb pixel format (used for Mac hicolor videos)
+	virtual bool initScreen(const Graphics::PixelFormat *srcRGBFormat = nullptr) = 0; // srcRGBFormat: expect incoming data to have the specified rgb pixel format (used for Mac hicolor videos)
 	virtual void setPalette(const byte *colors, uint start, uint num, bool update, const PaletteMod *palMods, const byte *palModMapping) = 0;
 	virtual void copyRectToScreen(const byte *src, int srcX, int srcY, int pitch, int destX, int destY, int w, int h, const PaletteMod *palMods, const byte *palModMapping) = 0;
 	virtual void replaceCursor(const void *cursor, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor) = 0;
diff --git a/engines/sci/graphics/drivers/gfxdriver_intern.h b/engines/sci/graphics/drivers/gfxdriver_intern.h
index e12fb4a7776..960fcd1e8b2 100644
--- a/engines/sci/graphics/drivers/gfxdriver_intern.h
+++ b/engines/sci/graphics/drivers/gfxdriver_intern.h
@@ -32,7 +32,7 @@ class GfxDefaultDriver : public GfxDriver {
 public:
 	GfxDefaultDriver(uint16 screenWidth, uint16 screenHeight, bool isSCI0, bool rgbRendering);
 	~GfxDefaultDriver() override;
-	void initScreen(const Graphics::PixelFormat *srcRGBFormat) override; // srcRGBFormat: expect incoming data to have the specified rgb pixel format (used for Mac hicolor videos)
+	bool initScreen(const Graphics::PixelFormat *srcRGBFormat) override; // srcRGBFormat: expect incoming data to have the specified rgb pixel format (used for Mac hicolor videos)
 	void setPalette(const byte *colors, uint start, uint num, bool update, const PaletteMod *palMods, const byte *palModMapping) override;
 	void copyRectToScreen(const byte *src, int srcX, int srcY, int pitch, int destX, int destY, int w, int h, const PaletteMod *palMods, const byte *palModMapping) override;
 	void replaceCursor(const void *cursor, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor) override;
@@ -68,7 +68,7 @@ class SCI0_DOSPreVGADriver : public GfxDriver {
 public:
 	SCI0_DOSPreVGADriver(int numColors, int screenW, int screenH, bool rgbRendering);
 	~SCI0_DOSPreVGADriver() override;
-	void initScreen(const Graphics::PixelFormat*) override;
+	bool initScreen(const Graphics::PixelFormat*) override;
 	void setPalette(const byte*, uint, uint, bool, const PaletteMod*, const byte*) override {}
 	void replaceMacCursor(const Graphics::Cursor*) override;
 	void copyCurrentBitmap(byte*, uint32) const override;
@@ -91,7 +91,7 @@ class UpscaledGfxDriver : public GfxDefaultDriver {
 public:
 	UpscaledGfxDriver(int16 textAlignX, bool scaleCursor, bool rgbRendering);
 	~UpscaledGfxDriver() override;
-	void initScreen(const Graphics::PixelFormat *format) override;
+	bool initScreen(const Graphics::PixelFormat *format) override;
 	void setPalette(const byte *colors, uint start, uint num, bool update, const PaletteMod *palMods, const byte *palModMapping) override;
 	void copyRectToScreen(const byte *src, int srcX, int srcY, int pitch, int destX, int destY, int w, int h, const PaletteMod *palMods, const byte *palModMapping) override;
 	void replaceCursor(const void *cursor, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor) override;
@@ -127,7 +127,7 @@ class SCI1_EGADriver : public GfxDriver {
 public:
 	SCI1_EGADriver(bool rgbRendering);
 	~SCI1_EGADriver() override;
-	void initScreen(const Graphics::PixelFormat*) override;
+	bool initScreen(const Graphics::PixelFormat*) override;
 	void setPalette(const byte *colors, uint start, uint num, bool update, const PaletteMod*, const byte*) override;
 	void copyRectToScreen(const byte *src, int srcX, int srcY, int pitch, int destX, int destY, int w, int h, const PaletteMod*, const byte*) override;
 	void replaceCursor(const void *cursor, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor) override;
diff --git a/engines/sci/graphics/drivers/pc98_16col.cpp b/engines/sci/graphics/drivers/pc98_16col.cpp
index 6415aa30775..1d10d362279 100644
--- a/engines/sci/graphics/drivers/pc98_16col.cpp
+++ b/engines/sci/graphics/drivers/pc98_16col.cpp
@@ -36,7 +36,7 @@ public:
 
 	PC98Gfx16ColorsDriver(int textAlignX, bool cursorScaleWidth, bool cursorScaleHeight, SjisFontStyle sjisFontStyle, bool rgbRendering, bool needsUnditheringPalette);
 	~PC98Gfx16ColorsDriver() override;
-	void initScreen(const Graphics::PixelFormat *format) override;
+	bool initScreen(const Graphics::PixelFormat *format) override;
 	void setPalette(const byte*, uint, uint, bool, const PaletteMod*, const byte*) override {}
 	void replaceCursor(const void *cursor, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor) override;
 	byte remapTextColor(byte color) const override;
@@ -137,8 +137,9 @@ void renderPC98GlyphSpecial(byte *dst, int dstPitch, const byte *src, int srcPit
 	}
 }
 
-void PC98Gfx16ColorsDriver::initScreen(const Graphics::PixelFormat *format) {
-	UpscaledGfxDriver::initScreen(format);
+bool PC98Gfx16ColorsDriver::initScreen(const Graphics::PixelFormat *format) {
+	if (!UpscaledGfxDriver::initScreen(format))
+		return false;
 
 	assert(_convPalette);
 	GfxDefaultDriver::setPalette(_convPalette, 0, 256, true, nullptr, nullptr);
@@ -147,9 +148,11 @@ void PC98Gfx16ColorsDriver::initScreen(const Graphics::PixelFormat *format) {
 		_renderGlyph = &SciGfxDrvInternal::renderPC98GlyphFat;
 
 	if (_fontStyle != kFontStyleSpecialSCI1)
-		return;
+		return true;
 
 	_renderGlyph = &renderPC98GlyphSpecial;
+
+	return true;
 }
 
 void PC98Gfx16ColorsDriver::replaceCursor(const void *cursor, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor) {
diff --git a/engines/sci/graphics/drivers/pc98_8col_sci0.cpp b/engines/sci/graphics/drivers/pc98_8col_sci0.cpp
index 20e5654a188..5dda37e08d3 100644
--- a/engines/sci/graphics/drivers/pc98_8col_sci0.cpp
+++ b/engines/sci/graphics/drivers/pc98_8col_sci0.cpp
@@ -30,7 +30,7 @@ class SCI0_PC98Gfx8ColorsDriver final : public UpscaledGfxDriver {
 public:
 	SCI0_PC98Gfx8ColorsDriver(bool cursorScaleHeight, bool useTextModeForSJISChars, bool rgbRendering);
 	~SCI0_PC98Gfx8ColorsDriver() override;
-	void initScreen(const Graphics::PixelFormat *format) override;
+	bool initScreen(const Graphics::PixelFormat *format) override;
 	void setPalette(const byte*, uint, uint, bool, const PaletteMod*, const byte*) override {}
 	void replaceCursor(const void *cursor, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor) override;
 	byte remapTextColor(byte color) const override;
@@ -79,13 +79,17 @@ void pc98SimpleDither(byte *dst, const byte *src, int pitch, int w, int h) {
 	}
 }
 
-void SCI0_PC98Gfx8ColorsDriver::initScreen(const Graphics::PixelFormat *format) {
-	UpscaledGfxDriver::initScreen(format);
+bool SCI0_PC98Gfx8ColorsDriver::initScreen(const Graphics::PixelFormat *format) {
+	if (!UpscaledGfxDriver::initScreen(format))
+		return false;
+
 	_renderScaled = &pc98SimpleDither;
 	if (_useTextMode)
 		_renderGlyph = &SciGfxDrvInternal::renderPC98GlyphFat;
 	assert(_convPalette);
 	GfxDefaultDriver::setPalette(_convPalette, 0, 8, true, nullptr, nullptr);
+
+	return true;
 }
 
 void SCI0_PC98Gfx8ColorsDriver::replaceCursor(const void *cursor, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor) {
diff --git a/engines/sci/graphics/drivers/pc98_8col_sci1.cpp b/engines/sci/graphics/drivers/pc98_8col_sci1.cpp
index 738707c558a..c9a252c8846 100644
--- a/engines/sci/graphics/drivers/pc98_8col_sci1.cpp
+++ b/engines/sci/graphics/drivers/pc98_8col_sci1.cpp
@@ -31,7 +31,7 @@ class SCI1_PC98Gfx8ColorsDriver final : public UpscaledGfxDriver {
 public:
 	SCI1_PC98Gfx8ColorsDriver(bool rgbRendering);
 	~SCI1_PC98Gfx8ColorsDriver() override;
-	void initScreen(const Graphics::PixelFormat *format) override;
+	bool initScreen(const Graphics::PixelFormat *format) override;
 	void setPalette(const byte*, uint, uint, bool, const PaletteMod*, const byte*) override {}
 	void copyRectToScreen(const byte *src, int srcX, int srcY, int pitch, int destX, int destY, int w, int h, const PaletteMod *palMods, const byte *palModMapping) override;
 	void replaceCursor(const void *cursor, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor) override;
@@ -149,13 +149,16 @@ void renderPlanarMatrix(byte *dst, const byte *src, int pitch, int w, int h, con
 	}
 }
 
-void SCI1_PC98Gfx8ColorsDriver::initScreen(const Graphics::PixelFormat *format) {
-	UpscaledGfxDriver::initScreen(format);
+bool SCI1_PC98Gfx8ColorsDriver::initScreen(const Graphics::PixelFormat *format) {
+	if (!UpscaledGfxDriver::initScreen(format))
+		return false;
 
 	_renderGlyph = &SciGfxDrvInternal::renderPC98GlyphFat;
 
 	assert(_convPalette);
 	GfxDefaultDriver::setPalette(_convPalette, 0, 8, true, nullptr, nullptr);
+
+	return true;
 }
 
 void SCI1_PC98Gfx8ColorsDriver::copyRectToScreen(const byte *src, int srcX, int srcY, int pitch, int destX, int destY, int w, int h, const PaletteMod *palMods, const byte *palModMapping) {
diff --git a/engines/sci/graphics/drivers/upscaled.cpp b/engines/sci/graphics/drivers/upscaled.cpp
index b25ed10cab8..d3e1d690acf 100644
--- a/engines/sci/graphics/drivers/upscaled.cpp
+++ b/engines/sci/graphics/drivers/upscaled.cpp
@@ -57,8 +57,10 @@ void renderGlyph(byte *dst, int dstPitch, const byte *src, int srcPitch, int w,
 	}
 }
 
-void UpscaledGfxDriver::initScreen(const Graphics::PixelFormat *format) {
-	GfxDefaultDriver::initScreen(format);
+bool UpscaledGfxDriver::initScreen(const Graphics::PixelFormat *format) {
+	if (!GfxDefaultDriver::initScreen(format))
+		return false;
+
 	_scaledBitmap = new byte[_screenW * _screenH * _srcPixelSize]();
 
 	static const ScaledRenderProc scaledRenderProcs[] = {
@@ -69,6 +71,8 @@ void UpscaledGfxDriver::initScreen(const Graphics::PixelFormat *format) {
 	assert((_srcPixelSize >> 1) < ARRAYSIZE(scaledRenderProcs));
 	_renderScaled = scaledRenderProcs[_srcPixelSize >> 1];
 	_renderGlyph = &renderGlyph;
+
+	return true;
 }
 
 void UpscaledGfxDriver::setPalette(const byte *colors, uint start, uint num, bool update, const PaletteMod *palMods, const byte *palModMapping) {
diff --git a/engines/sci/graphics/drivers/win16col.cpp b/engines/sci/graphics/drivers/win16col.cpp
index d35cf609122..d705edab03a 100644
--- a/engines/sci/graphics/drivers/win16col.cpp
+++ b/engines/sci/graphics/drivers/win16col.cpp
@@ -33,7 +33,7 @@ public:
 	// two pixels of the checkerbox pattern appear in the wrong order. I have implemented a fix for this which can be activated with the fixDithering parameter.
 	WindowsGfx16ColorsDriver(bool fixDithering, bool rgbRendering);
 	~WindowsGfx16ColorsDriver() override {}
-	void initScreen(const Graphics::PixelFormat *format) override;
+	bool initScreen(const Graphics::PixelFormat *format) override;
 	void replaceCursor(const void *cursor, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor) override;
 	Common::Point getRealCoords(Common::Point &pos) const override;
 	static bool validateMode(Common::Platform p) { return (p == Common::kPlatformWindows && checkDriver(&_driverFile, 1)); }
@@ -88,8 +88,9 @@ template <typename T, bool extScale> void win16ColRenderLine(byte *&dst, const b
 	dst = reinterpret_cast<byte*>(extScale ? d3 : (swap ? d1 : d2));
 }
 
-void WindowsGfx16ColorsDriver::initScreen(const Graphics::PixelFormat *format) {
-	SCI1_EGADriver::initScreen(format);
+bool WindowsGfx16ColorsDriver::initScreen(const Graphics::PixelFormat *format) {
+	if (!SCI1_EGADriver::initScreen(format))
+		return false;
 
 	static const LineProc lineProcs[] = {
 		&win16ColRenderLine<byte, false>,
@@ -103,6 +104,8 @@ void WindowsGfx16ColorsDriver::initScreen(const Graphics::PixelFormat *format) {
 	assert((_pixelSize | 1) < ARRAYSIZE(lineProcs));
 	_renderLine = lineProcs[_pixelSize & ~1];
 	_renderLine2 = lineProcs[_pixelSize | 1];
+
+	return true;
 }
 
 void WindowsGfx16ColorsDriver::replaceCursor(const void *cursor, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor) {
diff --git a/engines/sci/graphics/drivers/win256col.cpp b/engines/sci/graphics/drivers/win256col.cpp
index 33fba8e1314..0135396a38e 100644
--- a/engines/sci/graphics/drivers/win256col.cpp
+++ b/engines/sci/graphics/drivers/win256col.cpp
@@ -30,7 +30,7 @@ class WindowsGfx256ColorsDriver final : public UpscaledGfxDriver {
 public:
 	WindowsGfx256ColorsDriver(bool coloredDosStyleCursors, bool smallWindow, bool rgbRendering);
 	~WindowsGfx256ColorsDriver() override {}
-	void initScreen(const Graphics::PixelFormat *format) override;
+	bool initScreen(const Graphics::PixelFormat *format) override;
 	void copyRectToScreen(const byte *src, int srcX, int srcY, int pitch, int destX, int destY, int w, int h, const PaletteMod *palMods, const byte *palModMapping) override;
 	void replaceCursor(const void *cursor, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor) override;
 	Common::Point getRealCoords(Common::Point &pos) const override;
@@ -143,10 +143,14 @@ void hiresRenderLine(byte *&dst, const byte *src, int pitch, int w, const byte *
 void renderLineDummy(byte *&, const byte* , int, int, const byte*) {
 }
 
-void WindowsGfx256ColorsDriver::initScreen(const Graphics::PixelFormat *format) {
-	UpscaledGfxDriver::initScreen(format);
+bool WindowsGfx256ColorsDriver::initScreen(const Graphics::PixelFormat *format) {
+	if (!UpscaledGfxDriver::initScreen(format))
+		return false;
+
 	_renderLine = _smallWindow ? &smallWindowRenderLine : &largeWindowRenderLine;
 	_renderLine2 = _smallWindow ? &renderLineDummy : &hiresRenderLine;
+
+	return true;
 }
 
 void WindowsGfx256ColorsDriver::copyRectToScreen(const byte *src, int srcX, int srcY, int pitch, int destX, int destY, int w, int h, const PaletteMod *palMods, const byte *palModMapping) {


Commit: d31c81feebf8d34385be5d379161ed20e9c5a6d9
    https://github.com/scummvm/scummvm/commit/d31c81feebf8d34385be5d379161ed20e9c5a6d9
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2026-04-17T10:54:53+03:00

Commit Message:
SCI: Extend pixel format support in renderLQToSurface()

Changed paths:
    engines/sci/graphics/video32.cpp
    engines/sci/graphics/video32.h


diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index 290f225c9c8..334d07187cf 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -310,23 +310,35 @@ void VideoPlayer::renderFrame(const Graphics::Surface &nextFrame) const {
 }
 
 template <typename PixelType>
+void VideoPlayer::renderLQToSurfaceDouble(Graphics::Surface &out, const Graphics::Surface &nextFrame, const int lineCount) const {
+	for (int16 y = 0; y < nextFrame.h * 2; y += lineCount) {
+		const PixelType *source = (const PixelType *)nextFrame.getBasePtr(0, y >> 1);
+		PixelType *target = (PixelType *)out.getBasePtr(0, y);
+		for (int16 x = 0; x < nextFrame.w; ++x) {
+			*target++ = *source;
+			*target++ = *source++;
+		}
+	}
+}
+
 void VideoPlayer::renderLQToSurface(Graphics::Surface &out, const Graphics::Surface &nextFrame, const bool doublePixels, const bool blackLines) const {
 
 	const int lineCount = blackLines ? 2 : 1;
 	if (doublePixels) {
-		for (int16 y = 0; y < nextFrame.h * 2; y += lineCount) {
-			const PixelType *source = (const PixelType *)nextFrame.getBasePtr(0, y >> 1);
-			PixelType *target = (PixelType *)out.getBasePtr(0, y);
-			for (int16 x = 0; x < nextFrame.w; ++x) {
-				*target++ = *source;
-				*target++ = *source++;
-			}
+		if (out.format.bytesPerPixel == 1) {
+			renderLQToSurfaceDouble<uint8>(out, nextFrame, lineCount);
+		} else if (out.format.bytesPerPixel == 2) {
+			renderLQToSurfaceDouble<uint16>(out, nextFrame, lineCount);
+		} else if (out.format.bytesPerPixel == 4) {
+			renderLQToSurfaceDouble<uint32>(out, nextFrame, lineCount);
+		} else {
+			error("renderLQToSurface: Unsupported pixel format: %s", out.format.toString().c_str());
 		}
 	} else if (blackLines) {
 		for (int16 y = 0; y < nextFrame.h; y += lineCount) {
-			const PixelType *source = (const PixelType *)nextFrame.getBasePtr(0, y);
-			PixelType *target = (PixelType *)out.getBasePtr(0, y);
-			memcpy(target, source, out.w * sizeof(PixelType));
+			const void *source = nextFrame.getBasePtr(0, y);
+			void *target = out.getBasePtr(0, y);
+			memcpy(target, source, out.w * out.format.bytesPerPixel);
 		}
 	} else {
 		out.copyRectToSurface(nextFrame.getPixels(), nextFrame.pitch, 0, 0, nextFrame.w, nextFrame.h);
@@ -938,7 +950,7 @@ void VMDPlayer::renderOverlay(const Graphics::Surface &nextFrame) const {
 #endif
 
 	Graphics::Surface out = g_sci->_gfxFrameout->getCurrentBuffer().getSubArea(_drawRect);
-	renderLQToSurface<uint8>(out, nextFrame, _doublePixels, _blackLines);
+	renderLQToSurface(out, nextFrame, _doublePixels, _blackLines);
 	g_sci->_gfxFrameout->directFrameOut(_drawRect);
 }
 
@@ -1282,7 +1294,7 @@ void DuckPlayer::renderFrame(const Graphics::Surface &nextFrame) const {
 
 	Graphics::Surface out;
 	out.create(_drawRect.width(), _drawRect.height(), nextFrame.format);
-	renderLQToSurface<uint16>(out, nextFrame, _doublePixels, _blackLines);
+	renderLQToSurface(out, nextFrame, _doublePixels, _blackLines);
 	if (out.format != g_system->getScreenFormat()) {
 		out.convertToInPlace(g_system->getScreenFormat());
 	}
diff --git a/engines/sci/graphics/video32.h b/engines/sci/graphics/video32.h
index 92d7b898c19..e1301459ff1 100644
--- a/engines/sci/graphics/video32.h
+++ b/engines/sci/graphics/video32.h
@@ -160,9 +160,15 @@ protected:
 	 * Renders a video frame to an intermediate surface using low-quality
 	 * scaling, black-lining, or direct copy, depending upon the passed flags.
 	 */
-	template <typename PixelType>
 	void renderLQToSurface(Graphics::Surface &out, const Graphics::Surface &nextFrame, const bool doublePixels, const bool blackLines) const;
 
+	/**
+	 * Renders a video frame to an intermediate surface using low-quality
+	 * scaling.
+	 */
+	template <typename PixelType>
+	void renderLQToSurfaceDouble(Graphics::Surface &out, const Graphics::Surface &nextFrame, int lineCount) const;
+
 	/**
 	 * Sets the draw rect, clipping it to the screen's dimensions if necessary.
 	 */


Commit: 5f02d702e2c54057c540f4fdd11ea4cda1aa5073
    https://github.com/scummvm/scummvm/commit/5f02d702e2c54057c540f4fdd11ea4cda1aa5073
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2026-04-17T10:54:53+03:00

Commit Message:
SCI: Improve pixel format selection for SCI32 AVI and QuickTime videos

Changed paths:
    engines/sci/graphics/frameout.h
    engines/sci/graphics/video32.cpp
    engines/sci/graphics/video32.h


diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index e2703878476..4f737dd3784 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -22,6 +22,7 @@
 #ifndef SCI_GRAPHICS_FRAMEOUT_H
 #define SCI_GRAPHICS_FRAMEOUT_H
 
+#include "common/system.h"               // for g_system
 #include "engines/util.h"                // for initGraphics
 #include "sci/event.h"
 #include "sci/graphics/plane32.h"
@@ -210,8 +211,19 @@ public:
 	/**
 	 * Resets the pixel format of the hardware surface to the given format.
 	 */
-	void setPixelFormat(const Graphics::PixelFormat &format) const {
-		initGraphics(_currentBuffer.w, _currentBuffer.h, &format);
+	bool setPixelFormat(const Graphics::PixelFormat *format) const {
+		if (!format) {
+			initGraphics(_currentBuffer.w, _currentBuffer.h, format);
+			return !g_system->getScreenFormat().isCLUT8();
+		} else {
+			// Also try CLUT8 as a fallback to prevent error dialogs
+			Common::List<Graphics::PixelFormat> formatList;
+			formatList.push_back(*format);
+			if (!format->isCLUT8())
+				formatList.push_back(Graphics::PixelFormat::createFormatCLUT8());
+			initGraphics(_currentBuffer.w, _currentBuffer.h, formatList);
+			return g_system->getScreenFormat() == *format;
+		}
 	}
 
 	/**
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index 334d07187cf..79e990655d2 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -22,9 +22,7 @@
 #include "audio/mixer.h"                 // for Audio::Mixer::kSFXSoundType
 #include "common/config-manager.h"       // for ConfMan
 #include "common/textconsole.h"          // for warning, error
-#ifndef USE_RGB_COLOR
 #include "common/translation.h"          // for _
-#endif
 #include "common/util.h"                 // for ARRAYSIZE
 #include "common/system.h"               // for g_system
 #include "engines/engine.h"              // for Engine, g_engine
@@ -60,45 +58,28 @@ bool VideoPlayer::open(const Common::Path &fileName) {
 		return false;
 	}
 
-#ifndef USE_RGB_COLOR
+	return true;
+}
+
+void VideoPlayer::showUnsupportedFormatDialog() {
 	// KQ7 2.00b videos are compressed in 24bpp Cinepak, so cannot play on a
 	// system with no RGB support
-	if (_decoder->getPixelFormat().bytesPerPixel != 1) {
-		void showScummVMDialog(const Common::U32String &message, const Common::U32String &altButton = Common::U32String(), bool alignCenter = true);
-		showScummVMDialog(Common::U32String::format(_("Cannot play back %dbpp video on a system with maximum color depth of 8bpp"), _decoder->getPixelFormat().bpp()));
-		_decoder->close();
-		return false;
-	}
-#endif
-
-	return true;
+	// TODO: Optionally support dithering for Cinepak videos
+	void showScummVMDialog(const Common::U32String &message, const Common::U32String &altButton = Common::U32String(), bool alignCenter = true);
+	showScummVMDialog(Common::U32String::format(_("Cannot play back %s video on a system with maximum color depth of 8bpp"), _decoder->getPixelFormat().toString().c_str()));
 }
 
-bool VideoPlayer::startHQVideo() {
+bool VideoPlayer::startHQVideo(const Graphics::PixelFormat &format) {
 #ifdef USE_RGB_COLOR
 	// Optimize rendering performance for unscaled videos, and allow
 	// better-than-NN interpolation for videos that are scaled
 	if (shouldStartHQVideo()) {
-		const Common::List<Graphics::PixelFormat> outFormats = g_system->getSupportedFormats();
-		Graphics::PixelFormat bestFormat = outFormats.front();
-		if (bestFormat.bytesPerPixel != 2 && bestFormat.bytesPerPixel != 4) {
-			Common::List<Graphics::PixelFormat>::const_iterator it;
-			for (it = outFormats.begin(); it != outFormats.end(); ++it) {
-				if (it->bytesPerPixel == 2 || it->bytesPerPixel == 4) {
-					bestFormat = *it;
-					break;
-				}
-			}
-		}
-
-		if (bestFormat.bytesPerPixel != 2 && bestFormat.bytesPerPixel != 4) {
-			warning("Failed to find any valid output pixel format");
-			_hqVideoMode = false;
+		if (format.isCLUT8()) {
+			_hqVideoMode = g_sci->_gfxFrameout->setPixelFormat(nullptr);
 		} else {
-			g_sci->_gfxFrameout->setPixelFormat(bestFormat);
-			_hqVideoMode = (g_system->getScreenFormat() != Graphics::PixelFormat::createFormatCLUT8());
-			return _hqVideoMode;
+			_hqVideoMode = g_sci->_gfxFrameout->setPixelFormat(&format);
 		}
+		return _hqVideoMode;
 	} else {
 		_hqVideoMode = false;
 	}
@@ -111,8 +92,8 @@ bool VideoPlayer::endHQVideo() {
 #ifdef USE_RGB_COLOR
 	if (g_system->getScreenFormat().bytesPerPixel != 1) {
 		const Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
-		g_sci->_gfxFrameout->setPixelFormat(format);
-		assert(g_system->getScreenFormat() == format);
+		bool success = g_sci->_gfxFrameout->setPixelFormat(&format);
+		assert(success);
 		_hqVideoMode = false;
 		return true;
 	}
@@ -385,7 +366,7 @@ void SEQPlayer::play(const Common::Path &fileName, const int16 numTicks, const i
 	_drawRect.setWidth(scaledWidth);
 	_drawRect.setHeight(scaledHeight);
 
-	startHQVideo();
+	startHQVideo(_decoder->getPixelFormat());
 	playUntilEvent(kEventFlagMouseDown | kEventFlagEscapeKey);
 	endHQVideo();
 	g_system->fillScreen(0);
@@ -443,8 +424,6 @@ AVIPlayer::IOStatus AVIPlayer::init(const bool doublePixels) {
 		return kIOFileNotFound;
 	}
 
-	g_sci->_gfxCursor32->hide();
-
 	int16 width = _decoder->getWidth();
 	int16 height = _decoder->getHeight();
 	if (doublePixels) {
@@ -467,25 +446,20 @@ AVIPlayer::IOStatus AVIPlayer::init(const bool doublePixels) {
 	_drawRect.setWidth(width);
 	_drawRect.setHeight(height);
 
-	if (!startHQVideo() && _decoder->getPixelFormat().bytesPerPixel != 1) {
-		const Common::List<Graphics::PixelFormat> outFormats = g_system->getSupportedFormats();
-		Graphics::PixelFormat inFormat = _decoder->getPixelFormat();
-		Graphics::PixelFormat bestFormat = outFormats.front();
-		Common::List<Graphics::PixelFormat>::const_iterator it;
-		for (it = outFormats.begin(); it != outFormats.end(); ++it) {
-			if (*it == inFormat) {
-				bestFormat = inFormat;
-				break;
-			}
-		}
+	// Try and select an optimal pixel format
+	_decoder->setOutputPixelFormats(g_system->getSupportedFormats());
+	Graphics::PixelFormat format = _decoder->getPixelFormat();
 
-		if (bestFormat.bytesPerPixel != 2 && bestFormat.bytesPerPixel != 4) {
-			error("Failed to find any valid output pixel format");
+	if (!startHQVideo(format) && _decoder->getPixelFormat().bytesPerPixel != 1) {
+		if (!g_sci->_gfxFrameout->setPixelFormat(&format)) {
+			showUnsupportedFormatDialog();
+			_status = kAVINotOpen;
+			return kIOFileNotFound;
 		}
-
-		g_sci->_gfxFrameout->setPixelFormat(bestFormat);
 	}
 
+	g_sci->_gfxCursor32->hide();
+
 	return kIOSuccess;
 }
 
@@ -578,7 +552,17 @@ void QuickTimePlayer::play(const Common::Path &fileName) {
 	_drawRect.setWidth(scaledWidth);
 	_drawRect.setHeight(scaledHeight);
 
-	startHQVideo();
+	// Try and select an optimal pixel format
+	_decoder->setOutputPixelFormats(g_system->getSupportedFormats());
+	Graphics::PixelFormat format = _decoder->getPixelFormat();
+
+	if (!startHQVideo(format) && _decoder->getPixelFormat().bytesPerPixel != 1) {
+		if (!g_sci->_gfxFrameout->setPixelFormat(&format)) {
+			showUnsupportedFormatDialog();
+			return;
+		}
+	}
+
 	playUntilEvent(kEventFlagMouseDown | kEventFlagEscapeKey);
 	endHQVideo();
 
@@ -925,7 +909,7 @@ void VMDPlayer::initOverlay() {
 	// writing to an intermediate 4bpp surface and using that surface during
 	// cursor drawing, or by promoting the cursor code to use CursorMan, if
 	// possible
-	if (startHQVideo()) {
+	if (startHQVideo(_decoder->getPixelFormat())) {
 		redrawGameScreen();
 	}
 #endif
@@ -1222,18 +1206,25 @@ void DuckPlayer::open(const GuiResourceId resourceId, const int displayMode, con
 				(_decoder->getWidth() << (_doublePixels ? 1 : 0)),
 				(_decoder->getHeight() << (_doublePixels ? 1 : 0)));
 
-	g_sci->_gfxCursor32->hide();
-
 	if (_doFrameOut) {
 		_plane = new Plane(_drawRect, kPlanePicColored);
 		g_sci->_gfxFrameout->addPlane(_plane);
 		g_sci->_gfxFrameout->frameOut(true);
 	}
 
-	if (!startHQVideo() && _decoder->getPixelFormat().bytesPerPixel != 1) {
-		g_sci->_gfxFrameout->setPixelFormat(_decoder->getPixelFormat());
+	// Try and select an optimal pixel format
+	_decoder->setOutputPixelFormats(g_system->getSupportedFormats());
+	Graphics::PixelFormat format = _decoder->getPixelFormat();
+
+	if (!startHQVideo(format) && _decoder->getPixelFormat().bytesPerPixel != 1) {
+		if (!g_sci->_gfxFrameout->setPixelFormat(&format)) {
+			showUnsupportedFormatDialog();
+			return;
+		}
 	}
 
+	g_sci->_gfxCursor32->hide();
+
 	// Try load fan-made SRT subtitles for current video
 	Common::Path subtitlesName(fileName.append(".srt"));
 	_subtitles.loadSRTFile(subtitlesName);
diff --git a/engines/sci/graphics/video32.h b/engines/sci/graphics/video32.h
index e1301459ff1..ea7ffdac009 100644
--- a/engines/sci/graphics/video32.h
+++ b/engines/sci/graphics/video32.h
@@ -103,7 +103,7 @@ protected:
 	 * @returns whether or not the system surface was reinitialized for
 	 * high-quality scaled video.
 	 */
-	bool startHQVideo();
+	bool startHQVideo(const Graphics::PixelFormat &format);
 
 	/**
 	 * Determines whether or not the currently loaded video meets the criteria
@@ -180,6 +180,12 @@ protected:
 	 */
 	void setSubtitlePosition() const;
 
+	/**
+	 * Displays a message if the backend doesn't support the video format used
+	 * by the video.
+	 */
+	void showUnsupportedFormatDialog();
+
 	/**
 	 * The rectangle where the video will be drawn, in screen coordinates.
 	 */


Commit: ea0af08ccf62167daa9b095c4d24dc3813c058fd
    https://github.com/scummvm/scummvm/commit/ea0af08ccf62167daa9b095c4d24dc3813c058fd
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2026-04-17T10:54:53+03:00

Commit Message:
SCI: Remove USE_RGB_COLOR checks

Changed paths:
    engines/sci/detection_options.h
    engines/sci/graphics/frameout.cpp
    engines/sci/graphics/frameout.h
    engines/sci/graphics/palette32.cpp
    engines/sci/graphics/palette32.h
    engines/sci/graphics/video32.cpp
    engines/sci/graphics/video32.h


diff --git a/engines/sci/detection_options.h b/engines/sci/detection_options.h
index adccff49587..f400ec97161 100644
--- a/engines/sci/detection_options.h
+++ b/engines/sci/detection_options.h
@@ -63,7 +63,6 @@ const ADExtraGuiOptionsMap optionsList[] = {
 		}
 	},
 
-#ifdef USE_RGB_COLOR
 	{
 		GAMEOPTION_HQ_VIDEO,
 		{
@@ -75,7 +74,6 @@ const ADExtraGuiOptionsMap optionsList[] = {
 			0
 		}
 	},
-#endif
 
 	{
 		GAMEOPTION_LARRYSCALE,
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 95e71968021..c86620474ab 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -642,7 +642,6 @@ void GfxFrameout::directFrameOut(const Common::Rect &showRect) {
 	showBits();
 }
 
-#ifdef USE_RGB_COLOR
 void GfxFrameout::redrawGameScreen(const Common::Rect &skipRect) const {
 	Common::ScopedPtr<Graphics::Surface> game(_currentBuffer.convertTo(g_system->getScreenFormat(), _palette->getHardwarePalette()));
 	assert(game);
@@ -665,7 +664,6 @@ void GfxFrameout::resetHardware() {
 	g_system->getPaletteManager()->setPalette(_palette->getHardwarePalette(), 0, 256);
 	showBits();
 }
-#endif
 
 /**
  * Determines the parts of `middleRect` that aren't overlapped by `showRect`,
@@ -1111,7 +1109,6 @@ void GfxFrameout::showBits() {
 			continue;
 		}
 
-#ifdef USE_RGB_COLOR
 		if (g_system->getScreenFormat() != _currentBuffer.format) {
 			// This happens (at least) when playing a video in Shivers with
 			// HQ video on & subtitles on
@@ -1121,9 +1118,6 @@ void GfxFrameout::showBits() {
 			screenSurface->free();
 			delete screenSurface;
 		} else {
-#else
-		{
-#endif
 			g_system->copyRectToScreen(sourceBuffer, _currentBuffer.w, rounded.left, rounded.top, rounded.width(), rounded.height());
 		}
 	}
diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index 4f737dd3784..288125a053b 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -275,12 +275,10 @@ public:
 	 */
 	void redrawGameScreen(const Common::Rect &skipRect) const;
 
-#ifdef USE_RGB_COLOR
 	/**
 	 * Sends the entire internal screen buffer and palette to hardware.
 	 */
 	void resetHardware();
-#endif
 
 	/**
 	 * Modifies the raw pixel data for the next frame with new palette indexes
diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp
index a9fa2ebd891..c88ea427ef8 100644
--- a/engines/sci/graphics/palette32.cpp
+++ b/engines/sci/graphics/palette32.cpp
@@ -362,9 +362,7 @@ static const uint8 gammaTables[GfxPalette32::numGammaTables][256] = {
 	// Palette versioning
 	_version(1),
 	_needsUpdate(false),
-#ifdef USE_RGB_COLOR
 	_hardwarePalette(),
-#endif
 	_currentPalette(),
 	_sourcePalette(),
 	_nextPalette(),
@@ -489,11 +487,7 @@ void GfxPalette32::updateHardware() {
 		return;
 	}
 
-#ifdef USE_RGB_COLOR
 	uint8 *bpal = _hardwarePalette;
-#else
-	uint8 bpal[256 * 3];
-#endif
 
 	// HACK: There are resources in a couple of Windows-only games that seem to
 	// include bogus palette entries above 236. SSCI does a lot of extra work
@@ -535,12 +529,6 @@ void GfxPalette32::updateHardware() {
 		}
 	}
 
-#ifndef USE_RGB_COLOR
-	// When creating a raw palette on the stack, any skipped area of the palette
-	// needs to be blacked out or else it will contain garbage memory
-	memset(bpal + (maxIndex + 1) * 3, 0, (255 - maxIndex - 1) * 3);
-#endif
-
 	// The last color must always be white
 	bpal[255 * 3    ] = 255;
 	bpal[255 * 3 + 1] = 255;
diff --git a/engines/sci/graphics/palette32.h b/engines/sci/graphics/palette32.h
index 21b58c43f19..1afefeee70f 100644
--- a/engines/sci/graphics/palette32.h
+++ b/engines/sci/graphics/palette32.h
@@ -247,13 +247,11 @@ 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.
@@ -316,14 +314,12 @@ 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.
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index 79e990655d2..a98e185d1e9 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -70,7 +70,6 @@ void VideoPlayer::showUnsupportedFormatDialog() {
 }
 
 bool VideoPlayer::startHQVideo(const Graphics::PixelFormat &format) {
-#ifdef USE_RGB_COLOR
 	// Optimize rendering performance for unscaled videos, and allow
 	// better-than-NN interpolation for videos that are scaled
 	if (shouldStartHQVideo()) {
@@ -83,13 +82,11 @@ bool VideoPlayer::startHQVideo(const Graphics::PixelFormat &format) {
 	} else {
 		_hqVideoMode = false;
 	}
-#endif
 
 	return false;
 }
 
 bool VideoPlayer::endHQVideo() {
-#ifdef USE_RGB_COLOR
 	if (g_system->getScreenFormat().bytesPerPixel != 1) {
 		const Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
 		bool success = g_sci->_gfxFrameout->setPixelFormat(&format);
@@ -97,7 +94,6 @@ bool VideoPlayer::endHQVideo() {
 		_hqVideoMode = false;
 		return true;
 	}
-#endif
 
 	return false;
 }
@@ -220,11 +216,9 @@ VideoPlayer::EventFlags VideoPlayer::checkForEvent(const EventFlags flags) {
 }
 
 void VideoPlayer::submitPalette(const uint8 palette[256 * 3]) const {
-#ifdef USE_RGB_COLOR
 	if (g_system->getScreenFormat().bytesPerPixel != 1) {
 		return;
 	}
-#endif
 
 	assert(palette);
 	g_system->getPaletteManager()->setPalette(palette, 0, 256);
@@ -258,15 +252,9 @@ void VideoPlayer::renderFrame(const Graphics::Surface &nextFrame) const {
 
 	if (_decoder->getWidth() != _drawRect.width() || _decoder->getHeight() != _drawRect.height()) {
 		Graphics::Surface *const unscaledFrame(convertedFrame);
-#ifdef USE_RGB_COLOR
 		if (_hqVideoMode) {
 			convertedFrame = unscaledFrame->scale(_drawRect.width(), _drawRect.height(), true);
 		} else {
-#elif 1
-		{
-#else
-		}
-#endif
 			convertedFrame = unscaledFrame->scale(_drawRect.width(), _drawRect.height(), false);
 		}
 		assert(convertedFrame);
@@ -904,7 +892,6 @@ void VMDPlayer::initOverlay() {
 	// enabled in Shivers.)
 	g_sci->_gfxFrameout->frameOut(true);
 
-#ifdef USE_RGB_COLOR
 	// TODO: Allow interpolation for videos where the cursor is drawn, either by
 	// writing to an intermediate 4bpp surface and using that surface during
 	// cursor drawing, or by promoting the cursor code to use CursorMan, if
@@ -912,10 +899,8 @@ void VMDPlayer::initOverlay() {
 	if (startHQVideo(_decoder->getPixelFormat())) {
 		redrawGameScreen();
 	}
-#endif
 }
 
-#ifdef USE_RGB_COLOR
 void VMDPlayer::redrawGameScreen() const {
 	if (!_hqVideoMode) {
 		return;
@@ -923,15 +908,12 @@ void VMDPlayer::redrawGameScreen() const {
 
 	g_sci->_gfxFrameout->redrawGameScreen(_drawRect);
 }
-#endif
 
 void VMDPlayer::renderOverlay(const Graphics::Surface &nextFrame) const {
-#ifdef USE_RGB_COLOR
 	if (_hqVideoMode) {
 		VideoPlayer::renderFrame(nextFrame);
 		return;
 	}
-#endif
 
 	Graphics::Surface out = g_sci->_gfxFrameout->getCurrentBuffer().getSubArea(_drawRect);
 	renderLQToSurface(out, nextFrame, _doublePixels, _blackLines);
@@ -986,12 +968,10 @@ void VMDPlayer::submitPalette(const uint8 rawPalette[256 * 3]) const {
 	}
 #endif
 
-#ifdef USE_RGB_COLOR
 	// Changes to the palette may affect areas outside of the video; when the
 	// engine is rendering video in high color, palette changes will only take
 	// effect once the entire screen is redrawn to the high color surface
 	redrawGameScreen();
-#endif
 }
 
 void VMDPlayer::closeOverlay() {
@@ -1000,14 +980,12 @@ void VMDPlayer::closeOverlay() {
 		_plane = nullptr;
 	}
 
-#ifdef USE_RGB_COLOR
 	if (_hqVideoMode) {
 		if (endHQVideo()) {
 			g_sci->_gfxFrameout->resetHardware();
 		}
 		return;
 	}
-#endif
 
 	if (!_leaveLastFrame && _leaveScreenBlack) {
 		g_sci->_gfxFrameout->frameOut(true, _drawRect);
@@ -1276,12 +1254,10 @@ void DuckPlayer::close() {
 }
 
 void DuckPlayer::renderFrame(const Graphics::Surface &nextFrame) const {
-#ifdef USE_RGB_COLOR
 	if (_hqVideoMode) {
 		VideoPlayer::renderFrame(nextFrame);
 		return;
 	}
-#endif
 
 	Graphics::Surface out;
 	out.create(_drawRect.width(), _drawRect.height(), nextFrame.format);
diff --git a/engines/sci/graphics/video32.h b/engines/sci/graphics/video32.h
index ea7ffdac009..58e8dfe72cf 100644
--- a/engines/sci/graphics/video32.h
+++ b/engines/sci/graphics/video32.h
@@ -22,9 +22,7 @@
 #ifndef SCI_GRAPHICS_VIDEO32_H
 #define SCI_GRAPHICS_VIDEO32_H
 
-#ifdef USE_RGB_COLOR
 #include "common/config-manager.h" // for ConfMan
-#endif
 #include "common/path.h"          // for Path
 #include "common/ptr.h"
 #include "common/rect.h"          // for Rect
@@ -71,11 +69,8 @@ public:
 		_eventMan(eventMan),
 		_decoder(decoder),
 		_needsUpdate(false),
-		_currentFrame(nullptr)
-#ifdef USE_RGB_COLOR
-		,
+		_currentFrame(nullptr),
 		_hqVideoMode(false)
-#endif
 		{}
 
 	virtual ~VideoPlayer() {}
@@ -110,7 +105,6 @@ protected:
 	 * for high-quality scaled output.
 	 */
 	virtual bool shouldStartHQVideo() const {
-#ifdef USE_RGB_COLOR
 		if (!ConfMan.getBool("enable_hq_video")) {
 			return false;
 		}
@@ -121,9 +115,6 @@ protected:
 		}
 
 		return true;
-#else
-		return false;
-#endif
 	}
 
 	/**
@@ -208,13 +199,11 @@ protected:
 	 */
 	mutable Video::Subtitles _subtitles;
 
-#ifdef USE_RGB_COLOR
 	/**
 	 * Whether or not the player is currently in high-quality video rendering
 	 * mode.
 	 */
 	bool _hqVideoMode;
-#endif
 };
 
 #pragma mark SEQPlayer
@@ -524,7 +513,6 @@ private:
 	 */
 	void fillPalette(const uint8 rawPalette[256 * 3], Palette &outPalette) const;
 
-#ifdef USE_RGB_COLOR
 	/**
 	 * Redraws areas of the screen outside of the video to the system buffer.
 	 * This is used whenever palette changes occur and the video is rendering in
@@ -551,18 +539,13 @@ private:
 
 		return true;
 	}
-#endif
 
 	/**
 	 * Determines whether or not the video should use the compositing renderer
 	 * instead of the overlay renderer.
 	 */
 	bool shouldUseCompositing() const {
-#ifdef USE_RGB_COLOR
 		return isNormallyComposited() && !shouldStartHQVideo();
-#else
-		return isNormallyComposited();
-#endif
 	}
 
 	bool isNormallyComposited() const {




More information about the Scummvm-git-logs mailing list