aboutsummaryrefslogtreecommitdiff
path: root/engines/wage/macwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/wage/macwindow.cpp')
-rw-r--r--engines/wage/macwindow.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index 3abfdf6017..41d842286a 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::Surface *g, bool forceRedraw) {
+void MacWindow::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
if (_borderIsDirty || forceRedraw)
drawBorder();
+
+ // Compose
+ _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 - 2, _dims.top - 2), kColorGreen2);
}
const Graphics::Font *MacWindow::getTitleFont() {
@@ -124,7 +127,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);
@@ -136,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;
@@ -144,7 +147,11 @@ void MacWindow::drawBorder() {
int height = _borderSurface.h;
Graphics::ManagedSurface *g = &_borderSurface;
- g->fillRect(_borderDims, kColorGreen2);
+ // 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(sz, sz, width - sz, height - sz), kColorGreen);
drawBox(g, x, y, size, size);
drawBox(g, x + width - size - 1, y, size, size);