[Scummvm-git-logs] scummvm master -> 3469ed858c47a8a0ce3c1eb192d2a494bdf5ba02

npjg nathanael.gentrydb8 at gmail.com
Mon Jun 29 14:09:28 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:
8e2be0ceb3 GRAPHICS: MACGUI: MacWidget: Accept colours in constructor
2643e2f957 GRAPHICS: MACGUI: MacWindowManager: Optionally set custom patterns
3469ed858c GRAPHICS: MACGUI: Add QuickDraw class


Commit: 8e2be0ceb37e902e1b401512b3a98fa4aeacc2df
    https://github.com/scummvm/scummvm/commit/8e2be0ceb37e902e1b401512b3a98fa4aeacc2df
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-06-29T08:49:18-04:00

Commit Message:
GRAPHICS: MACGUI: MacWidget: Accept colours in constructor

Changed paths:
    graphics/macgui/macwidget.cpp
    graphics/macgui/macwidget.h


diff --git a/graphics/macgui/macwidget.cpp b/graphics/macgui/macwidget.cpp
index 8ba11a913d..75bbeedb8d 100644
--- a/graphics/macgui/macwidget.cpp
+++ b/graphics/macgui/macwidget.cpp
@@ -27,7 +27,7 @@
 
 namespace Graphics {
 
-MacWidget::MacWidget(MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, bool focusable, uint16 border, uint16 gutter, uint16 shadow) :
+MacWidget::MacWidget(MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, bool focusable, uint16 border, uint16 gutter, uint16 shadow, uint fgcolor, uint bgcolor) :
 	_focusable(focusable), _parent(parent), _border(border), _gutter(gutter), _shadow(shadow), _wm(wm) {
 	_contentIsDirty = true;
 	_priority = 0;
@@ -37,8 +37,8 @@ MacWidget::MacWidget(MacWidget *parent, int x, int y, int w, int h, MacWindowMan
 	_dims.top = y;
 	_dims.bottom = y + h + (2 * border) + gutter + shadow;
 
-	_fgcolor = 0xff;
-	_bgcolor = 0;
+	_fgcolor = fgcolor;
+	_bgcolor = bgcolor;
 
 	if (parent)
 		parent->_children.push_back(this);
diff --git a/graphics/macgui/macwidget.h b/graphics/macgui/macwidget.h
index 7b565c43ef..e93c47fb74 100644
--- a/graphics/macgui/macwidget.h
+++ b/graphics/macgui/macwidget.h
@@ -40,7 +40,7 @@ class MacWindowManager;
 class MacWidget {
 
 public:
-	MacWidget(MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, bool focusable, uint16 border = 0, uint16 gutter = 0, uint16 shadow = 0);
+	MacWidget(MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, bool focusable, uint16 border = 0, uint16 gutter = 0, uint16 shadow = 0, uint fgcolor = 0, uint bgcolor= 0xff);
 	virtual ~MacWidget();
 
 	/**


Commit: 2643e2f95797aadc4e65bdb4899bdc3e9711a510
    https://github.com/scummvm/scummvm/commit/2643e2f95797aadc4e65bdb4899bdc3e9711a510
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-06-29T09:07:05-04:00

Commit Message:
GRAPHICS: MACGUI: MacWindowManager: Optionally set custom patterns

The Director engine, which uses custom patterns, is also updated.

Changed paths:
    engines/director/director.cpp
    graphics/macgui/macwindowmanager.cpp
    graphics/macgui/macwindowmanager.h


diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 78cdf45b5e..169ec2d9e8 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -142,7 +142,7 @@ Common::Error DirectorEngine::run() {
 	_macBinary = nullptr;
 	_soundManager = nullptr;
 
-	_wm = new Graphics::MacWindowManager(wmMode);
+	_wm = new Graphics::MacWindowManager(wmMode, &_director3QuickDrawPatterns);
 	_wm->setEngine(this);
 
 	_lingo = new Lingo(this);
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 116b8d6581..7d39ce57dc 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -151,7 +151,7 @@ static const byte macCursorCrossBar[] = {
 
 static void menuTimerHandler(void *refCon);
 
-MacWindowManager::MacWindowManager(uint32 mode) {
+MacWindowManager::MacWindowManager(uint32 mode, MacPatterns *patterns) {
 	_screen = 0;
 	_screenCopy = nullptr;
 	_lastId = 0;
@@ -181,8 +181,12 @@ MacWindowManager::MacWindowManager(uint32 mode) {
 	_palette = nullptr;
 	_paletteSize = 0;
 
-	for (int i = 0; i < ARRAYSIZE(fillPatterns); i++)
-		_patterns.push_back(fillPatterns[i]);
+	if (patterns) {
+		_patterns = *patterns;
+	} else {
+		for (int i = 0; i < ARRAYSIZE(fillPatterns); i++)
+			_patterns.push_back(fillPatterns[i]);
+	}
 
 	g_system->getPaletteManager()->setPalette(palette, 0, ARRAYSIZE(palette) / 3);
 
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index 73f42fa263..12ba4b004b 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -122,7 +122,7 @@ void macInvertPixel(int x, int y, int color, void *data);
  */
 class MacWindowManager {
 public:
-	MacWindowManager(uint32 mode = 0);
+	MacWindowManager(uint32 mode = 0, MacPatterns *patterns = nullptr);
 	~MacWindowManager();
 
 	/**


Commit: 3469ed858c47a8a0ce3c1eb192d2a494bdf5ba02
    https://github.com/scummvm/scummvm/commit/3469ed858c47a8a0ce3c1eb192d2a494bdf5ba02
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-06-29T10:03:12-04:00

Commit Message:
GRAPHICS: MACGUI: Add QuickDraw class

Changed paths:
  A graphics/macgui/macshape.cpp
  A graphics/macgui/macshape.h
    graphics/module.mk


diff --git a/graphics/macgui/macshape.cpp b/graphics/macgui/macshape.cpp
new file mode 100644
index 0000000000..ad74fba90d
--- /dev/null
+++ b/graphics/macgui/macshape.cpp
@@ -0,0 +1,87 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "graphics/macgui/macwindowmanager.h"
+#include "graphics/macgui/macshape.h"
+#include "graphics/primitives.h"
+
+namespace Graphics {
+
+MacShape::MacShape(MacShapeType shapeType, MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, uint fgcolor, uint bgcolor, uint thickness, uint fillType) : _shapeType(shapeType), _thickness(thickness), _fillType(fillType), MacWidget(parent, x, y, w, h, wm, false, 0, 0, 0, fgcolor, bgcolor) {
+		_contentIsDirty = true;
+		render();
+	}
+
+void MacShape::setStyle(MacShapeType shapeType, uint fgcolor, uint bgcolor, uint thickness, uint fillType) {
+	_contentIsDirty = true;
+
+	_shapeType = shapeType;
+	_fgcolor = fgcolor;
+	_bgcolor = bgcolor;
+	_thickness = thickness;
+	_fillType = fillType;
+}
+
+void MacShape::render() {
+	if (!_contentIsDirty)
+		return;
+
+	_maskSurface->clear(0);
+	_composeSurface->clear(_bgcolor);
+
+	Common::Rect fillRect((int)_dims.width(), (int)_dims.height());
+	Graphics::MacPlotData plotFill(_composeSurface, _maskSurface, &_wm->getPatterns(), _fillType, -_dims.left, -_dims.top, 1, _bgcolor);
+
+	Common::Rect strokeRect(MAX((int)_dims.width() - _thickness, 0), MAX((int)_dims.height() - _thickness, 0));
+	Graphics::MacPlotData plotStroke(_composeSurface, _maskSurface, &_wm->getPatterns(), 1, -_dims.left, -_dims.top, _thickness, _bgcolor);
+
+	switch (_shapeType) {
+	case kShapeRectangle:
+		if (_fillType)
+			Graphics::drawFilledRect(fillRect, _fgcolor, Graphics::macDrawPixel, &plotFill);
+
+		Graphics::drawRect(strokeRect, _fgcolor, Graphics::macDrawPixel, &plotStroke);
+		break;
+
+	case kShapeRoundRect:
+		if (_fillType)
+			Graphics::drawRoundRect(fillRect, 12, _fgcolor, true, Graphics::macDrawPixel, &plotFill);
+
+		Graphics::drawRoundRect(strokeRect, 12, _fgcolor, false, Graphics::macDrawPixel, &plotStroke);
+		break;
+
+	case kShapeOval:
+		if (_fillType)
+			Graphics::drawEllipse(fillRect.left, fillRect.top, fillRect.right, fillRect.bottom, _fgcolor, true, Graphics::macDrawPixel, &plotFill);
+
+		Graphics::drawEllipse(strokeRect.left, strokeRect.top, strokeRect.right, strokeRect.bottom, _fgcolor, false, Graphics::macDrawPixel, &plotStroke);
+		break;
+
+	case kShapeLine:
+		warning("MacShape::render(): Line drawing not yet implemented");
+		break;
+	}
+
+	_contentIsDirty = true;
+}
+
+} // end of namespace Graphics
diff --git a/graphics/macgui/macshape.h b/graphics/macgui/macshape.h
new file mode 100644
index 0000000000..a47d69a99d
--- /dev/null
+++ b/graphics/macgui/macshape.h
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GRAPHICS_MACGUI_MACSHAPE_H
+#define GRAPHICS_MACGUI_MACSHAPE_H
+
+#include "graphics/macgui/macwidget.h"
+
+namespace Graphics {
+
+enum MacShapeType {
+	kShapeRectangle,
+	kShapeRoundRect,
+	kShapeOval,
+	kShapeLine
+};
+
+class MacShape : public MacWidget {
+public:
+	MacShape(MacShapeType shapeType, MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, uint fgcolor, uint bgcolor, uint thickness, uint fillType);
+
+	void setStyle(MacShapeType shapeType, uint fgcolor, uint bgcolor, uint thickness, uint fillType);
+	void render();
+
+private:
+	MacShapeType _shapeType;
+	int _thickness;
+	uint _fillType;
+};
+
+} // end of namespace Graphics
+
+#endif
diff --git a/graphics/module.mk b/graphics/module.mk
index 142a2aab21..4a8ba148a7 100644
--- a/graphics/module.mk
+++ b/graphics/module.mk
@@ -19,6 +19,7 @@ MODULE_OBJS := \
 	macgui/macmenu.o \
 	macgui/mactext.o \
 	macgui/mactextwindow.o \
+	macgui/macshape.o \
 	macgui/macwidget.o \
 	macgui/macwindow.o \
 	macgui/macwindowborder.o \




More information about the Scummvm-git-logs mailing list