aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-04-28 17:14:13 +0200
committerEugene Sandulenko2016-04-28 17:14:13 +0200
commit7fd850c745fef7a222a1af9242799e8c11b4765c (patch)
tree4acc7f6f72ce1892ece2fe7f9abe7eabe1e4d741
parent8b41a507664eb077cdc233dfe1d6a31aa5ab8de3 (diff)
downloadscummvm-rg350-7fd850c745fef7a222a1af9242799e8c11b4765c.tar.gz
scummvm-rg350-7fd850c745fef7a222a1af9242799e8c11b4765c.tar.bz2
scummvm-rg350-7fd850c745fef7a222a1af9242799e8c11b4765c.zip
WAGE: Remove yet another indirect reference to WAGE engine in WM
-rw-r--r--engines/wage/macmenu.cpp8
-rw-r--r--engines/wage/macwindowmanager.cpp53
-rw-r--r--engines/wage/macwindowmanager.h1
3 files changed, 58 insertions, 4 deletions
diff --git a/engines/wage/macmenu.cpp b/engines/wage/macmenu.cpp
index bed9dd42f4..a97e442c83 100644
--- a/engines/wage/macmenu.cpp
+++ b/engines/wage/macmenu.cpp
@@ -318,6 +318,9 @@ bool Menu::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
r.top = 7;
_screen.fillRect(r, kColorWhite);
r.top = kMenuHeight - 1;
+ r.bottom++;
+ _screen.fillRect(r, kColorGreen);
+ r.bottom--;
_screen.fillRect(r, kColorBlack);
for (uint i = 0; i < _items.size(); i++) {
@@ -411,8 +414,9 @@ void Menu::renderSubmenu(MenuItem *menu) {
}
} else { // Delimiter
bool flip = r->left & 2;
- for (int xx = r->left + 1; xx <= r->right - 1; xx++) {
- drawPixelPlain(xx, y + kMenuDropdownItemHeight / 2, (flip ? kColorBlack : kColorWhite), &_screen);
+ byte *ptr = (byte *)_screen.getBasePtr(r->left + 1, y + kMenuDropdownItemHeight / 2);
+ for (int xx = r->left + 1; xx <= r->right - 1; xx++, ptr++) {
+ *ptr = flip ? kColorBlack : kColorWhite;
flip = !flip;
}
}
diff --git a/engines/wage/macwindowmanager.cpp b/engines/wage/macwindowmanager.cpp
index 3bebd865ef..5cc54d648a 100644
--- a/engines/wage/macwindowmanager.cpp
+++ b/engines/wage/macwindowmanager.cpp
@@ -50,13 +50,14 @@
#include "common/list.h"
#include "common/unzip.h"
#include "common/system.h"
+#include "common/stream.h"
#include "graphics/cursorman.h"
#include "graphics/fonts/bdf.h"
#include "graphics/managed_surface.h"
#include "graphics/palette.h"
+#include "graphics/primitives.h"
-#include "wage/design.h"
#include "wage/macwindowmanager.h"
#include "wage/macwindow.h"
#include "wage/macmenu.h"
@@ -184,10 +185,58 @@ void MacWindowManager::setActive(int id) {
_fullRefresh = true;
}
+struct PlotData {
+ Graphics::ManagedSurface *surface;
+ Patterns *patterns;
+ uint fillType;
+ int thickness;
+
+ PlotData(Graphics::ManagedSurface *s, Patterns *p, int f, int t) :
+ surface(s), patterns(p), fillType(f), thickness(t) {}
+};
+
+static void drawPixel(int x, int y, int color, void *data) {
+ PlotData *p = (PlotData *)data;
+
+ if (p->fillType > p->patterns->size())
+ return;
+
+ byte *pat = p->patterns->operator[](p->fillType - 1);
+
+ if (p->thickness == 1) {
+ 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 % 8] & (1 << (7 - xu % 8))) ?
+ color : kColorWhite;
+ }
+ } else {
+ int x1 = x;
+ int x2 = x1 + p->thickness;
+ int y1 = y;
+ int y2 = y1 + p->thickness;
+
+ for (y = y1; y < y2; y++)
+ for (x = x1; x < x2; x++)
+ 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 % 8] & (1 << (7 - xu % 8))) ?
+ color : kColorWhite;
+ }
+ }
+}
+
void MacWindowManager::drawDesktop() {
Common::Rect r(_screen->getBounds());
- Design::drawFilledRoundRect(_screen, r, kDesktopArc, kColorBlack, _patterns, kPatternCheckers);
+ PlotData pd(_screen, &_patterns, kPatternCheckers, 1);
+
+ Graphics::drawRoundRect(r, kDesktopArc, kColorBlack, true, drawPixel, &pd);
+
g_system->copyRectToScreen(_screen->getPixels(), _screen->pitch, 0, 0, _screen->w, _screen->h);
}
diff --git a/engines/wage/macwindowmanager.h b/engines/wage/macwindowmanager.h
index 2d03c9b11d..13f85cddd4 100644
--- a/engines/wage/macwindowmanager.h
+++ b/engines/wage/macwindowmanager.h
@@ -108,6 +108,7 @@ public:
BaseMacWindow *getWindow(int id) { return _windows[id]; }
Patterns &getPatterns() { return _patterns; }
+ void drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color);
void pushArrowCursor();
void popCursor();