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

sev- noreply at scummvm.org
Tue Jun 3 10:49:29 UTC 2025


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

Summary:
9099cbf5a5 QDENGINE: Avoid unnecessary copy in getIniKey()
5fd66b9f6e QDENGINE: Cache decompressed tiles to improve performance


Commit: 9099cbf5a5ce834b2c0693963ff5e4bef3ef2628
    https://github.com/scummvm/scummvm/commit/9099cbf5a5ce834b2c0693963ff5e4bef3ef2628
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-06-03T12:49:24+02:00

Commit Message:
QDENGINE: Avoid unnecessary copy in getIniKey()

Changed paths:
    engines/qdengine/qdcore/qd_setup.cpp
    engines/qdengine/qdcore/qd_setup.h


diff --git a/engines/qdengine/qdcore/qd_setup.cpp b/engines/qdengine/qdcore/qd_setup.cpp
index 41d9d3eeb44..ee906d9f5f7 100644
--- a/engines/qdengine/qdcore/qd_setup.cpp
+++ b/engines/qdengine/qdcore/qd_setup.cpp
@@ -41,7 +41,7 @@ bool enumerateIniSections(Common::INIFile& ini, const Common::Path &fname, Commo
 	return true;
 }
 
-const Common::String getIniKey(Common::INIFile ini, const Common::Path &fname, const char *section, const char *key) {
+const Common::String getIniKey(Common::INIFile& ini, const Common::Path &fname, const char *section, const char *key) {
 	Common::String buf;
 
 	bool hasValue = ini.getKey(key, section, buf);
diff --git a/engines/qdengine/qdcore/qd_setup.h b/engines/qdengine/qdcore/qd_setup.h
index 303fdfdc6bc..0b19cefc472 100644
--- a/engines/qdengine/qdcore/qd_setup.h
+++ b/engines/qdengine/qdcore/qd_setup.h
@@ -26,7 +26,7 @@
 
 namespace QDEngine {
 
-const Common::String getIniKey(Common::INIFile ini, const Common::Path &fname, const char *section, const char *key);
+const Common::String getIniKey(Common::INIFile& ini, const Common::Path &fname, const char *section, const char *key);
 bool enumerateIniSections(Common::INIFile& ini, const Common::Path &fname, Common::INIFile::SectionList &section_list);
 
 } // namespace QDEngine


Commit: 5fd66b9f6e65c44808fed3ee4e1b0c857cfe33d2
    https://github.com/scummvm/scummvm/commit/5fd66b9f6e65c44808fed3ee4e1b0c857cfe33d2
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-06-03T12:49:24+02:00

Commit Message:
QDENGINE: Cache decompressed tiles to improve performance

Changed paths:
    engines/qdengine/system/graphics/gr_tile_animation.cpp
    engines/qdengine/system/graphics/gr_tile_animation.h


diff --git a/engines/qdengine/system/graphics/gr_tile_animation.cpp b/engines/qdengine/system/graphics/gr_tile_animation.cpp
index d876e9b5eb9..064800ee648 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.cpp
+++ b/engines/qdengine/system/graphics/gr_tile_animation.cpp
@@ -54,6 +54,11 @@ void grTileAnimation::clear() {
 	_tileOffsets.clear();
 	TileOffsets(_tileOffsets).swap(_tileOffsets);
 
+	for (auto &i : _decompressedTiles) {
+		free((void *)i._value.data());
+	}
+	_decompressedTiles.clear();
+
 	_tileData.clear();
 	TileData(_tileData).swap(_tileData);
 }
@@ -128,6 +133,10 @@ grTileSprite grTileAnimation::getTile(int tile_index) const {
 	debugC(3, kDebugTemp, "The tile index is given by %d", tile_index);
 	static uint32 tile_buf[GR_TILE_SPRITE_SIZE];
 
+	if (_decompressedTiles.contains(tile_index)) {
+		return _decompressedTiles[tile_index];
+	}
+
 	switch (_compression) {
 	case TILE_UNCOMPRESSED:
 		return grTileSprite(&*_tileData.begin() + _tileOffsets[tile_index]);
@@ -145,7 +154,11 @@ grTileSprite grTileAnimation::getTile(int tile_index) const {
 		}
 	}
 
-	return grTileSprite(tile_buf);
+	uint32 *tempBuf = new uint32[GR_TILE_SPRITE_SIZE];
+	memcpy(tempBuf, tile_buf, GR_TILE_SPRITE_SIZE * sizeof(uint32));
+
+	_decompressedTiles[tile_index] = grTileSprite(tempBuf);
+	return _decompressedTiles[tile_index];
 }
 
 void grTileAnimation::addFrame(const uint32 *frame_data) {
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.h b/engines/qdengine/system/graphics/gr_tile_animation.h
index 25a3d777d98..08d7665b4e0 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.h
+++ b/engines/qdengine/system/graphics/gr_tile_animation.h
@@ -23,6 +23,7 @@
 #ifndef QDENGINE_SYSTEM_GRAPHICS_GR_TILE_ANIMATION_H
 #define QDENGINE_SYSTEM_GRAPHICS_GR_TILE_ANIMATION_H
 
+#include "common/hashmap.h"
 #include "common/path.h"
 
 #include "qdengine/xmath.h"
@@ -146,6 +147,8 @@ private:
 	/// данные тайлов
 	TileData _tileData;
 
+	mutable Common::HashMap<uint32, grTileSprite> _decompressedTiles;
+
 	Std::vector<Vect2i> _frameSizeArray;
 
 	static CompressionProgressHandler _progressHandler;




More information about the Scummvm-git-logs mailing list