[Scummvm-git-logs] scummvm master -> 229c1a233f2c1701d5526e7f0b628e898635fbe8

npjg nathanael.gentrydb8 at gmail.com
Wed Jul 15 16:45:07 UTC 2020


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:
d770b21094 GRAPHICS: MACGUI: Remove macInvertPixel callback
521dd64412 DIRECTOR: Only warn on large bitmap cast leftovers
229c1a233f DIRECTOR: Initialize channel with sprite dimensions


Commit: d770b21094e65f3e4a6221905eed844c18bde348
    https://github.com/scummvm/scummvm/commit/d770b21094e65f3e4a6221905eed844c18bde348
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-15T11:50:57-04:00

Commit Message:
GRAPHICS: MACGUI: Remove macInvertPixel callback

Instead, the addition to macDrawPixel is used instead.

Changed paths:
    graphics/macgui/macbutton.cpp
    graphics/macgui/macbutton.h
    graphics/macgui/macwindow.cpp
    graphics/macgui/macwindowmanager.cpp
    graphics/macgui/macwindowmanager.h


diff --git a/graphics/macgui/macbutton.cpp b/graphics/macgui/macbutton.cpp
index 33cc489a0d..1b6d67a5d6 100644
--- a/graphics/macgui/macbutton.cpp
+++ b/graphics/macgui/macbutton.cpp
@@ -34,7 +34,7 @@
 namespace Graphics {
 
 MacButton::MacButton(MacButtonType buttonType, TextAlign textAlignment, MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, const Common::U32String &s, const MacFont *macFont, int fgcolor, int bgcolor) :
-	MacText(parent, x, y, w, h, wm, s, macFont, fgcolor, bgcolor, w, textAlignment) {
+	MacText(parent, x, y, w, h, wm, s, macFont, fgcolor, bgcolor, w, textAlignment), _pd(Graphics::MacPlotData(_composeSurface, nullptr, &_wm->getPatterns(), 1, 0, 0, 1, 0, true)) {
 
 	_buttonType = buttonType;
 
@@ -74,14 +74,14 @@ void MacButton::invertOuter() {
 	switch (_buttonType) {
 	case kCheckBox: {
 		Common::Rect c = Common::Rect(r.left + 1, r.top + 3, r.left + 9, r.top + 11);
-		Graphics::drawRect(c, 0, Graphics::macInvertPixel, _composeSurface);
+		Graphics::drawRect(c, 0, Graphics::macDrawPixel, &_pd);
 	}
 		break;
 	case kRound:
-		Graphics::drawRoundRect(r, 4, 0, true, Graphics::macInvertPixel, _composeSurface);
+		Graphics::drawRoundRect(r, 4, 0, true, Graphics::macDrawPixel, &_pd);
 		break;
 	case kRadio:
-		Graphics::drawEllipse(r.left + 1, r.top + 3, r.left + 10, r.top + 12, 0, false, Graphics::macInvertPixel, _composeSurface);
+		Graphics::drawEllipse(r.left + 1, r.top + 3, r.left + 10, r.top + 12, 0, false, Graphics::macDrawPixel, &_pd);
 		break;
 	}
 
@@ -93,14 +93,14 @@ void MacButton::invertInner() {
 
 	switch (_buttonType) {
 	case kCheckBox:
-		Graphics::drawLine(r.left + 1, r.top + 3, r.left + 9, r.top + 11, 0, Graphics::macInvertPixel, _composeSurface);
-		Graphics::drawLine(r.left + 1, r.top + 11, r.left + 9, r.top + 3, 0, Graphics::macInvertPixel, _composeSurface);
-		Graphics::macInvertPixel(5, 7, 0, _composeSurface);
+		Graphics::drawLine(r.left + 1, r.top + 3, r.left + 9, r.top + 11, 0, Graphics::macDrawPixel, &_pd);
+		Graphics::drawLine(r.left + 1, r.top + 11, r.left + 9, r.top + 3, 0, Graphics::macDrawPixel, &_pd);
+		Graphics::macDrawPixel(5, 7, 0, &_pd);
 		break;
 	case kRound:
 		break;
 	case kRadio:
-		Graphics::drawEllipse(r.left + 3, r.top + 5, r.left + 8, r.top + 10, 0, true, Graphics::macInvertPixel, _composeSurface);
+		Graphics::drawEllipse(r.left + 3, r.top + 5, r.left + 8, r.top + 10, 0, true, Graphics::macDrawPixel, &_pd);
 		break;
 	}
 
diff --git a/graphics/macgui/macbutton.h b/graphics/macgui/macbutton.h
index 7f1cccc4c5..4588213792 100644
--- a/graphics/macgui/macbutton.h
+++ b/graphics/macgui/macbutton.h
@@ -30,6 +30,7 @@ namespace Graphics {
 
 class MacWidget;
 class MacText;
+class MacPlotData;
 
 enum MacButtonType {
 	kRound,
@@ -52,6 +53,7 @@ public:
 
 private:
 	MacButtonType _buttonType;
+	MacPlotData _pd;
 };
 
 } // End of namespace Graphics
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index 91109aada3..4fb6148944 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -310,7 +310,8 @@ void MacWindow::drawSimpleBorder(ManagedSurface *g) {
 				int ry2 = ry1 + _dims.height() * _scrollSize;
 				Common::Rect rr(rx1, ry1, rx2, ry2);
 
-				Graphics::drawFilledRect(rr, _wm->_colorBlack, Graphics::macInvertPixel, g);
+				MacPlotData pd(g, nullptr,  &_wm->getPatterns(), 1, 0, 0, 1, _wm->_colorBlack, true);
+				Graphics::drawFilledRect(rr, _wm->_colorBlack, Graphics::macDrawPixel, &pd);
 			}
 		}
 		if (closeable) {
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index d5f69646b0..2bb51239c0 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -348,9 +348,8 @@ void macDrawPixel(int x, int y, int color, void *data) {
 			uint xu = (uint)x; // for letting compiler optimize it
 			uint yu = (uint)y;
 
-			*((byte *)p->surface->getBasePtr(xu, yu)) =
-				(pat[(yu - p->fillOriginY) % 8] & (1 << (7 - (xu - p->fillOriginX) % 8))) ?
-				color : (p->invert ? 255 - *((byte *)p->surface->getBasePtr(xu, yu)) : p->bgColor);
+			*((byte *)p->surface->getBasePtr(xu, yu)) = p->invert ? ~(*((byte *)p->surface->getBasePtr(xu, yu))) :
+				(pat[(yu - p->fillOriginY) % 8] & (1 << (7 - (xu - p->fillOriginX) % 8))) ? color : p->bgColor;
 
 			if (p->mask)
 				*((byte *)p->mask->getBasePtr(xu, yu)) = 0xff;
@@ -366,9 +365,8 @@ void macDrawPixel(int x, int y, int color, void *data) {
 				if (x >= 0 && x < p->surface->w && y >= 0 && y < p->surface->h) {
 					uint xu = (uint)x; // for letting compiler optimize it
 					uint yu = (uint)y;
-					*((byte *)p->surface->getBasePtr(xu, yu)) =
-						(pat[(yu - p->fillOriginY) % 8] & (1 << (7 - (xu - p->fillOriginX) % 8))) ?
-						color : (p->invert ? 255 - *((byte *)p->surface->getBasePtr(xu, yu)) : p->bgColor);
+					*((byte *)p->surface->getBasePtr(xu, yu)) = p->invert ? ~(*((byte *)p->surface->getBasePtr(xu, yu))) :
+						(pat[(yu - p->fillOriginY) % 8] & (1 << (7 - (xu - p->fillOriginX) % 8))) ? color : p->bgColor;
 
 					if (p->mask)
 						*((byte *)p->mask->getBasePtr(xu, yu)) = 0xff;
@@ -376,17 +374,6 @@ void macDrawPixel(int x, int y, int color, void *data) {
 	}
 }
 
-void macInvertPixel(int x, int y, int color, void *data) {
-	// Argument color is unused; we just invert the colors as they are in the surface.
-	Graphics::ManagedSurface *surface = (Graphics::ManagedSurface *)data;
-
-	if (x >= 0 && x < surface->w && y >= 0 && y < surface->h) {
-		byte *p = (byte *)surface->getBasePtr(x, y);
-
-		*p = abs(255 - *p);
-	}
-}
-
 void MacWindowManager::drawDesktop() {
 	Common::Rect r(_screen->getBounds());
 
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index d059c8bc7b..2c6b826aa2 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -114,7 +114,6 @@ struct ZoomBox {
 };
 
 void macDrawPixel(int x, int y, int color, void *data);
-void macInvertPixel(int x, int y, int color, void *data);
 
 /**
  * A manager class to handle window creation, destruction,


Commit: 521dd644126856397451f86b70297789c2bff224
    https://github.com/scummvm/scummvm/commit/521dd644126856397451f86b70297789c2bff224
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-15T11:50:57-04:00

Commit Message:
DIRECTOR: Only warn on large bitmap cast leftovers

Changed paths:
    engines/director/castmember.cpp


diff --git a/engines/director/castmember.cpp b/engines/director/castmember.cpp
index 58f26c0e32..376fc28bbb 100644
--- a/engines/director/castmember.cpp
+++ b/engines/director/castmember.cpp
@@ -118,7 +118,9 @@ BitmapCastMember::BitmapCastMember(Cast *cast, uint16 castId, Common::ReadStream
 			tail++;
 		}
 
-		warning("BitmapCastMember: %d bytes left", tail);
+		if (tail > 8) {
+			warning("BitmapCastMember: %d bytes left", tail);
+		}
 	} else if (version == 5) {
 		uint16 count = stream.readUint16();
 		for (uint16 cc = 0; cc < count; cc++)


Commit: 229c1a233f2c1701d5526e7f0b628e898635fbe8
    https://github.com/scummvm/scummvm/commit/229c1a233f2c1701d5526e7f0b628e898635fbe8
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-15T11:50:57-04:00

Commit Message:
DIRECTOR: Initialize channel with sprite dimensions

Changed paths:
    engines/director/channel.cpp


diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index 4d90ca46c1..9e5152845f 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -37,8 +37,8 @@ Channel::Channel(Sprite *sp) {
 	_delta = Common::Point(0, 0);
 	_constraint = 0;
 
-	_width = 0;
-	_height = 0;
+	_width = _sprite->_width;
+	_height = _sprite->_height;
 
 	_visible = true;
 	_dirty = true;




More information about the Scummvm-git-logs mailing list