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

neuromancer neuromancer at users.noreply.github.com
Sun Mar 28 12:50:18 UTC 2021


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:
099b593943 GRAPHICS: Add functions for getting and setting pixels in a surface
fe169f9e1d PRIVATE: Use the best pixel format specified by the backend
dce5e08467 PRIVATE: Mark the engine as requiring highres and 16bit


Commit: 099b5939437e725a5c65096cf75e34ea6a5676b0
    https://github.com/scummvm/scummvm/commit/099b5939437e725a5c65096cf75e34ea6a5676b0
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-03-28T09:50:15-03:00

Commit Message:
GRAPHICS: Add functions for getting and setting pixels in a surface

Changed paths:
    graphics/managed_surface.h
    graphics/surface.h


diff --git a/graphics/managed_surface.h b/graphics/managed_surface.h
index 2d13860906..2d6c59dc29 100644
--- a/graphics/managed_surface.h
+++ b/graphics/managed_surface.h
@@ -174,6 +174,29 @@ public:
 	 */
 	DisposeAfterUse::Flag disposeAfterUse() const { return _disposeAfterUse; }
 
+	/**
+	 * Return the pixel at the specified point.
+	 *
+	 * @param x  The x coordinate of the pixel.
+	 * @param y  The y coordinate of the pixel.
+	 *
+	 * @return The value of the pixel.
+	 */
+	inline uint32 getPixel(int x, int y) const {
+		return _innerSurface.getPixel(x, y);
+	}
+
+	/**
+	 * Set the pixel at the specified point.
+	 *
+	 * @param x     The x coordinate of the pixel.
+	 * @param y     The y coordinate of the pixel.
+	 * @param pixel The value of the pixel.
+	 */
+	inline void setPixel(int x, int y, uint32 pixel) {
+		return _innerSurface.setPixel(x, y, pixel);
+	}
+
 	/**
 	 * Return a pointer to the pixel at the specified point.
 	 *
diff --git a/graphics/surface.h b/graphics/surface.h
index e4d10ee007..6aa7a7b422 100644
--- a/graphics/surface.h
+++ b/graphics/surface.h
@@ -24,6 +24,7 @@
 #define GRAPHICS_SURFACE_H
 
 #include "common/scummsys.h"
+#include "common/endian.h"
 #include "common/list.h"
 
 namespace Common {
@@ -142,6 +143,47 @@ public:
 		return static_cast<byte *>(pixels) + y * pitch + x * format.bytesPerPixel;
 	}
 
+	/**
+	 * Return the pixel at the specified point.
+	 *
+	 * @param x  The x coordinate of the pixel.
+	 * @param y  The y coordinate of the pixel.
+	 *
+	 * @return The value of the pixel.
+	 */
+	inline uint32 getPixel(int x, int y) const {
+		assert(format.bytesPerPixel > 0 && format.bytesPerPixel <= 4);
+		if (format.bytesPerPixel == 1)
+			return *((const uint8 *)getBasePtr(x, y));
+		else if (format.bytesPerPixel == 2)
+			return *((const uint16 *)getBasePtr(x, y));
+		else if (format.bytesPerPixel == 3)
+			return READ_UINT24(getBasePtr(x, y));
+		else if (format.bytesPerPixel == 4)
+			return *((const uint32 *)getBasePtr(x, y));
+		else
+			return 0;
+	}
+
+	/**
+	 * Set the pixel at the specified point.
+	 *
+	 * @param x     The x coordinate of the pixel.
+	 * @param y     The y coordinate of the pixel.
+	 * @param pixel The value of the pixel.
+	 */
+	inline void setPixel(int x, int y, int pixel) {
+		assert(format.bytesPerPixel > 0 && format.bytesPerPixel <= 4);
+		if (format.bytesPerPixel == 1)
+			*((uint8 *)getBasePtr(x, y)) = pixel;
+		else if (format.bytesPerPixel == 2)
+			*((uint16 *)getBasePtr(x, y)) = pixel;
+		else if (format.bytesPerPixel == 3)
+			WRITE_UINT24(getBasePtr(x, y), pixel);
+		else if (format.bytesPerPixel == 4)
+			*((uint32 *)getBasePtr(x, y)) = pixel;
+	}
+
 	/**
 	 * Allocate memory for the pixel data of the surface.
 	 *


Commit: fe169f9e1d954ca44d856afaf0a0b17e398161cd
    https://github.com/scummvm/scummvm/commit/fe169f9e1d954ca44d856afaf0a0b17e398161cd
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-03-28T09:50:15-03:00

Commit Message:
PRIVATE: Use the best pixel format specified by the backend

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 0fe36bf2b8..c06b68d9d8 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -49,7 +49,7 @@ extern int parse(char *);
 PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
 	: Engine(syst), _gameDescription(gd), _image(nullptr), _videoDecoder(nullptr),
 	  _compositeSurface(nullptr), _transparentColor(0), _frame(nullptr),
-	  _maxNumberClicks(0), _sirenWarning(0), _screenW(0), _screenH(0) {
+	  _maxNumberClicks(0), _sirenWarning(0), _screenW(640), _screenH(480) {
 	_rnd = new Common::RandomSource("private");
 
 	// Debug channels
@@ -166,12 +166,12 @@ Common::Error PrivateEngine::run() {
 	assert(maps.constants.size() > 0);
 
 	// Initialize graphics
-	_screenW = 640;
-	_screenH = 480;
-	//_pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
-	_pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
-	_transparentColor = _pixelFormat.RGBToColor(0,255,0);
-	initGraphics(_screenW, _screenH, &_pixelFormat);
+	initGraphics(_screenW, _screenH, nullptr);
+	_pixelFormat = g_system->getScreenFormat();
+	if (_pixelFormat == Graphics::PixelFormat::createFormatCLUT8())
+		return Common::kUnsupportedColorMode;
+
+	_transparentColor = _pixelFormat.RGBToColor(0, 255, 0);
 	screenRect = Common::Rect(0, 0, _screenW, _screenH);
 	changeCursor("default");
 	_origin = Common::Point(0, 0);
@@ -437,7 +437,7 @@ bool PrivateEngine::inMask(Graphics::ManagedSurface *surf, Common::Point mousePo
 	if (mousePos.x > surf->w || mousePos.y > surf->h)
 		return false;
 
-	return (*((uint32 *)surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor);
+	return (surf->getPixel(mousePos.x, mousePos.y) != _transparentColor);
 }
 
 
@@ -1069,7 +1069,7 @@ void PrivateEngine::drawScreen() {
 		const Graphics::Surface *frame = _videoDecoder->decodeNextFrame();
 		Graphics::Surface *cframe = frame->convertTo(_pixelFormat, _videoDecoder->getPalette());
 		Common::Point center((_screenW - _videoDecoder->getWidth())/2, (_screenH - _videoDecoder->getHeight())/2);
-		surface->transBlitFrom(*cframe, center);
+		surface->blitFrom(*cframe, center);
 		cframe->free();
 		delete cframe;
 	}


Commit: dce5e084678b8559b43931a94b6fd95679f77e77
    https://github.com/scummvm/scummvm/commit/dce5e084678b8559b43931a94b6fd95679f77e77
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-03-28T09:50:15-03:00

Commit Message:
PRIVATE: Mark the engine as requiring highres and 16bit

Changed paths:
    engines/private/configure.engine


diff --git a/engines/private/configure.engine b/engines/private/configure.engine
index a07c594348..29c4412f28 100644
--- a/engines/private/configure.engine
+++ b/engines/private/configure.engine
@@ -1,3 +1,3 @@
 # This file is included from the main "configure" script
 # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
-add_engine private "Private Eye" yes
+add_engine private "Private Eye" yes "" "" "highres 16bit"




More information about the Scummvm-git-logs mailing list