[Scummvm-git-logs] scummvm master -> 659e3c72b820297e946cc7126c2555acfe41e61a

sev- sev at scummvm.org
Fri Aug 14 21:54:32 UTC 2020


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

Summary:
5c06d5402d DIRECTOR: More work on 32bpp rendering
659e3c72b8 GRAPHICS: MACGUI: Further work on 32bpp blitting


Commit: 5c06d5402d6bfaa8f6eb36f04c30c2a03d3a650f
    https://github.com/scummvm/scummvm/commit/5c06d5402d6bfaa8f6eb36f04c30c2a03d3a650f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-14T23:54:16+02:00

Commit Message:
DIRECTOR: More work on 32bpp rendering

Changed paths:
    engines/director/images.cpp
    engines/director/images.h


diff --git a/engines/director/images.cpp b/engines/director/images.cpp
index c274f80819..f5f4ecc066 100644
--- a/engines/director/images.cpp
+++ b/engines/director/images.cpp
@@ -105,15 +105,16 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
 
 BITDDecoder::BITDDecoder(int w, int h, uint16 bitsPerPixel, uint16 pitch, const byte *palette) {
 	_surface = new Graphics::Surface();
+	_pitch = pitch;
 
-	if (pitch < w) {
-		warning("BITDDecoder: pitch is too small: %d < %d", pitch, w);
+	if (_pitch < w) {
+		warning("BITDDecoder: pitch is too small: %d < %d", _pitch, w);
 
-		pitch = w;
+		_pitch = w;
 	}
 
 	// HACK: Create a padded surface by adjusting w after create()
-	_surface->create(pitch, h, g_director->_pixelformat);
+	_surface->create(_pitch, h, g_director->_pixelformat);
 	_surface->w = w;
 
 	_palette = palette;
@@ -180,7 +181,7 @@ bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
 	Common::Array<int> pixels;
 	// If the stream has exactly the required number of bits for this image,
 	// we assume it is uncompressed.
-	if (stream.size() == _surface->pitch * _surface->h * _bitsPerPixel / 8) {
+	if (stream.size() == _pitch * _surface->h * _bitsPerPixel / 8) {
 		debugC(6, kDebugImages, "Skipping compression");
 		for (int i = 0; i < stream.size(); i++) {
 			pixels.push_back((int)stream.readByte());
@@ -227,13 +228,21 @@ bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
 	if (_surface->w < (pixels.size() / _surface->h))
 		offset = (pixels.size() / _surface->h) - _surface->w;
 
+	uint32 color;
+	bool paletted = (g_director->_pixelformat.bytesPerPixel == 1);
+
 	if (pixels.size() > 0) {
 		for (y = 0; y < _surface->h; y++) {
 			for (x = 0; x < _surface->w;) {
 				switch (_bitsPerPixel) {
 				case 1:
 					for (int c = 0; c < 8 && x < _surface->w; c++, x++) {
-						*((byte *)_surface->getBasePtr(x, y)) = (pixels[(((y * _surface->pitch) + x) / 8)] & (1 << (7 - c))) ? 0 : 0xff;
+						color = (pixels[(((y * _pitch) + x) / 8)] & (1 << (7 - c))) ? 0 : 0xff;
+						if (paletted) {
+							*((byte *)_surface->getBasePtr(x, y)) = color;
+						} else {
+							*((uint32 *)_surface->getBasePtr(x, y)) = color ? 0xffffff : 0;
+						}
 					}
 					break;
 
diff --git a/engines/director/images.h b/engines/director/images.h
index 8a6c5e7f7a..456dd255e1 100644
--- a/engines/director/images.h
+++ b/engines/director/images.h
@@ -78,6 +78,7 @@ private:
 	const byte *_palette;
 	uint8 _paletteColorCount;
 	uint16 _bitsPerPixel;
+	uint16 _pitch;
 };
 
 } // End of namespace Director


Commit: 659e3c72b820297e946cc7126c2555acfe41e61a
    https://github.com/scummvm/scummvm/commit/659e3c72b820297e946cc7126c2555acfe41e61a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-14T23:54:16+02:00

Commit Message:
GRAPHICS: MACGUI: Further work on 32bpp blitting

Changed paths:
    graphics/macgui/mactext.cpp
    graphics/macgui/macwindowmanager.cpp
    graphics/macgui/macwindowmanager.h


diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 105ee9f3f7..bbacaa1b08 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -238,9 +238,9 @@ void MacText::init() {
 
 	_cursorRect = new Common::Rect(0, 0, 1, 0);
 
-	_cursorSurface = new ManagedSurface(1, kCursorMaxHeight);
+	_cursorSurface = new ManagedSurface(1, kCursorMaxHeight, _wm->_pixelformat);
 	_cursorSurface->clear(_wm->_colorBlack);
-	_cursorSurface2 = new ManagedSurface(1, kCursorMaxHeight);
+	_cursorSurface2 = new ManagedSurface(1, kCursorMaxHeight, _wm->_pixelformat);
 	_cursorSurface2->clear(_bgcolor);
 
 	reallocSurface();
@@ -510,14 +510,14 @@ void MacText::reallocSurface() {
 	//int requiredH = (_text.size() + (_text.size() * 10 + 9) / 10) * lineH
 
 	if (!_surface) {
-		_surface = new ManagedSurface(_textMaxWidth, _textMaxHeight);
+		_surface = new ManagedSurface(_textMaxWidth, _textMaxHeight, _wm->_pixelformat);
 
 		return;
 	}
 
 	if (_surface->w < _textMaxWidth || _surface->h < _textMaxHeight) {
 		// realloc surface and copy old content
-		ManagedSurface *n = new ManagedSurface(_textMaxWidth, _textMaxHeight);
+		ManagedSurface *n = new ManagedSurface(_textMaxWidth, _textMaxHeight, _wm->_pixelformat);
 		n->clear(_bgcolor);
 		n->blitFrom(*_surface, Common::Point(0, 0));
 
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 75ffe41aba..950f016f8a 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -943,6 +943,9 @@ uint MacWindowManager::findBestColor(byte cr, byte cg, byte cb) {
 	uint bestColor = 0;
 	double min = 0xFFFFFFFF;
 
+	if (_pixelformat.bytesPerPixel == 24)
+		return cr << 24 | cg << 16 | cb << 8 | 0xff;
+
 	uint32 color = cr << 16 | cg << 8 | cb;
 
 	if (_colorHash.contains(color))
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index fff19ffe76..f6f84f7e52 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -316,7 +316,7 @@ public:
 	bool _menuTimerActive;
 	bool _mouseDown;
 
-	int _colorBlack, _colorGray80, _colorGray88, _colorGrayEE, _colorWhite, _colorGreen, _colorGreen2;
+	uint32 _colorBlack, _colorGray80, _colorGray88, _colorGrayEE, _colorWhite, _colorGreen, _colorGreen2;
 
 	MacWidget *_hoveredWidget;
 




More information about the Scummvm-git-logs mailing list