[Scummvm-cvs-logs] scummvm master -> 357c64cd514c16109377aaaec19a76886809a515

sev- sev at scummvm.org
Sun Apr 24 13:51:35 CEST 2016


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:
357c64cd51 WAGE: Move desktop drawing to WM


Commit: 357c64cd514c16109377aaaec19a76886809a515
    https://github.com/scummvm/scummvm/commit/357c64cd514c16109377aaaec19a76886809a515
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-24T13:51:17+02:00

Commit Message:
WAGE: Move desktop drawing to WM

Changed paths:
    engines/wage/gui.cpp
    engines/wage/gui.h
    engines/wage/macwindow.cpp
    engines/wage/macwindowmanager.cpp
    engines/wage/macwindowmanager.h



diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 09eeb0f..50dadc8 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -73,7 +73,6 @@ static const byte palette[] = {
 
 static byte fillPatterns[][8] = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, // kPatternSolid
 								  { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 }, // kPatternStripes
-								  { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 }, // kPatternCheckers
 								  { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa }  // kPatternCheckers2
 };
 
@@ -231,17 +230,11 @@ const Graphics::Font *Gui::getTitleFont() {
 	return getFont("Chicago-12", Graphics::FontManager::kBigGUIFont);
 }
 
-void Gui::drawDesktop() {
-	// Draw desktop
-	Common::Rect r(0, 0, _screen.w - 1, _screen.h - 1);
-	Design::drawFilledRoundRect(&_screen, r, kDesktopArc, kColorBlack, _patterns, kPatternCheckers);
-	g_system->copyRectToScreen(_screen.getPixels(), _screen.pitch, 0, 0, _screen.w, _screen.h);
-}
-
 void Gui::draw() {
 	if (_engine->_isGameOver) {
 		if (_menuDirty) {
-			drawDesktop();
+			_wm.setFullRefresh(true);
+			_wm.draw();
 			_menu->render();
 		}
 
@@ -260,13 +253,8 @@ void Gui::draw() {
 
 		_sceneWindow->setDimensions(*_scene->_designBounds);
 		_sceneWindow->setTitle(_scene->_name);
-		_sceneWindow->setDirty(true);
 		_consoleWindow->setDimensions(*_scene->_textBounds);
-		_consoleWindow->setDirty(true);
-	}
 
-	if (_sceneDirty) {
-		drawDesktop();
 		_wm.setFullRefresh(true);
 	}
 
@@ -370,7 +358,7 @@ bool Gui::processConsoleEvents(WindowClick click, Common::Event &event) {
 				undrawCursor();
 				_cursorY -= (_scrollPos - oldScrollPos);
 				_consoleDirty = true;
-					_consoleFullRedraw = true;
+				_consoleFullRedraw = true;
 				break;
 			case kBorderScrollDown:
 				_scrollPos = MIN<int>((_lines.size() - 2) * _consoleLineHeight, _scrollPos + _consoleLineHeight);
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index 8a81982..2feb259 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -78,8 +78,7 @@ enum {
 enum {
 	kPatternSolid = 1,
 	kPatternStripes = 2,
-	kPatternCheckers = 3,
-	kPatternCheckers2 = 4
+	kPatternCheckers2 = 3
 };
 
 class Gui {
@@ -117,11 +116,12 @@ public:
 	bool processSceneEvents(WindowClick click, Common::Event &event);
 	bool processConsoleEvents(WindowClick click, Common::Event &event);
 
+	Patterns &getPatterns() { return _patterns; }
+
 private:
 	void drawScene();
 	void drawConsole();
 	void undrawCursor();
-	void drawDesktop();
 	void renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r);
 	void loadFonts();
 	void flowText(Common::String &str);
diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index 034a52e..076584c 100644
--- a/engines/wage/macwindow.cpp
+++ b/engines/wage/macwindow.cpp
@@ -116,6 +116,8 @@ void MacWindow::setDimensions(const Common::Rect &r) {
 	resize(r.width(), r.height());
 	_dims.moveTo(r.left, r.top);
 	updateInnerDims();
+
+	_contentIsDirty = true;
 }
 
 bool MacWindow::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
diff --git a/engines/wage/macwindowmanager.cpp b/engines/wage/macwindowmanager.cpp
index 8625e86..7985f5b 100644
--- a/engines/wage/macwindowmanager.cpp
+++ b/engines/wage/macwindowmanager.cpp
@@ -53,17 +53,30 @@
 #include "graphics/managed_surface.h"
 
 #include "wage/wage.h"
+#include "wage/design.h"
+#include "wage/gui.h"
 #include "wage/macwindow.h"
 #include "wage/macwindowmanager.h"
 
 namespace Wage {
 
+enum {
+	kPatternCheckers = 1
+};
+
+static byte fillPatterns[][8] = { { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 } // kPatternCheckers
+};
+
+
 MacWindowManager::MacWindowManager() {
     _screen = 0;
     _lastId = 0;
     _activeWindow = -1;
 
 	_fullRefresh = true;
+
+	for (int i = 0; i < ARRAYSIZE(fillPatterns); i++)
+		_patterns.push_back(fillPatterns[i]);
 }
 
 MacWindowManager::~MacWindowManager() {
@@ -104,6 +117,9 @@ void MacWindowManager::setActive(int id) {
 void MacWindowManager::draw() {
     assert(_screen);
 
+	if (_fullRefresh)
+		drawDesktop();
+
     for (Common::List<MacWindow *>::const_iterator it = _windowStack.begin(); it != _windowStack.end(); it++) {
         MacWindow *w = *it;
         if (w->draw(_screen, _fullRefresh)) {
@@ -119,6 +135,13 @@ void MacWindowManager::draw() {
     _fullRefresh = false;
 }
 
+void MacWindowManager::drawDesktop() {
+	Common::Rect r(_screen->getBounds());
+
+	Design::drawFilledRoundRect(_screen, r, kDesktopArc, kColorBlack, _patterns, kPatternCheckers);
+	g_system->copyRectToScreen(_screen->getPixels(), _screen->pitch, 0, 0, _screen->w, _screen->h);
+}
+
 bool MacWindowManager::processEvent(Common::Event &event) {
     if (event.type != Common::EVENT_MOUSEMOVE && event.type != Common::EVENT_LBUTTONDOWN &&
             event.type != Common::EVENT_LBUTTONUP)
diff --git a/engines/wage/macwindowmanager.h b/engines/wage/macwindowmanager.h
index 1e8b24b..5efd0f4 100644
--- a/engines/wage/macwindowmanager.h
+++ b/engines/wage/macwindowmanager.h
@@ -71,6 +71,9 @@ public:
 	MacWindow *getWindow(int id) { return _windows[id]; }
 
 private:
+	void drawDesktop();
+
+private:
 	Graphics::ManagedSurface *_screen;
 
 	Common::List<MacWindow *> _windowStack;
@@ -80,6 +83,8 @@ private:
 	int _activeWindow;
 
 	bool _fullRefresh;
+
+	Patterns _patterns;
 };
 
 } // End of namespace Wage






More information about the Scummvm-git-logs mailing list