[Scummvm-cvs-logs] scummvm master -> 43d49e68b2bdf9e45fdf7542272c013ee2e3fde7

sev- sev at scummvm.org
Fri Apr 15 17:24:28 CEST 2016


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

Summary:
00399d27db WAGE: Switch to ManagedSurface
0e4c846a39 WAGE: Benefit from ManagedSurface methods
6a415da6b9 WAGE: Started screen composing
cb06c712c7 WAGE: Fix border clipping
cdb4fc1fbf WAGE: Simplify border drawing
78dc8be3dc WAGE: Fix window composing offset
6ae1e5cc7a WAGE: Fix window title drawing
78567a3c1d WAGE: Fix border blitting
43d49e68b2 WAGE: Draw console via MacWindow


Commit: 00399d27dbe3466b4734345bfb4879c056465f80
    https://github.com/scummvm/scummvm/commit/00399d27dbe3466b4734345bfb4879c056465f80
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-15T17:24:14+02:00

Commit Message:
WAGE: Switch to ManagedSurface

Changed paths:
    engines/wage/design.cpp
    engines/wage/design.h
    engines/wage/dialog.h
    engines/wage/entities.cpp
    engines/wage/entities.h
    engines/wage/gui-console.cpp
    engines/wage/gui.cpp
    engines/wage/gui.h
    engines/wage/macwindow.cpp
    engines/wage/macwindow.h
    engines/wage/macwindowmanager.cpp
    engines/wage/macwindowmanager.h
    engines/wage/menu.cpp
    engines/wage/menu.h



diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 907a1ec..a697b89 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -52,13 +52,13 @@
 namespace Wage {
 
 struct PlotData {
-	Graphics::Surface *surface;
+	Graphics::ManagedSurface *surface;
 	Patterns *patterns;
 	uint fillType;
 	int thickness;
 	Design *design;
 
-	PlotData(Graphics::Surface *s, Patterns *p, int f, int t, Design *d) :
+	PlotData(Graphics::ManagedSurface *s, Patterns *p, int f, int t, Design *d) :
 		surface(s), patterns(p), fillType(f), thickness(t), design(d) {}
 };
 
@@ -83,7 +83,7 @@ Design::~Design() {
 	delete _surface;
 }
 
-void Design::paint(Graphics::Surface *surface, Patterns &patterns, int x, int y) {
+void Design::paint(Graphics::ManagedSurface *surface, Patterns &patterns, int x, int y) {
 	bool needRender = false;
 
 	if (_surface == NULL) {
@@ -96,7 +96,7 @@ void Design::paint(Graphics::Surface *surface, Patterns &patterns, int x, int y)
 		}
 		_bounds->debugPrint(4, "Calculated bounds:");
 
-		_surface = new Graphics::Surface;
+		_surface = new Graphics::ManagedSurface;
 		_surface->create(_bounds->width(), _bounds->height(), Graphics::PixelFormat::createFormatCLUT8());
 
 		Common::Rect r(0, 0, _bounds->width(), _bounds->height());
@@ -269,7 +269,7 @@ void drawPixelPlain(int x, int y, int color, void *data) {
 		*((byte *)p->surface->getBasePtr(x, y)) = (byte)color;
 }
 
-void Design::drawRect(Graphics::Surface *surface, Common::ReadStream &in,
+void Design::drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
 				Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
 	int16 y1 = in.readSint16BE();
 	int16 x1 = in.readSint16BE();
@@ -298,7 +298,7 @@ void Design::drawRect(Graphics::Surface *surface, Common::ReadStream &in,
 	}
 }
 
-void Design::drawRoundRect(Graphics::Surface *surface, Common::ReadStream &in,
+void Design::drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
 				Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
 	int16 y1 = in.readSint16BE();
 	int16 x1 = in.readSint16BE();
@@ -324,7 +324,7 @@ void Design::drawRoundRect(Graphics::Surface *surface, Common::ReadStream &in,
 		Graphics::drawRoundRect(r, arc / 2, kColorBlack, false, drawPixel, &pd);
 }
 
-void Design::drawPolygon(Graphics::Surface *surface, Common::ReadStream &in,
+void Design::drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream &in,
 	Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
 
 	byte ignored = in.readSint16BE(); // ignored
@@ -401,7 +401,7 @@ void Design::drawPolygon(Graphics::Surface *surface, Common::ReadStream &in,
 	free(ypoints);
 }
 
-void Design::drawOval(Graphics::Surface *surface, Common::ReadStream &in,
+void Design::drawOval(Graphics::ManagedSurface *surface, Common::ReadStream &in,
 			Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
 	int16 y1 = in.readSint16BE();
 	int16 x1 = in.readSint16BE();
@@ -419,7 +419,7 @@ void Design::drawOval(Graphics::Surface *surface, Common::ReadStream &in,
 		Graphics::drawEllipse(x1, y1, x2-1, y2-1, kColorBlack, false, drawPixel, &pd);
 }
 
-void Design::drawBitmap(Graphics::Surface *surface, Common::SeekableReadStream &in) {
+void Design::drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadStream &in) {
 	int numBytes = in.readSint16BE();
 	int y1 = in.readSint16BE();
 	int x1 = in.readSint16BE();
@@ -427,7 +427,7 @@ void Design::drawBitmap(Graphics::Surface *surface, Common::SeekableReadStream &
 	int x2 = in.readSint16BE();
 	int w = x2 - x1;
 	int h = y2 - y1;
-	Graphics::Surface tmp;
+	Graphics::ManagedSurface tmp;
 
 	tmp.create(w, h, Graphics::PixelFormat::createFormatCLUT8());
 
@@ -507,11 +507,11 @@ void Design::drawBitmap(Graphics::Surface *surface, Common::SeekableReadStream &
 	tmp.free();
 }
 
-void Design::drawRect(Graphics::Surface *surface, Common::Rect &rect, int thickness, int color, Patterns &patterns, byte fillType) {
+void Design::drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Patterns &patterns, byte fillType) {
 	drawRect(surface, rect.left, rect.top, rect.right, rect.bottom, thickness, color, patterns, fillType);
 }
 
-void Design::drawRect(Graphics::Surface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Patterns &patterns, byte fillType) {
+void Design::drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Patterns &patterns, byte fillType) {
 	PlotData pd(surface, &patterns, fillType, thickness, nullptr);
 
 	Graphics::drawLine(x1, y1, x2, y1, kColorBlack, drawPixel, &pd);
@@ -521,32 +521,32 @@ void Design::drawRect(Graphics::Surface *surface, int x1, int y1, int x2, int y2
 }
 
 
-void Design::drawFilledRect(Graphics::Surface *surface, Common::Rect &rect, int color, Patterns &patterns, byte fillType) {
+void Design::drawFilledRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int color, Patterns &patterns, byte fillType) {
 	PlotData pd(surface, &patterns, fillType, 1, nullptr);
 
 	for (int y = rect.top; y <= rect.bottom; y++)
 		Graphics::drawHLine(rect.left, rect.right, y, color, drawPixel, &pd);
 }
 
-void Design::drawFilledRoundRect(Graphics::Surface *surface, Common::Rect &rect, int arc, int color, Patterns &patterns, byte fillType) {
+void Design::drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color, Patterns &patterns, byte fillType) {
 	PlotData pd(surface, &patterns, fillType, 1, nullptr);
 
 	Graphics::drawRoundRect(rect, arc, color, true, drawPixel, &pd);
 }
 
-void Design::drawHLine(Graphics::Surface *surface, int x1, int x2, int y, int thickness, int color, Patterns &patterns, byte fillType) {
+void Design::drawHLine(Graphics::ManagedSurface *surface, int x1, int x2, int y, int thickness, int color, Patterns &patterns, byte fillType) {
 	PlotData pd(surface, &patterns, fillType, thickness, nullptr);
 
 	Graphics::drawHLine(x1, x2, y, color, drawPixel, &pd);
 }
 
-void Design::drawVLine(Graphics::Surface *surface, int x, int y1, int y2, int thickness, int color, Patterns &patterns, byte fillType) {
+void Design::drawVLine(Graphics::ManagedSurface *surface, int x, int y1, int y2, int thickness, int color, Patterns &patterns, byte fillType) {
 	PlotData pd(surface, &patterns, fillType, thickness, nullptr);
 
 	Graphics::drawVLine(x, y1, y2, color, drawPixel, &pd);
 }
 
-FloodFill::FloodFill(Graphics::Surface *surface, byte color1, byte color2) {
+FloodFill::FloodFill(Graphics::ManagedSurface *surface, byte color1, byte color2) {
 	_surface = surface;
 	_color1 = color1;
 	_color2 = color2;
diff --git a/engines/wage/design.h b/engines/wage/design.h
index e8f42f4..a6e0df4 100644
--- a/engines/wage/design.h
+++ b/engines/wage/design.h
@@ -48,7 +48,7 @@
 #ifndef WAGE_DESIGN_H
 #define WAGE_DESIGN_H
 
-#include "graphics/surface.h"
+#include "graphics/managed_surface.h"
 #include "common/memstream.h"
 #include "common/rect.h"
 
@@ -67,14 +67,14 @@ public:
 		return _bounds;
 	}
 
-    void paint(Graphics::Surface *canvas, Patterns &patterns, int x, int y);
+    void paint(Graphics::ManagedSurface *canvas, Patterns &patterns, int x, int y);
 	bool isPointOpaque(int x, int y);
-	static void drawRect(Graphics::Surface *surface, Common::Rect &rect, int thickness, int color, Patterns &patterns, byte fillType);
-	static void drawRect(Graphics::Surface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Patterns &patterns, byte fillType);
-	static void drawFilledRect(Graphics::Surface *surface, Common::Rect &rect, int color, Patterns &patterns, byte fillType);
-	static void drawFilledRoundRect(Graphics::Surface *surface, Common::Rect &rect, int arc, int color, Patterns &patterns, byte fillType);
-	static void drawHLine(Graphics::Surface *surface, int x1, int x2, int y, int thickness, int color, Patterns &patterns, byte fillType);
-	static void drawVLine(Graphics::Surface *surface, int x, int y1, int y2, int thickness, int color, Patterns &patterns, byte fillType);
+	static void drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Patterns &patterns, byte fillType);
+	static void drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Patterns &patterns, byte fillType);
+	static void drawFilledRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int color, Patterns &patterns, byte fillType);
+	static void drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color, Patterns &patterns, byte fillType);
+	static void drawHLine(Graphics::ManagedSurface *surface, int x1, int x2, int y, int thickness, int color, Patterns &patterns, byte fillType);
+	static void drawVLine(Graphics::ManagedSurface *surface, int x, int y1, int y2, int thickness, int color, Patterns &patterns, byte fillType);
 
 	bool isBoundsCalculation() { return _boundsCalculationMode; }
 	void adjustBounds(int16 x, int16 y);
@@ -83,32 +83,32 @@ private:
 	byte *_data;
 	int _len;
 	Common::Rect *_bounds;
-	Graphics::Surface *_surface;
+	Graphics::ManagedSurface *_surface;
 	bool _boundsCalculationMode;
 
 private:
 	void render(Patterns &patterns);
-	void drawRect(Graphics::Surface *surface, Common::ReadStream &in,
+	void drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
 		Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
-	void drawRoundRect(Graphics::Surface *surface, Common::ReadStream &in,
+	void drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
 		Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
-	void drawPolygon(Graphics::Surface *surface, Common::ReadStream &in,
+	void drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream &in,
 		Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
-	void drawOval(Graphics::Surface *surface, Common::ReadStream &in,
+	void drawOval(Graphics::ManagedSurface *surface, Common::ReadStream &in,
 		Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
-	void drawBitmap(Graphics::Surface *surface, Common::SeekableReadStream &in);
+	void drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadStream &in);
 };
 
 class FloodFill {
 public:
-	FloodFill(Graphics::Surface *surface, byte color1, byte color2);
+	FloodFill(Graphics::ManagedSurface *surface, byte color1, byte color2);
 	~FloodFill();
 	void addSeed(int x, int y);
 	void fill();
 
 private:
 	Common::List<Common::Point *> _queue;
-	Graphics::Surface *_surface;
+	Graphics::ManagedSurface *_surface;
 	byte _color1, _color2;
 	byte *_visited;
 	int _w, _h;
diff --git a/engines/wage/dialog.h b/engines/wage/dialog.h
index c5878ac..ec99fc0 100644
--- a/engines/wage/dialog.h
+++ b/engines/wage/dialog.h
@@ -74,7 +74,7 @@ public:
 
 private:
 	Gui *_gui;
-	Graphics::Surface _tempSurface;
+	Graphics::ManagedSurface _tempSurface;
 	Common::Rect _bbox;
 	Common::String _text;
 
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp
index adb0538..49e2592 100644
--- a/engines/wage/entities.cpp
+++ b/engines/wage/entities.cpp
@@ -134,7 +134,7 @@ Scene::~Scene() {
 	delete _textBounds;
 }
 
-void Scene::paint(Graphics::Surface *surface, int x, int y) {
+void Scene::paint(Graphics::ManagedSurface *surface, int x, int y) {
 	Common::Rect r(x + 5, y + 5, _design->getBounds()->width() + x - 10, _design->getBounds()->height() + y - 10);
 	surface->fillRect(r, kColorWhite);
 
diff --git a/engines/wage/entities.h b/engines/wage/entities.h
index 33cf087..c393f15 100644
--- a/engines/wage/entities.h
+++ b/engines/wage/entities.h
@@ -49,7 +49,7 @@
 #define WAGE_ENTITIES_H
 
 namespace Graphics {
-	struct Surface;
+	class ManagedSurface;
 }
 
 namespace Wage {
@@ -326,7 +326,7 @@ public:
 		return _textBounds == NULL ? NULL : new Common::Rect(*_textBounds);
 	}
 
-	void paint(Graphics::Surface *screen, int x, int y);
+	void paint(Graphics::ManagedSurface *screen, int x, int y);
 
 	const char *getFontName();
 };
diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp
index ab5df63..3a3f189 100644
--- a/engines/wage/gui-console.cpp
+++ b/engines/wage/gui-console.cpp
@@ -142,7 +142,7 @@ void Gui::flowText(Common::String &str) {
 		draw();
 }
 
-void Gui::renderConsole(Graphics::Surface *g, Common::Rect &r) {
+void Gui::renderConsole(Graphics::ManagedSurface *g, Common::Rect &r) {
 	bool fullRedraw = _consoleFullRedraw;
 	bool textReflow = false;
 	int surfW = r.width() + kConWOverlap * 2;
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 50b8b00..8d605fe 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -314,14 +314,14 @@ void Gui::drawConsole() {
 	paintBorder(&_screen, _consoleTextArea, kWindowConsole);
 }
 
-void Gui::drawBox(Graphics::Surface *g, int x, int y, int w, int h) {
+void Gui::drawBox(Graphics::ManagedSurface *g, int x, int y, int w, int h) {
 	Common::Rect r(x, y, x + w + 1, y + h + 1);
 
 	g->fillRect(r, kColorWhite);
 	g->frameRect(r, kColorBlack);
 }
 
-void Gui::fillRect(Graphics::Surface *g, int x, int y, int w, int h, int color) {
+void Gui::fillRect(Graphics::ManagedSurface *g, int x, int y, int w, int h, int color) {
 	Common::Rect r(x, y, x + w, y + h);
 
 	g->fillRect(r, color);
@@ -338,7 +338,7 @@ const int arrowPixels[ARROW_H][ARROW_W] = {
 		{1,1,1,1,1,1,1,1,1,1,1,1}};
 
 static void drawPixelInverted(int x, int y, int color, void *data) {
-	Graphics::Surface *surface = (Graphics::Surface *)data;
+	Graphics::ManagedSurface *surface = (Graphics::ManagedSurface *)data;
 
 	if (x >= 0 && x < surface->w && y >= 0 && y < surface->h) {
 		byte *p = (byte *)surface->getBasePtr(x, y);
@@ -347,7 +347,7 @@ static void drawPixelInverted(int x, int y, int color, void *data) {
 	}
 }
 
-void Gui::paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowType, int highlightedPart, float scrollPos, float scrollSize) {
+void Gui::paintBorder(Graphics::ManagedSurface *g, Common::Rect &r, WindowType windowType, int highlightedPart, float scrollPos, float scrollSize) {
 	bool active = false, scrollable = false, closeable = false, drawTitle = false;
 	const int size = kBorderWidth;
 	int x = r.left - size;
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index 11e001b..9d59e33 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -51,7 +51,7 @@
 #include "common/str-array.h"
 #include "graphics/font.h"
 #include "graphics/fontman.h"
-#include "graphics/surface.h"
+#include "graphics/managed_surface.h"
 #include "common/rect.h"
 
 #include "wage/macwindow.h"
@@ -117,11 +117,11 @@ private:
 	void drawConsole();
 	void undrawCursor();
 	void drawDesktop();
-	void paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowType, int highlightedPart = kBorderNone,
+	void paintBorder(Graphics::ManagedSurface *g, Common::Rect &r, WindowType windowType, int highlightedPart = kBorderNone,
 						float scrollPos = 0.0, float scrollSize = 0.0);
-	void renderConsole(Graphics::Surface *g, Common::Rect &r);
-	void drawBox(Graphics::Surface *g, int x, int y, int w, int h);
-	void fillRect(Graphics::Surface *g, int x, int y, int w, int h, int color = kColorBlack);
+	void renderConsole(Graphics::ManagedSurface *g, Common::Rect &r);
+	void drawBox(Graphics::ManagedSurface *g, int x, int y, int w, int h);
+	void fillRect(Graphics::ManagedSurface *g, int x, int y, int w, int h, int color = kColorBlack);
 	void loadFonts();
 	void flowText(Common::String &str);
 	const Graphics::Font *getConsoleFont();
@@ -132,7 +132,7 @@ private:
 	void updateTextSelection(int x, int y);
 
 public:
-	Graphics::Surface _screen;
+	Graphics::ManagedSurface _screen;
 	int _cursorX, _cursorY;
 	bool _cursorState;
 	Common::Rect _consoleTextArea;
@@ -149,7 +149,7 @@ public:
 	bool _menuDirty;
 
 private:
-	Graphics::Surface _console;
+	Graphics::ManagedSurface _console;
 	Menu *_menu;
 	Scene *_scene;
 	bool _sceneDirty;
diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index 3abfdf6..7a080a3 100644
--- a/engines/wage/macwindow.cpp
+++ b/engines/wage/macwindow.cpp
@@ -100,7 +100,7 @@ void MacWindow::setDimensions(const Common::Rect &r) {
 	move(r.left, r.top);
 }
 
-void MacWindow::draw(Graphics::Surface *g, bool forceRedraw) {
+void MacWindow::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
 	if (_borderIsDirty || forceRedraw)
 		drawBorder();
 }
@@ -124,7 +124,7 @@ const int arrowPixels[ARROW_H][ARROW_W] = {
 		{1,1,1,1,1,1,1,1,1,1,1,1}};
 
 static void drawPixelInverted(int x, int y, int color, void *data) {
-	Graphics::Surface *surface = (Graphics::Surface *)data;
+	Graphics::ManagedSurface *surface = (Graphics::ManagedSurface *)data;
 
 	if (x >= 0 && x < surface->w && y >= 0 && y < surface->h) {
 		byte *p = (byte *)surface->getBasePtr(x, y);
diff --git a/engines/wage/macwindow.h b/engines/wage/macwindow.h
index 0d7d49f..b8a04a2 100644
--- a/engines/wage/macwindow.h
+++ b/engines/wage/macwindow.h
@@ -75,7 +75,7 @@ public:
 	void move(int x, int y);
 	void resize(int w, int h);
 	void setDimensions(const Common::Rect &r);
-	void draw(Graphics::Surface *g, bool forceRedraw = false);
+	void draw(Graphics::ManagedSurface *g, bool forceRedraw = false);
 	void setActive(bool active);
 	Graphics::ManagedSurface *getSurface() { return &_surface; }
 	void setTitle(Common::String &title) { _title = title; }
diff --git a/engines/wage/macwindowmanager.cpp b/engines/wage/macwindowmanager.cpp
index 14c3f23..72f01fa 100644
--- a/engines/wage/macwindowmanager.cpp
+++ b/engines/wage/macwindowmanager.cpp
@@ -48,7 +48,7 @@
 #include "common/list.h"
 #include "common/array.h"
 
-#include "graphics/surface.h"
+#include "graphics/managed_surface.h"
 
 #include "wage/wage.h"
 #include "wage/macwindow.h"
@@ -94,7 +94,7 @@ void MacWindowManager::setActive(int id) {
     _fullRefresh = true;
 }
 
-void MacWindowManager::draw(Graphics::Surface *g) {
+void MacWindowManager::draw(Graphics::ManagedSurface *g) {
     for (Common::List<MacWindow *>::const_iterator it = _windowStack.begin(); it != _windowStack.end(); it++)
         (*it)->draw(g, _fullRefresh);
 
diff --git a/engines/wage/macwindowmanager.h b/engines/wage/macwindowmanager.h
index b15c773..1c8ed02 100644
--- a/engines/wage/macwindowmanager.h
+++ b/engines/wage/macwindowmanager.h
@@ -60,7 +60,7 @@ public:
 	int add(bool scrollable);
 	void setActive(int id);
 
-	void draw(Graphics::Surface *g);
+	void draw(Graphics::ManagedSurface *g);
 
 	MacWindow *getWindow(int id) { return _windows[id]; }
 
diff --git a/engines/wage/menu.cpp b/engines/wage/menu.cpp
index 12ef8c2..9bd4327 100644
--- a/engines/wage/menu.cpp
+++ b/engines/wage/menu.cpp
@@ -397,7 +397,7 @@ void Menu::renderSubmenu(MenuItem *menu) {
 		}
 
 		if (!text.empty()) {
-			Graphics::Surface *s = &_gui->_screen;
+			Graphics::ManagedSurface *s = &_gui->_screen;
 			int tx = x, ty = y;
 
 			if (!menu->subitems[i]->enabled) {
diff --git a/engines/wage/menu.h b/engines/wage/menu.h
index 3550356..916ef6d 100644
--- a/engines/wage/menu.h
+++ b/engines/wage/menu.h
@@ -111,8 +111,8 @@ public:
 
 private:
 	Gui *_gui;
-	Graphics::Surface _screenCopy;
-	Graphics::Surface _tempSurface;
+	Graphics::ManagedSurface _screenCopy;
+	Graphics::ManagedSurface _tempSurface;
 
 private:
 	const Graphics::Font *getMenuFont();


Commit: 0e4c846a39cdf5c8370106ba87b24ac7936818fd
    https://github.com/scummvm/scummvm/commit/0e4c846a39cdf5c8370106ba87b24ac7936818fd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-15T17:24:14+02:00

Commit Message:
WAGE: Benefit from ManagedSurface methods

Changed paths:
    engines/wage/design.cpp
    engines/wage/gui-console.cpp
    engines/wage/macwindow.cpp
    engines/wage/menu.cpp



diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index a697b89..185c051 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -99,8 +99,7 @@ void Design::paint(Graphics::ManagedSurface *surface, Patterns &patterns, int x,
 		_surface = new Graphics::ManagedSurface;
 		_surface->create(_bounds->width(), _bounds->height(), Graphics::PixelFormat::createFormatCLUT8());
 
-		Common::Rect r(0, 0, _bounds->width(), _bounds->height());
-		_surface->fillRect(r, kColorGreen);
+		_surface->clear(kColorGreen);
 
 		needRender = true;
 	}
@@ -133,16 +132,10 @@ void Design::paint(Graphics::ManagedSurface *surface, Patterns &patterns, int x,
 
 	if (_bounds->width() && _bounds->height()) {
 		const int padding = 3;
-		for (int i = padding; i < _bounds->height() - 2 * padding; i++) {
-			const byte *src = (const byte *)_surface->getBasePtr(padding, i);
-			byte *dst = (byte *)surface->getBasePtr(x + padding, y+i);
-			for (int j = padding; j < _bounds->width() - 2 * padding; j++) {
-				if (*src != kColorGreen)
-					*dst = *src;
-				src++;
-				dst++;
-			}
-		}
+		Common::Rect from(padding, padding, _bounds->width() - 2 * padding, _bounds->height() - 2 * padding);
+		Common::Rect to(from);
+		to.moveTo(x, y);
+		surface->transBlitFrom(*_surface, from, to, kColorGreen);
 	}
 }
 
diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp
index 3a3f189..5f9cfe5 100644
--- a/engines/wage/gui-console.cpp
+++ b/engines/wage/gui-console.cpp
@@ -150,7 +150,6 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, Common::Rect &r) {
 
 	Common::Rect boundsR(kConWOverlap - kConOverscan, kConHOverlap - kConOverscan,
 					r.width() + kConWOverlap + kConOverscan, r.height() + kConHOverlap + kConOverscan);
-	Common::Rect fullR(0, 0, surfW, surfH);
 
 	if (_console.w != surfW || _console.h != surfH) {
 		if (_console.w != surfW)
@@ -163,7 +162,7 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, Common::Rect &r) {
 	}
 
 	if (fullRedraw)
-		_console.fillRect(fullR, kColorWhite);
+		_console.clear(kColorWhite);
 
 	const Graphics::Font *font = getConsoleFont();
 
diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index 7a080a3..dee80de 100644
--- a/engines/wage/macwindow.cpp
+++ b/engines/wage/macwindow.cpp
@@ -144,7 +144,7 @@ void MacWindow::drawBorder() {
 	int height = _borderSurface.h;
 	Graphics::ManagedSurface *g = &_borderSurface;
 
-	g->fillRect(_borderDims, kColorGreen2);
+	g->clear(kColorGreen2);
 
 	drawBox(g, x,                    y,                     size,                 size);
 	drawBox(g, x + width - size - 1, y,                     size,                 size);
diff --git a/engines/wage/menu.cpp b/engines/wage/menu.cpp
index 9bd4327..27cbf5e 100644
--- a/engines/wage/menu.cpp
+++ b/engines/wage/menu.cpp
@@ -406,7 +406,7 @@ void Menu::renderSubmenu(MenuItem *menu) {
 				ty = 0;
 				accelX -= x;
 
-				_tempSurface.fillRect(Common::Rect(0, 0, _tempSurface.w, _tempSurface.h), kColorGreen);
+				_tempSurface.clear(kColorGreen);
 			}
 
 			_font->drawString(s, text, tx, ty, r->width(), color);


Commit: 6a415da6b970a8922dcdeea31d35b836289533d9
    https://github.com/scummvm/scummvm/commit/6a415da6b970a8922dcdeea31d35b836289533d9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-15T17:24:14+02:00

Commit Message:
WAGE: Started screen composing

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



diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 8d605fe..f20f18c 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -284,13 +284,19 @@ void Gui::drawScene() {
 	MacWindow *w = _wm.getWindow(_sceneWindowId);
 
 	w->setDimensions(*_scene->_designBounds);
+	_scene->paint(w->getSurface(), 0, 0);
+	w->draw(&_screen);
+	g_system->copyRectToScreen(_screen.getBasePtr(_scene->_designBounds->left, _scene->_designBounds->top),
+			_screen.pitch, _scene->_designBounds->left, _scene->_designBounds->top,
+			_scene->_designBounds->width(), _scene->_designBounds->height());
+
 
 	_sceneDirty = true;
 	_consoleDirty = true;
 	_menuDirty = true;
 	_consoleFullRedraw = true;
 
-	_scene->paint(&_screen, _scene->_designBounds->left, _scene->_designBounds->top);
+	//_scene->paint(&_screen, _scene->_designBounds->left, _scene->_designBounds->top);
 
 	_sceneArea.left = _scene->_designBounds->left + kBorderWidth - 2;
 	_sceneArea.top = _scene->_designBounds->top + kBorderWidth - 2;
@@ -302,7 +308,7 @@ void Gui::drawScene() {
 	_consoleTextArea.setWidth(_scene->_textBounds->width() - 2 * kBorderWidth);
 	_consoleTextArea.setHeight(_scene->_textBounds->height() - 2 * kBorderWidth);
 
-	paintBorder(&_screen, _sceneArea, kWindowScene);
+	//paintBorder(&_screen, _sceneArea, kWindowScene);
 }
 
 // Render console
diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index dee80de..d1b6564 100644
--- a/engines/wage/macwindow.cpp
+++ b/engines/wage/macwindow.cpp
@@ -80,29 +80,32 @@ void MacWindow::resize(int w, int h) {
 	_surface.free();
 	_surface.create(w, h, Graphics::PixelFormat::createFormatCLUT8());
 	_borderSurface.free();
-	_borderSurface.create(w + 2 * kBorderWidth, h + 2 * kBorderWidth, Graphics::PixelFormat::createFormatCLUT8());
+	_borderSurface.create(w, h, Graphics::PixelFormat::createFormatCLUT8());
+	_composeSurface.free();
+	_composeSurface.create(w, h, Graphics::PixelFormat::createFormatCLUT8());
 
 	_dims.setWidth(w);
 	_dims.setHeight(h);
-
-	_borderDims.setWidth(w + 2 * kBorderWidth);
-	_borderDims.setHeight(h + 2 * kBorderWidth);
-	move(_dims.left, _dims.top); // Update _borderDims position
 }
 
 void MacWindow::move(int x, int y) {
 	_dims.moveTo(x, y);
-	_borderDims.moveTo(x - kBorderWidth, y - kBorderWidth);
 }
 
 void MacWindow::setDimensions(const Common::Rect &r) {
 	resize(r.width(), r.height());
-	move(r.left, r.top);
+	_dims.moveTo(r.left, r.top);
 }
 
 void MacWindow::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
 	if (_borderIsDirty || forceRedraw)
 		drawBorder();
+
+	// Compose
+	_composeSurface.blitFrom(_surface, _surface.getBounds(), Common::Point(0, 0));
+	_composeSurface.transBlitFrom(_borderSurface, kColorGreen);
+
+	g->transBlitFrom(_composeSurface, _composeSurface.getBounds(), Common::Point(_dims.left, _dims.top), kColorGreen2);
 }
 
 const Graphics::Font *MacWindow::getTitleFont() {
@@ -145,6 +148,7 @@ void MacWindow::drawBorder() {
 	Graphics::ManagedSurface *g = &_borderSurface;
 
 	g->clear(kColorGreen2);
+	g->fillRect(Common::Rect(kBorderWidth, kBorderWidth, width - kBorderWidth, height - kBorderWidth), kColorGreen);
 
 	drawBox(g, x,                    y,                     size,                 size);
 	drawBox(g, x + width - size - 1, y,                     size,                 size);
diff --git a/engines/wage/macwindow.h b/engines/wage/macwindow.h
index b8a04a2..e635528 100644
--- a/engines/wage/macwindow.h
+++ b/engines/wage/macwindow.h
@@ -92,6 +92,7 @@ private:
 private:
 	Graphics::ManagedSurface _surface;
 	Graphics::ManagedSurface _borderSurface;
+	Graphics::ManagedSurface _composeSurface;
 	bool _scrollable;
 	bool _active;
 	bool _borderIsDirty;
@@ -100,7 +101,6 @@ private:
 	float _scrollPos, _scrollSize;
 
 	Common::Rect _dims;
-	Common::Rect _borderDims;
 
 	Common::String _title;
 };


Commit: cb06c712c7d3a99bdcae4f77cb88a854388f0944
    https://github.com/scummvm/scummvm/commit/cb06c712c7d3a99bdcae4f77cb88a854388f0944
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-15T17:24:15+02:00

Commit Message:
WAGE: Fix border clipping

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



diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index f20f18c..6914fdb 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -68,7 +68,7 @@ static const byte palette[] = {
 	0x80, 0x80, 0x80,  // Gray
 	0xff, 0xff, 0xff,  // White
 	0x00, 0xff, 0x00,  // Green
-	0x00, 0x7f, 0x00   // Green2
+	0x00, 0xcf, 0x00   // Green2
 };
 
 static byte fillPatterns[][8] = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, // kPatternSolid
@@ -171,7 +171,7 @@ Gui::Gui(WageEngine *engine) {
 
 	_inputTextLineNum = 0;
 
-	g_system->getPaletteManager()->setPalette(palette, 0, 4);
+	g_system->getPaletteManager()->setPalette(palette, 0, ARRAYSIZE(palette) / 3);
 
 	CursorMan.replaceCursorPalette(palette, 0, 4);
 	CursorMan.replaceCursor(macCursorArrow, 11, 16, 1, 1, 3);
diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index d1b6564..865bd2d 100644
--- a/engines/wage/macwindow.cpp
+++ b/engines/wage/macwindow.cpp
@@ -147,8 +147,11 @@ void MacWindow::drawBorder() {
 	int height = _borderSurface.h;
 	Graphics::ManagedSurface *g = &_borderSurface;
 
+	// We draw rect with outer kColorGreen2 and inner kColorGreen, so on 2 passes we cut out
+	// scene by external shape of the border
+	int sz = kBorderWidth / 2;
 	g->clear(kColorGreen2);
-	g->fillRect(Common::Rect(kBorderWidth, kBorderWidth, width - kBorderWidth, height - kBorderWidth), kColorGreen);
+	g->fillRect(Common::Rect(sz, sz, width - sz, height - sz), kColorGreen);
 
 	drawBox(g, x,                    y,                     size,                 size);
 	drawBox(g, x + width - size - 1, y,                     size,                 size);


Commit: cdb4fc1fbfb23e83f9a8b87eaa99a05c7ba59d98
    https://github.com/scummvm/scummvm/commit/cdb4fc1fbfb23e83f9a8b87eaa99a05c7ba59d98
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-15T17:24:15+02:00

Commit Message:
WAGE: Simplify border drawing

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



diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 6914fdb..6808ba2 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -284,6 +284,7 @@ void Gui::drawScene() {
 	MacWindow *w = _wm.getWindow(_sceneWindowId);
 
 	w->setDimensions(*_scene->_designBounds);
+	w->setTitle(_scene->_name);
 	_scene->paint(w->getSurface(), 0, 0);
 	w->draw(&_screen);
 	g_system->copyRectToScreen(_screen.getBasePtr(_scene->_designBounds->left, _scene->_designBounds->top),
diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index 865bd2d..c5b65b3 100644
--- a/engines/wage/macwindow.cpp
+++ b/engines/wage/macwindow.cpp
@@ -102,7 +102,7 @@ void MacWindow::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
 		drawBorder();
 
 	// Compose
-	_composeSurface.blitFrom(_surface, _surface.getBounds(), Common::Point(0, 0));
+	_composeSurface.blitFrom(_surface);
 	_composeSurface.transBlitFrom(_borderSurface, kColorGreen);
 
 	g->transBlitFrom(_composeSurface, _composeSurface.getBounds(), Common::Point(_dims.left, _dims.top), kColorGreen2);


Commit: 78dc8be3dcb099ac1ba33748fefbe5f2aa2966bd
    https://github.com/scummvm/scummvm/commit/78dc8be3dcb099ac1ba33748fefbe5f2aa2966bd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-15T17:24:15+02:00

Commit Message:
WAGE: Fix window composing offset

Changed paths:
    engines/wage/macwindow.cpp



diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index c5b65b3..1551dac 100644
--- a/engines/wage/macwindow.cpp
+++ b/engines/wage/macwindow.cpp
@@ -102,10 +102,10 @@ void MacWindow::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
 		drawBorder();
 
 	// Compose
-	_composeSurface.blitFrom(_surface);
+	_composeSurface.blitFrom(_surface, Common::Rect(0, 0, _surface.w - 2, _surface.h - 2), Common::Point(2, 2));
 	_composeSurface.transBlitFrom(_borderSurface, kColorGreen);
 
-	g->transBlitFrom(_composeSurface, _composeSurface.getBounds(), Common::Point(_dims.left, _dims.top), kColorGreen2);
+	g->transBlitFrom(_composeSurface, _composeSurface.getBounds(), Common::Point(_dims.left - 2, _dims.top - 2), kColorGreen2);
 }
 
 const Graphics::Font *MacWindow::getTitleFont() {


Commit: 6ae1e5cc7a3b21c3b993ca8d02baa6c0fb4c4f4f
    https://github.com/scummvm/scummvm/commit/6ae1e5cc7a3b21c3b993ca8d02baa6c0fb4c4f4f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-15T17:24:15+02:00

Commit Message:
WAGE: Fix window title drawing

Changed paths:
    engines/wage/macwindow.cpp



diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index 1551dac..41d8422 100644
--- a/engines/wage/macwindow.cpp
+++ b/engines/wage/macwindow.cpp
@@ -139,7 +139,7 @@ static void drawPixelInverted(int x, int y, int color, void *data) {
 void MacWindow::drawBorder() {
 	_borderIsDirty = false;
 
-	bool active = _active, scrollable = _scrollable, closeable = _active, drawTitle = _title.empty();
+	bool active = _active, scrollable = _scrollable, closeable = _active, drawTitle = !_title.empty();
 	const int size = kBorderWidth;
 	int x = 0;
 	int y = 0;


Commit: 78567a3c1d990bbc429d8c5ef85f33865f4f1a1d
    https://github.com/scummvm/scummvm/commit/78567a3c1d990bbc429d8c5ef85f33865f4f1a1d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-15T17:24:15+02:00

Commit Message:
WAGE: Fix border blitting

Changed paths:
    engines/wage/gui.cpp



diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 6808ba2..f66397e 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -287,8 +287,8 @@ void Gui::drawScene() {
 	w->setTitle(_scene->_name);
 	_scene->paint(w->getSurface(), 0, 0);
 	w->draw(&_screen);
-	g_system->copyRectToScreen(_screen.getBasePtr(_scene->_designBounds->left, _scene->_designBounds->top),
-			_screen.pitch, _scene->_designBounds->left, _scene->_designBounds->top,
+	g_system->copyRectToScreen(_screen.getBasePtr(_scene->_designBounds->left - 2, _scene->_designBounds->top - 2),
+			_screen.pitch, _scene->_designBounds->left - 2, _scene->_designBounds->top - 2,
 			_scene->_designBounds->width(), _scene->_designBounds->height());
 
 


Commit: 43d49e68b2bdf9e45fdf7542272c013ee2e3fde7
    https://github.com/scummvm/scummvm/commit/43d49e68b2bdf9e45fdf7542272c013ee2e3fde7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-15T17:24:16+02:00

Commit Message:
WAGE: Draw console via MacWindow

Changed paths:
    engines/wage/gui-console.cpp
    engines/wage/gui.cpp
    engines/wage/gui.h



diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp
index 5f9cfe5..840b8e3 100644
--- a/engines/wage/gui-console.cpp
+++ b/engines/wage/gui-console.cpp
@@ -142,7 +142,7 @@ void Gui::flowText(Common::String &str) {
 		draw();
 }
 
-void Gui::renderConsole(Graphics::ManagedSurface *g, Common::Rect &r) {
+void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
 	bool fullRedraw = _consoleFullRedraw;
 	bool textReflow = false;
 	int surfW = r.width() + kConWOverlap * 2;
@@ -279,7 +279,6 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, Common::Rect &r) {
 		rr.bottom = _screen.h - 1;
 
 	g->copyRectToSurface(_console, xcon, ycon, boundsR);
-	g_system->copyRectToScreen(g->getBasePtr(rr.left, rr.top), g->pitch, rr.left, rr.top, rr.width(), rr.height());
 }
 
 void Gui::drawInput() {
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index f66397e..436d17c 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -291,14 +291,11 @@ void Gui::drawScene() {
 			_screen.pitch, _scene->_designBounds->left - 2, _scene->_designBounds->top - 2,
 			_scene->_designBounds->width(), _scene->_designBounds->height());
 
-
 	_sceneDirty = true;
 	_consoleDirty = true;
 	_menuDirty = true;
 	_consoleFullRedraw = true;
 
-	//_scene->paint(&_screen, _scene->_designBounds->left, _scene->_designBounds->top);
-
 	_sceneArea.left = _scene->_designBounds->left + kBorderWidth - 2;
 	_sceneArea.top = _scene->_designBounds->top + kBorderWidth - 2;
 	_sceneArea.setWidth(_scene->_designBounds->width() - 2 * kBorderWidth);
@@ -308,8 +305,6 @@ void Gui::drawScene() {
 	_consoleTextArea.top = _scene->_textBounds->top + kBorderWidth - 2;
 	_consoleTextArea.setWidth(_scene->_textBounds->width() - 2 * kBorderWidth);
 	_consoleTextArea.setHeight(_scene->_textBounds->height() - 2 * kBorderWidth);
-
-	//paintBorder(&_screen, _sceneArea, kWindowScene);
 }
 
 // Render console
@@ -317,8 +312,14 @@ void Gui::drawConsole() {
 	if (!_consoleDirty && !_consoleFullRedraw && !_bordersDirty && !_sceneDirty)
 		return;
 
-	renderConsole(&_screen, _consoleTextArea);
-	paintBorder(&_screen, _consoleTextArea, kWindowConsole);
+	MacWindow *w = _wm.getWindow(_consoleWindowId);
+	w->setDimensions(*_scene->_textBounds);
+	renderConsole(w->getSurface(), Common::Rect(kBorderWidth - 2, kBorderWidth - 2,
+				_scene->_textBounds->width() - kBorderWidth, _scene->_textBounds->height() - kBorderWidth));
+	w->draw(&_screen);
+	g_system->copyRectToScreen(_screen.getBasePtr(_scene->_textBounds->left - 2, _scene->_textBounds->top - 2),
+			_screen.pitch, _scene->_textBounds->left - 2, _scene->_textBounds->top - 2,
+			_scene->_textBounds->width(), _scene->_textBounds->height());
 }
 
 void Gui::drawBox(Graphics::ManagedSurface *g, int x, int y, int w, int h) {
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index 9d59e33..dc3a593 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -119,7 +119,7 @@ private:
 	void drawDesktop();
 	void paintBorder(Graphics::ManagedSurface *g, Common::Rect &r, WindowType windowType, int highlightedPart = kBorderNone,
 						float scrollPos = 0.0, float scrollSize = 0.0);
-	void renderConsole(Graphics::ManagedSurface *g, Common::Rect &r);
+	void renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r);
 	void drawBox(Graphics::ManagedSurface *g, int x, int y, int w, int h);
 	void fillRect(Graphics::ManagedSurface *g, int x, int y, int w, int h, int color = kColorBlack);
 	void loadFonts();






More information about the Scummvm-git-logs mailing list