aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/director/frame.cpp37
-rw-r--r--graphics/macgui/macwindowmanager.cpp18
-rw-r--r--graphics/macgui/macwindowmanager.h14
3 files changed, 37 insertions, 32 deletions
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 1e80c80fb7..37c558ce31 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -24,6 +24,7 @@
#include "graphics/font.h"
#include "graphics/macgui/macfontmanager.h"
#include "graphics/macgui/macwindowmanager.h"
+#include "graphics/primitives.h"
#include "image/bmp.h"
#include "director/director.h"
@@ -699,10 +700,12 @@ void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId, uin
surface.frameRect(_rect, 0);
_drawRects[spriteId] = _rect;
break;
- case kTypeButton:
- _rect = Common::Rect(x, y, x + width, y + height);
- surface.frameRect(_rect, 0);
- _drawRects[spriteId] = _rect;
+ case kTypeButton: {
+ _rect = Common::Rect(x - 1, y - 1, x + width - 2, y + height + 4);
+ Graphics::MacPlotData pd(&surface, &_vm->getMacWindowManager()->getPatterns(), Graphics::MacGUIConstants::kPatternSolid, 1);
+ Graphics::drawRoundRect(_rect, 4, 0, false, Graphics::macDrawPixel, &pd);
+ _drawRects[spriteId] = _rect;
+ }
break;
case kTypeRadio:
warning("STUB: renderButton: kTypeRadio");
@@ -831,12 +834,17 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID, Commo
textCast->palinfo3 = textStream->readUint16();
}
+ uint16 boxShadow = (uint16)textCast->boxShadow;
+ uint16 borderSize = (uint16)textCast->borderSize;
+ uint16 padding = (uint16)textCast->gutterSize;
+ uint16 textShadow = (uint16)textCast->textShadow;
+
uint32 rectLeft = textCast->initialRect.left;
uint32 rectTop = textCast->initialRect.top;
int x = _sprites[spriteID]->_startPoint.x;// +rectLeft;
int y = _sprites[spriteID]->_startPoint.y;// +rectTop;
- int height = _sprites[spriteID]->_height;
+ int height = _sprites[spriteID]->_height + textShadow;
int width = _sprites[spriteID]->_width;
Graphics::MacFont macFont(textCast->fontId, textCast->fontSize, textCast->textSlant);
@@ -850,35 +858,30 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID, Commo
debugC(3, kDebugText, "renderText: x: %d y: %d w: %d h: %d font: '%s'", x, y, width, height, _vm->_wm->_fontMan->getFontName(macFont));
- uint16 boxShadow = (uint16)textCast->boxShadow;
- uint16 borderSize = (uint16)textCast->borderSize;
- uint16 padding = (uint16)textCast->gutterSize;
- uint16 textShadow = (uint16)textCast->textShadow;
-
int alignment = (int)textCast->textAlign;
- if (alignment == 0xff) alignment = 3;
+ if (alignment == -1) alignment = 3;
else alignment++;
if (textShadow > 0) {
font->drawString(&surface, text,
- x + borderSize + padding + textShadow,
- y + (borderSize / 2) + (padding / 2) + (textShadow - 1),
+ x + borderSize + padding + (textShadow - 1),
+ y + (borderSize > 0 ? borderSize - 1 : 0) + (padding / 2) + (textShadow),
width, (_sprites[spriteID]->_ink == kInkTypeReverse ? 255 : 0), (Graphics::TextAlign)alignment);
}
//TODO: the colour is wrong here... need to determine the correct colour for all versions!
font->drawString(&surface, text,
- x + borderSize + padding,
- y + (borderSize / 2) + (padding / 2) - (textShadow > 0 ? 1 : 0),
+ x + borderSize + padding - (textShadow > 0 ? 1 : 0) - (isButtonLabel ? 1 : 0),
+ y + (borderSize > 0 ? borderSize - 1 : 0) + (padding / 2) + (isButtonLabel ? 1 : 0),
width, (_sprites[spriteID]->_ink == kInkTypeReverse ? 255 : 0), (Graphics::TextAlign)alignment);
if (isButtonLabel)
return;
if (borderSize != kSizeNone) {
- x += (borderSize / 2);
- y += (borderSize / 2);
+ x += borderSize - 1;
+ y += borderSize - 1;
width += (padding * 2);
height += 6 + (padding);
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index bad4ad3acc..ebc2a8f76d 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -217,18 +217,8 @@ void MacWindowManager::removeWindow(MacWindow *target) {
_needsRemoval = true;
}
-struct PlotData {
- Graphics::ManagedSurface *surface;
- MacPatterns *patterns;
- uint fillType;
- int thickness;
-
- PlotData(Graphics::ManagedSurface *s, MacPatterns *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;
+void macDrawPixel(int x, int y, int color, void *data) {
+ MacPlotData *p = (MacPlotData *)data;
if (p->fillType > p->patterns->size())
return;
@@ -265,9 +255,9 @@ static void drawPixel(int x, int y, int color, void *data) {
void MacWindowManager::drawDesktop() {
Common::Rect r(_screen->getBounds());
- PlotData pd(_screen, &_patterns, kPatternCheckers, 1);
+ MacPlotData pd(_screen, &_patterns, kPatternCheckers, 1);
- Graphics::drawRoundRect(r, kDesktopArc, kColorBlack, true, drawPixel, &pd);
+ Graphics::drawRoundRect(r, kDesktopArc, kColorBlack, true, macDrawPixel, &pd);
g_system->copyRectToScreen(_screen->getPixels(), _screen->pitch, 0, 0, _screen->w, _screen->h);
}
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index 9f62403813..d359369415 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -65,6 +65,19 @@ class MacFontManager;
typedef Common::Array<byte *> MacPatterns;
+struct MacPlotData {
+ Graphics::ManagedSurface *surface;
+ MacPatterns *patterns;
+ uint fillType;
+ int thickness;
+
+ MacPlotData(Graphics::ManagedSurface *s, MacPatterns *p, int f, int t) :
+ surface(s), patterns(p), fillType(f), thickness(t) {
+ }
+};
+
+void macDrawPixel(int x, int y, int color, void *data);
+
/**
* A manager class to handle window creation, destruction,
* drawing, moving and event handling.
@@ -143,7 +156,6 @@ public:
* @return A MacPatterns object reference with the patterns.
*/
MacPatterns &getPatterns() { return _patterns; }
- void drawFilledRoundRect(ManagedSurface *surface, Common::Rect &rect, int arc, int color);
void pushArrowCursor();
void pushBeamCursor();