[Scummvm-git-logs] scummvm master -> 5b3398e01562201d2f50dffbbb2d6b8cc58ba12d

whoozle noreply at scummvm.org
Sat Jul 4 12:40:06 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:
91cd7e77ed VIDEO: Remove extra conversion step from FourXMRawVideoTrack
58dc97453c PHOENIXVR: Make more use of ManagedSurface::simpleBlitFrom
e8513e25c9 PHOENIXVR: Combine scaling with vertical flip where possible
5b3398e015 PHOENIXVR: Remove dependency on Graphics::BlendBlit


Commit: 91cd7e77ed393307966a68a803da9d72181f5bec
    https://github.com/scummvm/scummvm/commit/91cd7e77ed393307966a68a803da9d72181f5bec
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2026-07-04T13:40:00+01:00

Commit Message:
VIDEO: Remove extra conversion step from FourXMRawVideoTrack

Changed paths:
    video/4xm_decoder.cpp


diff --git a/video/4xm_decoder.cpp b/video/4xm_decoder.cpp
index 4e905b11cb8..e617edc2152 100644
--- a/video/4xm_decoder.cpp
+++ b/video/4xm_decoder.cpp
@@ -442,40 +442,47 @@ class FourXMDecoder::FourXMRawVideoTrack : public FixedRateVideoTrack {
 	FourXMDecoder *_dec;
 	Common::Rational _frameRate;
 	uint _w, _h;
-	Common::ScopedPtr<Graphics::ManagedSurface> _surface;
-	Common::Array<uint16> _frameBuffer1;
-	Common::Array<uint16> _frameBuffer2;
-	Common::Array<uint16> *_frame = nullptr;
-	Common::Array<uint16> *_previousFrame = nullptr;
+	Graphics::Surface _frameBuffer1;
+	Graphics::Surface _frameBuffer2;
+	Graphics::Surface *_frame = nullptr;
+	Graphics::Surface *_previousFrame = nullptr;
 	Common::Array<int> _fullMotionOffsets;
 	Common::Array<int> _expMotionOffsets;
 	Common::Array<Raw4XMCacheEntry> _cache;
 
 public:
 	FourXMRawVideoTrack(FourXMDecoder *dec, const Common::Rational &frameRate, uint w, uint h) : _dec(dec), _frameRate(frameRate), _w(w), _h(h) {
-		_surface.reset(new Graphics::ManagedSurface());
-		_surface->create(w, h, getPixelFormat());
-		_frameBuffer1.resize(w * h);
-		_frameBuffer2.resize(w * h);
+		_frameBuffer1.create(w, h, getPixelFormat());
+		_frameBuffer2.create(w, h, getPixelFormat());
 		_frame = &_frameBuffer1;
 		_previousFrame = &_frameBuffer2;
 		_cache.resize(256);
 		FourXM::buildRawMotionTables(w, _fullMotionOffsets, _expMotionOffsets);
+
+		assert((uint)_frameBuffer1.pitch == w * 2);
+		assert((uint)_frameBuffer2.pitch == w * 2);
+	}
+
+	~FourXMRawVideoTrack() {
+		_frameBuffer1.free();
+		_frameBuffer2.free();
 	}
 
 	uint16 getWidth() const override { return _w; }
 	uint16 getHeight() const override { return _h; }
 
 	Graphics::PixelFormat getPixelFormat() const override {
-		return Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
+		return Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
 	}
 
 	int getCurFrame() const override { return _dec->_curFrame; }
 	int getFrameCount() const override { return _dec->_frames.size(); }
 
 	const Graphics::Surface *decodeNextFrame() override {
+		const Graphics::Surface *frame = _previousFrame;
+
 		if (_dec->_curFrame >= _dec->_frames.size())
-			return _surface->surfacePtr();
+			return frame;
 
 		const FourXMDecoder::Frame &frameInfo = _dec->_frames[_dec->_curFrame];
 		_dec->_stream->seek(frameInfo.offset);
@@ -484,7 +491,7 @@ public:
 		if (chunkId != kRaw4XMFrameContainer || chunkSize < 8 || frameInfo.offset + chunkSize > frameInfo.end) {
 			warning("invalid raw 4XM frame at offset %" PRId64, frameInfo.offset);
 			++_dec->_curFrame;
-			return _surface->surfacePtr();
+			return frame;
 		}
 
 		Common::Array<byte> payload;
@@ -492,30 +499,29 @@ public:
 		_dec->_stream->read(payload.data(), payload.size());
 		const bool changed = decodeContainerPayload(payload.data(), payload.size(), _dec->_curFrame);
 		if (changed) {
-			copyFrameToSurface();
+			frame = _frame;
 			SWAP(_frame, _previousFrame);
 		}
 
 		++_dec->_curFrame;
-		return _surface->surfacePtr();
+		return frame;
 	}
 
 private:
 	Common::Rational getFrameRate() const override { return _frameRate; }
 
-	void copyFrameToSurface() {
-		Graphics::Surface frame;
-		frame.init(_w, _h, _w * sizeof(uint16), _frame->data(), Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0));
-		_surface->convertFrom(frame, getPixelFormat());
-	}
-
 	bool decodeFullFrame(const byte *payload, uint32 payloadSize) {
 		if (payloadSize < _w * _h * 2)
 			return false;
 
 		Common::MemoryReadStream fullFrameStream(payload, payloadSize);
-		for (uint i = 0; i < _w * _h; ++i)
-			(*_frame)[i] = fullFrameStream.readUint16LE();
+
+		for (uint y = 0; y < _h; ++y) {
+			auto *dst = static_cast<uint16 *>(_frame->getBasePtr(0, y));
+			for (uint x = 0; x < _w; ++x)
+				dst[x] = fullFrameStream.readUint16LE();
+		}
+
 		return true;
 	}
 
@@ -559,7 +565,8 @@ private:
 			if (subChunkId == kRaw4XMFullFrame) {
 				changed = decodeFullFrame(subPayload, subPayloadSize) || changed;
 			} else if (subChunkId == kRaw4XMDeltaFrame) {
-				changed = applyRaw4XMDelta(subPayload, subPayloadSize, _frame->data(), _previousFrame->data(), _w, _h,
+				changed = applyRaw4XMDelta(subPayload, subPayloadSize, (uint16 *)_frame->getPixels(),
+										   (const uint16 *)_previousFrame->getPixels(), _w, _h,
 										   _fullMotionOffsets, _expMotionOffsets) ||
 						  changed;
 			} else if (subChunkId == kRaw4XMCachedFrame) {


Commit: 58dc97453c8f5dfcc82d5c4e5f41ecb2ebcdaf11
    https://github.com/scummvm/scummvm/commit/58dc97453c8f5dfcc82d5c4e5f41ecb2ebcdaf11
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2026-07-04T13:40:00+01:00

Commit Message:
PHOENIXVR: Make more use of ManagedSurface::simpleBlitFrom

Changed paths:
    engines/phoenixvr/arn.cpp
    engines/phoenixvr/phoenixvr.cpp
    engines/phoenixvr/phoenixvr.h


diff --git a/engines/phoenixvr/arn.cpp b/engines/phoenixvr/arn.cpp
index 2ac4065d848..db828e96cf0 100644
--- a/engines/phoenixvr/arn.cpp
+++ b/engines/phoenixvr/arn.cpp
@@ -45,6 +45,7 @@ ARN *ARN::create() {
 	if (!file.open("BDataHeader.vit"))
 		return nullptr;
 
+	// TODO: Convert to the screen format ahead of time?
 	Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
 
 	auto numEntries = file.readUint32LE();
diff --git a/engines/phoenixvr/phoenixvr.cpp b/engines/phoenixvr/phoenixvr.cpp
index 308f7795349..a4084d2a97d 100644
--- a/engines/phoenixvr/phoenixvr.cpp
+++ b/engines/phoenixvr/phoenixvr.cpp
@@ -997,11 +997,9 @@ void PhoenixVREngine::showImageOverlay(const Common::String &image, int x, int y
 		return;
 	}
 
-	uint8 r, g, b;
-	surface->format.colorToRGB(surface->getPixel(surface->w - 1, surface->h - 1), r, g, b);
-	_imageOverlay.reset(surface->convertTo(Graphics::BlendBlit::getSupportedPixelFormat()));
-	if (_imageOverlay)
-		_imageOverlay->applyColorKey(r, g, b);
+	_imageOverlay.reset(new Graphics::ManagedSurface());
+	_imageOverlay->convertFrom(*surface, _pixelFormat);
+	_imageOverlay->setTransparentColor(surface->getPixel(surface->w - 1, surface->h - 1));
 	_imageOverlayPos = Common::Point(x, y);
 }
 
@@ -1054,7 +1052,7 @@ void PhoenixVREngine::lockKey(int idx, const Common::String &warp) {
 	_lockKey[idx] = warp;
 }
 
-Graphics::Surface *PhoenixVREngine::loadSurface(const Common::String &path) {
+Graphics::ManagedSurface *PhoenixVREngine::loadSurface(const Common::String &path) {
 	Common::String filename = path;
 	Common::ScopedPtr<Common::SeekableReadStream> stream(open(path, &filename));
 	if (!stream) {
@@ -1074,16 +1072,17 @@ Graphics::Surface *PhoenixVREngine::loadSurface(const Common::String &path) {
 		warning("decoding %s failed", filename.c_str());
 		return nullptr;
 	}
-	auto *palette = dec->hasPalette() ? dec->getPalette().data() : nullptr;
-	auto *s = dec->getSurface()->convertTo(Graphics::BlendBlit::getSupportedPixelFormat(), palette);
-	if (s) {
-		byte r = 0, g = 0, b = 0;
-		s->applyColorKey(r, g, b);
-	}
+	auto *s = new Graphics::ManagedSurface();
+	s->copyFrom(*dec->getSurface());
+	if (dec->hasPalette())
+		s->setPalette(dec->getPalette().data(), 0, dec->getPalette().size());
+	// TODO: Skip conversion for surfaces with palettes?
+	s->convertToInPlace(_pixelFormat);
+	s->setTransparentColor(s->format.RGBToColor(0, 0, 0));
 	return s;
 }
 
-Graphics::Surface *PhoenixVREngine::loadCursor(const Common::String &path) {
+Graphics::ManagedSurface *PhoenixVREngine::loadCursor(const Common::String &path) {
 	if (path.empty())
 		return nullptr;
 	auto it = _cursorCache.find(path);
@@ -1180,8 +1179,8 @@ void PhoenixVREngine::renderTimer() {
 	fgSrcRect.right = fgSrcRect.left + fgSrcRect.width() * timeLeft;
 	if (!fgRect.isValidRect() || !fgSrcRect.isValidRect())
 		return;
-	_screen->blitFrom(*timerBg, bgRect.origin());
-	_screen->blitFrom(*timerFg, fgSrcRect, fgRect.origin());
+	_screen->simpleBlitFrom(*timerBg, bgRect.origin());
+	_screen->simpleBlitFrom(*timerFg, fgSrcRect, fgRect.origin());
 }
 
 void PhoenixVREngine::renderVR(float dt) {
@@ -1189,7 +1188,7 @@ void PhoenixVREngine::renderVR(float dt) {
 	if (_text) {
 		int16 x = _textRect.left + (_textRect.width() - _text->w) / 2;
 		int16 y = _textRect.top + (_textRect.height() - _text->h) / 2;
-		_screen->blitFrom(*_text, {x, y});
+		_screen->simpleBlitFrom(*_text, {x, y}, Graphics::FLIP_NONE, true);
 	}
 	renderImageOverlay();
 	renderTimer();
@@ -1197,7 +1196,7 @@ void PhoenixVREngine::renderVR(float dt) {
 
 void PhoenixVREngine::renderImageOverlay() {
 	if (_imageOverlay)
-		paint(*_imageOverlay, _imageOverlayPos);
+		_screen->simpleBlitFrom(*_imageOverlay, _imageOverlayPos);
 }
 
 void PhoenixVREngine::saveVariables() {
@@ -1411,7 +1410,7 @@ void PhoenixVREngine::tick(float dt) {
 
 	renderVR(dt);
 
-	Graphics::Surface *cursor = nullptr;
+	Graphics::ManagedSurface *cursor = nullptr;
 	auto &cursors = _cursors[_warpIdx];
 	bool anyMatched = false;
 	for (int i = 0, n = cursors.size(); i != n; ++i) {
@@ -1444,7 +1443,7 @@ void PhoenixVREngine::tick(float dt) {
 	if (!cursor)
 		cursor = loadCursor(anyMatched ? _defaultCursor[1] : _defaultCursor[0]);
 	if (cursor) {
-		paint(*cursor, _mousePos - Common::Point(cursor->w / 2, cursor->h / 2));
+		_screen->simpleBlitFrom(*cursor, _mousePos - Common::Point(cursor->w / 2, cursor->h / 2));
 	}
 }
 
@@ -1670,15 +1669,6 @@ Common::Error PhoenixVREngine::run() {
 	return Common::kNoError;
 }
 
-void PhoenixVREngine::paint(Graphics::Surface &src, Common::Point dst) {
-	Common::Rect srcRect = src.getRect();
-	Common::Rect clip = _screen->getBounds();
-	if (Common::Rect::getBlitRect(dst, srcRect, clip)) {
-		Common::Rect dstRect(dst.x, dst.y, dst.x + srcRect.width(), dst.y + srcRect.height());
-		_screen->blitFrom(src, srcRect, dstRect);
-	}
-}
-
 bool PhoenixVREngine::testSaveSlot(int idx) const {
 	return _saveFileMan->exists(getSaveStateName(idx));
 }
diff --git a/engines/phoenixvr/phoenixvr.h b/engines/phoenixvr/phoenixvr.h
index d9e82daef41..cc5bb8b8802 100644
--- a/engines/phoenixvr/phoenixvr.h
+++ b/engines/phoenixvr/phoenixvr.h
@@ -217,9 +217,8 @@ private:
 	Common::SeekableReadStream *open(const Common::String &name, Common::String *origName = nullptr);
 	Common::SeekableReadStream *tryOpen(const Common::Path &name, Common::String *origName);
 
-	Graphics::Surface *loadSurface(const Common::String &path);
-	Graphics::Surface *loadCursor(const Common::String &path);
-	void paint(Graphics::Surface &src, Common::Point dst);
+	Graphics::ManagedSurface *loadSurface(const Common::String &path);
+	Graphics::ManagedSurface *loadCursor(const Common::String &path);
 	PointF currentVRPos() const {
 		return RectF::transform(_angleX.angle(), _angleY.angle(), _fov);
 	}
@@ -270,7 +269,7 @@ private:
 
 	Common::ScopedPtr<RegionSet> _regSet;
 
-	Common::HashMap<Common::String, Graphics::Surface *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _cursorCache;
+	Common::HashMap<Common::String, Graphics::ManagedSurface *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _cursorCache;
 
 	Common::Array<Common::Array<Common::String>> _cursors;
 	Common::String _defaultCursor[2];
@@ -303,7 +302,7 @@ private:
 
 	Common::ScopedPtr<Graphics::ManagedSurface> _text;
 	Common::Rect _textRect;
-	Common::ScopedPtr<Graphics::Surface> _imageOverlay;
+	Common::ScopedPtr<Graphics::ManagedSurface> _imageOverlay;
 	Common::Point _imageOverlayPos;
 	bool _cibleActive = false;
 	uint32 _cibleStartMillis = 0;


Commit: e8513e25c9714e72ef734d5b6f14658165f165cd
    https://github.com/scummvm/scummvm/commit/e8513e25c9714e72ef734d5b6f14658165f165cd
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2026-07-04T13:40:00+01:00

Commit Message:
PHOENIXVR: Combine scaling with vertical flip where possible

Changed paths:
    engines/phoenixvr/game_state.cpp
    engines/phoenixvr/phoenixvr.cpp


diff --git a/engines/phoenixvr/game_state.cpp b/engines/phoenixvr/game_state.cpp
index 89e2e45e9d5..62b78a66f61 100644
--- a/engines/phoenixvr/game_state.cpp
+++ b/engines/phoenixvr/game_state.cpp
@@ -71,13 +71,14 @@ Graphics::Surface *GameState::getThumbnail(const Graphics::PixelFormat &fmt, int
 	Graphics::Surface th;
 	th.init(thumbWidth, thumbHeight, thumbnail.size() / thumbHeight, thumbnail.data(), rgb565);
 	Graphics::Surface *src = th.convertTo(fmt);
-	src->flipVertical(src->getRect());
 	if (newWidth > 0) {
 		int newHeight = newWidth * src->h / src->w;
-		auto *scaled = src->scale(newWidth, newHeight, true);
+		auto *scaled = src->scale(newWidth, newHeight, true, Graphics::FLIP_V);
 		src->free();
 		delete src;
 		return scaled;
+	} else {
+		src->flipVertical(src->getRect());
 	}
 	return src;
 }
diff --git a/engines/phoenixvr/phoenixvr.cpp b/engines/phoenixvr/phoenixvr.cpp
index a4084d2a97d..200cb30cae5 100644
--- a/engines/phoenixvr/phoenixvr.cpp
+++ b/engines/phoenixvr/phoenixvr.cpp
@@ -711,9 +711,8 @@ bool PhoenixVREngine::goToWarp(const Common::String &warp, bool savePrev) {
 		assert(_warpIdx >= 0);
 		_prevWarp = _warpIdx;
 		// saving thumbnail
-		Common::ScopedPtr<Graphics::ManagedSurface> screenshot(_screen->scale(_thumbnail.w, _thumbnail.h, true));
-		screenshot->convertToInPlace(_rgb565);
-		_thumbnail.simpleBlitFrom(*screenshot, Graphics::FLIP_V);
+		Common::ScopedPtr<Graphics::ManagedSurface> screenshot(_screen->scale(_thumbnail.w, _thumbnail.h, true, Graphics::FLIP_V));
+		_thumbnail.simpleBlitFrom(*screenshot);
 	}
 	return true;
 }


Commit: 5b3398e01562201d2f50dffbbb2d6b8cc58ba12d
    https://github.com/scummvm/scummvm/commit/5b3398e01562201d2f50dffbbb2d6b8cc58ba12d
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2026-07-04T13:40:00+01:00

Commit Message:
PHOENIXVR: Remove dependency on Graphics::BlendBlit

Changed paths:
    engines/phoenixvr/phoenixvr.cpp


diff --git a/engines/phoenixvr/phoenixvr.cpp b/engines/phoenixvr/phoenixvr.cpp
index 200cb30cae5..05f4dd28fc5 100644
--- a/engines/phoenixvr/phoenixvr.cpp
+++ b/engines/phoenixvr/phoenixvr.cpp
@@ -1306,7 +1306,7 @@ void PhoenixVREngine::rollover(int textId, RolloverType type) {
 	auto numLines = static_cast<int>(lines.size());
 	auto textH = fontH * numLines;
 	debug("text %dx%d", textW, textH);
-	_text.reset(new Graphics::ManagedSurface(textW, textH, Graphics::BlendBlit::getSupportedPixelFormat()));
+	_text.reset(new Graphics::ManagedSurface(textW, textH, Graphics::PixelFormat::createFormatRGBA32()));
 	_text->clear();
 	byte r, g, b;
 	_rgb565.colorToRGB(color, r, g, b);




More information about the Scummvm-git-logs mailing list