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

neuromancer neuromancer at users.noreply.github.com
Fri May 21 11:31:50 UTC 2021


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

Summary:
f42dc29971 PRIVATE: simplified mask handling


Commit: f42dc299712a0a9e3f9521e8fefe6b40c4d5db1c
    https://github.com/scummvm/scummvm/commit/f42dc299712a0a9e3f9521e8fefe6b40c4d5db1c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-05-21T08:31:34-03:00

Commit Message:
PRIVATE: simplified mask handling

Changed paths:
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index c06b68d9d8..0086a2dae4 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -426,7 +426,7 @@ bool PrivateEngine::cursorExit(Common::Point mousePos) {
 	return false;
 }
 
-bool PrivateEngine::inMask(Graphics::ManagedSurface *surf, Common::Point mousePos) {
+bool PrivateEngine::inMask(Graphics::Surface *surf, Common::Point mousePos) {
 	if (surf == NULL)
 		return false;
 
@@ -1040,13 +1040,14 @@ void PrivateEngine::drawScreenFrame() {
 }
 
 
-Graphics::ManagedSurface *PrivateEngine::loadMask(const Common::String &name, int x, int y, bool drawn) {
+Graphics::Surface *PrivateEngine::loadMask(const Common::String &name, int x, int y, bool drawn) {
 	debugC(1, kPrivateDebugFunction, "%s(%s,%d,%d,%d)", __FUNCTION__, name.c_str(), x, y, drawn);
-	Graphics::ManagedSurface *surf = new Graphics::ManagedSurface();
+	Graphics::Surface *surf = new Graphics::Surface();
 	surf->create(_screenW, _screenH, _pixelFormat);
 	surf->fillRect(screenRect, _transparentColor);
 	Graphics::Surface *csurf = decodeImage(name);
-	surf->transBlitFrom(*csurf, Common::Point(x,y));
+	Common::Rect crect(csurf->w, csurf->h);
+	surf->copyRectToSurface(*csurf, x, y, crect);
 	csurf->free();
 	delete csurf;
 	_image->destroy();
@@ -1058,8 +1059,8 @@ Graphics::ManagedSurface *PrivateEngine::loadMask(const Common::String &name, in
 	return surf;
 }
 
-void PrivateEngine::drawMask(Graphics::ManagedSurface *surf) {
-	_compositeSurface->transBlitFrom(surf->rawSurface(), _origin, _transparentColor);
+void PrivateEngine::drawMask(Graphics::Surface *surf) {
+	_compositeSurface->transBlitFrom(*surf, _origin, _transparentColor);
 }
 
 void PrivateEngine::drawScreen() {
@@ -1163,7 +1164,6 @@ void PrivateEngine::loadInventory(uint32 x, const Common::Rect &r1, const Common
 	int16 offset = 0;
 	for (NameList::const_iterator it = inventory.begin(); it != inventory.end(); ++it) {
 		offset = offset + 22;
-		//debug("%hd %hd", rect->left, rect->top + offset);
 		loadMask(*it, r1.left, r1.top + offset, true);
 	}
 }
diff --git a/engines/private/private.h b/engines/private/private.h
index 362cc3a9d9..efd3ace348 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -77,7 +77,7 @@ typedef struct ExitInfo {
 } ExitInfo;
 
 typedef struct MaskInfo {
-	Graphics::ManagedSurface *surf;
+	Graphics::Surface *surf;
 	Common::String nextSetting;
 	Common::Point point;
 	Symbol *flag1;
@@ -202,9 +202,9 @@ public:
 
 	// Rendering
 	Graphics::ManagedSurface *_compositeSurface;
-	Graphics::ManagedSurface *loadMask(const Common::String &, int, int, bool);
-	void drawMask(Graphics::ManagedSurface *);
-	bool inMask(Graphics::ManagedSurface *, Common::Point);
+	Graphics::Surface *loadMask(const Common::String &, int, int, bool);
+	void drawMask(Graphics::Surface *);
+	bool inMask(Graphics::Surface *, Common::Point);
 	uint32 _transparentColor;
 	Common::Rect screenRect;
 	Common::String _framePath;




More information about the Scummvm-git-logs mailing list