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

sev- noreply at scummvm.org
Thu Sep 5 20:54:19 UTC 2024


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

Summary:
ef5c39e6fb QDENGINE: DT: Fix guard define
ea3c3febce QDENGINE: Consistently replace screen buffer for off-screen rendering
a10d6bc516 QDENGINE:: DT: Made sprite drawing following the common execution path


Commit: ef5c39e6fbb0a1e847b5b93166c92fcc4549f24b
    https://github.com/scummvm/scummvm/commit/ef5c39e6fbb0a1e847b5b93166c92fcc4549f24b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-05T22:22:44+02:00

Commit Message:
QDENGINE: DT: Fix guard define

Changed paths:
    engines/qdengine/debugger/dt-internal.h


diff --git a/engines/qdengine/debugger/dt-internal.h b/engines/qdengine/debugger/dt-internal.h
index 1609c66e22b..481642af466 100644
--- a/engines/qdengine/debugger/dt-internal.h
+++ b/engines/qdengine/debugger/dt-internal.h
@@ -19,8 +19,8 @@
  *
  */
 
-#ifndef QDENGINE_DEBUGGER_H
-#define QDENGINE_DEBUGGER_H
+#ifndef QDENGINE_DT_INTERNAL_H
+#define QDENGINE_DT_INTERNAL_H
 
 namespace QDEngine {
 
@@ -46,4 +46,4 @@ extern ImGuiState *_state;
 
 }
 
-#endif // QDENGINE_DEBUGGER_H
+#endif // QDENGINE_DT_INTERNAL_H


Commit: ea3c3febcec5f7ae64f8610bc3bdf9f749e6a1f6
    https://github.com/scummvm/scummvm/commit/ea3c3febcec5f7ae64f8610bc3bdf9f749e6a1f6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-05T22:31:30+02:00

Commit Message:
QDENGINE: Consistently replace screen buffer for off-screen rendering

Changed paths:
    engines/qdengine/system/graphics/gr_dispatcher.cpp
    engines/qdengine/system/graphics/gr_dispatcher.h
    engines/qdengine/system/graphics/gr_draw_sprite.cpp
    engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp


diff --git a/engines/qdengine/system/graphics/gr_dispatcher.cpp b/engines/qdengine/system/graphics/gr_dispatcher.cpp
index 2d7826e50dd..2624deebf30 100644
--- a/engines/qdengine/system/graphics/gr_dispatcher.cpp
+++ b/engines/qdengine/system/graphics/gr_dispatcher.cpp
@@ -89,8 +89,8 @@ bool grDispatcher::finit() {
 	_flags &= ~GR_INITED;
 	_sizeX = _sizeY = 0;
 	_wndPosX = _wndPosY = 0;
-	delete _screenBuf;
-	_screenBuf = nullptr;
+	delete _realScreenBuf;
+	_realScreenBuf = nullptr;
 	delete  _yTable;
 	_yTable = NULL;
 
@@ -103,7 +103,8 @@ bool grDispatcher::init(int sx, int sy, grPixelFormat pixel_format) {
 	_pixel_format = pixel_format;
 
 	initGraphics(sx, sy, &g_engine->_pixelformat);
-	_screenBuf = new Graphics::ManagedSurface(sx, sy, g_engine->_pixelformat);
+	_realScreenBuf = new Graphics::ManagedSurface(sx, sy, g_engine->_pixelformat);
+	_screenBuf = _realScreenBuf;
 
 	_sizeX = sx;
 	_sizeY = sy;
@@ -351,11 +352,11 @@ void grDispatcher::erase(int x, int y, int sx, int sy, int col) {
 }
 
 void grDispatcher::surfaceOverride(Graphics::ManagedSurface *target) {
-	_surfaceOverride = target;
+	_screenBuf = target;
 }
 
 void grDispatcher::resetSurfaceOverride() {
-	_surfaceOverride = nullptr;
+	_screenBuf = _realScreenBuf;
 }
 
 void grDispatcher::setPixel(int x, int y, int col) {
diff --git a/engines/qdengine/system/graphics/gr_dispatcher.h b/engines/qdengine/system/graphics/gr_dispatcher.h
index 509326a6c65..2aa54caa4a0 100644
--- a/engines/qdengine/system/graphics/gr_dispatcher.h
+++ b/engines/qdengine/system/graphics/gr_dispatcher.h
@@ -499,7 +499,7 @@ protected:
 	void *_hWnd;
 
 	Graphics::ManagedSurface *_screenBuf = nullptr;
-	Graphics::ManagedSurface * _surfaceOverride = nullptr;
+	Graphics::ManagedSurface *_realScreenBuf = nullptr;
 
 	int *_yTable;
 
diff --git a/engines/qdengine/system/graphics/gr_draw_sprite.cpp b/engines/qdengine/system/graphics/gr_draw_sprite.cpp
index 6b3866ceafa..d8aa24c0e74 100644
--- a/engines/qdengine/system/graphics/gr_draw_sprite.cpp
+++ b/engines/qdengine/system/graphics/gr_draw_sprite.cpp
@@ -165,12 +165,9 @@ void grDispatcher::putSpr_a(int x, int y, int sx, int sy, const byte *p, int mod
 	sx <<= 2;
 	px <<= 2;
 
-	Graphics::ManagedSurface *target = _surfaceOverride ? _surfaceOverride : _screenBuf;
-	if (target == _surfaceOverride)
-		debugC(3, kDebugImGui, "grDispatcher::putSpr_a(): _surfaceOverride: %p", (void *)target);
 	const byte *data_ptr = p + py * sx;
 	for (int i = 0; i < psy; i++) {
-		uint16 *scr_buf = reinterpret_cast<uint16 *>(target->getBasePtr(x, y));
+		uint16 *scr_buf = reinterpret_cast<uint16 *>(_screenBuf->getBasePtr(x, y));
 		const byte *data_line = data_ptr + px;
 
 		for (int j = 0; j < psx; j++) {
@@ -617,7 +614,6 @@ void grDispatcher::putSpr(int x, int y, int sx, int sy, const byte *p, int mode,
 	} else
 		dy = 1;
 
-	Graphics::ManagedSurface *target = _surfaceOverride ? _surfaceOverride : _screenBuf;
 	if (spriteFormat == GR_RGB888) {
 		sx *= 3;
 		px *= 3;
@@ -625,7 +621,7 @@ void grDispatcher::putSpr(int x, int y, int sx, int sy, const byte *p, int mode,
 		const byte *data_ptr = p + py * sx;
 
 		for (int i = 0; i < psy; i++) {
-			uint16 *scr_buf = reinterpret_cast<uint16 *>(target->getBasePtr(x, y));
+			uint16 *scr_buf = reinterpret_cast<uint16 *>(_screenBuf->getBasePtr(x, y));
 			const byte *data_line = data_ptr + px;
 
 			for (int j = 0; j < psx; j++) {
@@ -645,7 +641,7 @@ void grDispatcher::putSpr(int x, int y, int sx, int sy, const byte *p, int mode,
 		const byte *data_ptr = p + py * sx;
 
 		for (int i = 0; i < psy; i++) {
-			uint16 *scr_buf = reinterpret_cast<uint16 *>(target->getBasePtr(x, y));
+			uint16 *scr_buf = reinterpret_cast<uint16 *>(_screenBuf->getBasePtr(x, y));
 			const byte *data_line = data_ptr + px;
 
 			for (int j = 0; j < psx; j++) {
diff --git a/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp b/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp
index fa94cc40d92..0d74aed3005 100644
--- a/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp
+++ b/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp
@@ -57,14 +57,8 @@ void grDispatcher::putSpr_rle(int x, int y, int sx, int sy, const class RLEBuffe
 	} else
 		dy = 1;
 
-	Graphics::ManagedSurface *target = _surfaceOverride ? _surfaceOverride : _screenBuf;
-	if (target == _surfaceOverride) {
-		debugC(3, kDebugImGui, "grDispatcher::putSpr_rle(): %p", (void *)target);
-		debugC(3, kDebugImGui, "grDispatcher::putSpr_rle(%d, %d, %d, %d)", x, y, sx, sy);
-	}
-
 	for (int i = 0; i < psy; i++) {
-		uint16 *scr_buf = reinterpret_cast<uint16 *>(target->getBasePtr(x, y));
+		uint16 *scr_buf = reinterpret_cast<uint16 *>(_screenBuf->getBasePtr(x, y));
 
 		const char *rle_header = p->header_ptr(py + i);
 		const uint32 *rle_data = p->data_ptr(py + i);


Commit: a10d6bc516739a85f94dd2ef08367ee0fe05aa41
    https://github.com/scummvm/scummvm/commit/a10d6bc516739a85f94dd2ef08367ee0fe05aa41
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-05T22:53:37+02:00

Commit Message:
QDENGINE:: DT: Made sprite drawing following the common execution path

Changed paths:
    engines/qdengine/debugger/debugtools.cpp
    engines/qdengine/qdcore/qd_animation.h


diff --git a/engines/qdengine/debugger/debugtools.cpp b/engines/qdengine/debugger/debugtools.cpp
index e37a6387098..08d49e980d1 100644
--- a/engines/qdengine/debugger/debugtools.cpp
+++ b/engines/qdengine/debugger/debugtools.cpp
@@ -78,23 +78,29 @@ ImGuiImage getImageID(Common::Path filename, int frameNum) {
 	qdAnimation *animation = new qdAnimation();
 	animation->qda_load(filename);
 
-	qdAnimationFrame *frame = animation->get_frame(frameNum);
 	_state->_qdaToDisplayFrameCount = animation->num_frames();
 
 	int sx = 10, sy = 10;
-	if (frame) {
+
+	if (animation->tileAnimation() && 0) {
+		Vect2i size = animation->tileAnimation()->frameSize();
+
+		sx = size.x;
+		sy = size.y;
+	} else {
+		qdAnimationFrame *frame = animation->get_frame(frameNum);
+
 		sx = frame->size_x();
 		sy = frame->size_y();
 	}
-	Graphics::ManagedSurface surface(sx, sy, g_engine->_pixelformat);
 
-	if (frame) {
-		grDispatcher::instance()->surfaceOverride(&surface);
+	Graphics::ManagedSurface surface(sx, sy, g_engine->_pixelformat);
 
-		frame->redraw(sx / 2, sy / 2, 0);
+	animation->set_cur_frame(frameNum);
 
-		grDispatcher::instance()->resetSurfaceOverride();
-	}
+	grDispatcher::instance()->surfaceOverride(&surface);
+	animation->redraw(sx / 2, sy/ 2, 0, 0);
+	grDispatcher::instance()->resetSurfaceOverride();
 
 	_state->_frames[key] = { (ImTextureID)(intptr_t)loadTextureFromSurface(surface.surfacePtr()), sx, sy };
 
diff --git a/engines/qdengine/qdcore/qd_animation.h b/engines/qdengine/qdcore/qd_animation.h
index ccdfe1ba385..265d22c1cc8 100644
--- a/engines/qdengine/qdcore/qd_animation.h
+++ b/engines/qdengine/qdcore/qd_animation.h
@@ -266,6 +266,13 @@ public:
 		_scales.clear();
 	}
 
+	const grTileAnimation *tileAnimation() const {
+		if (check_flag(QD_ANIMATION_FLAG_REFERENCE) && _parent)
+			return _parent->_tileAnimation;
+		else
+			return _tileAnimation;
+	}
+
 private:
 	int _sx;
 	int _sy;
@@ -301,13 +308,6 @@ private:
 
 	bool copy_frames(const qdAnimation &anm);
 	void clear_frames();
-
-	const grTileAnimation *tileAnimation() const {
-		if (check_flag(QD_ANIMATION_FLAG_REFERENCE) && _parent)
-			return _parent->_tileAnimation;
-		else
-			return _tileAnimation;
-	}
 };
 
 } // namespace QDEngine




More information about the Scummvm-git-logs mailing list