diff --git a/graphics/macgui/datafiles.cpp b/graphics/macgui/datafiles.cpp index 1e0e6c376b8..f8a7fb16796 100644 --- a/graphics/macgui/datafiles.cpp +++ b/graphics/macgui/datafiles.cpp @@ -48,7 +48,7 @@ struct BorderName { }; static const BorderName borders[] = { - {0x00, "StandardClose", { 1, 2, 19, 2, 2, 2, false}, kWindowBorderTitle, 23}, + {0x00, "StandardClose", { 1, 2, 19, 2, 2, 2, false}, kWindowBorderTitle, 25}, {0x01, "ThickNoTitle", { 5, 5, 5, 5, -1, -1, false}, 0, 0}, {0x02, "ThinNoTitle", { 1, 1, 1, 1, -1, -1, false}, 0, 0}, {0x03, "ThinNoTitleShadow", { 1, 3, 1, 3, -1, -1, false}, 0, 0}, diff --git a/graphics/macgui/macwindowborder.cpp b/graphics/macgui/macwindowborder.cpp index 425beadef39..df5d49f40af 100644 --- a/graphics/macgui/macwindowborder.cpp +++ b/graphics/macgui/macwindowborder.cpp @@ -152,7 +152,7 @@ void MacWindowBorder::drawScrollBar(ManagedSurface *g, MacWindowManager *wm) { _scrollSize = -1; } -void MacWindowBorder::drawTitle(ManagedSurface *g, MacWindowManager *wm) { +void MacWindowBorder::drawTitle(ManagedSurface *g, MacWindowManager *wm, int titleOffset) { const Graphics::Font *font = wm->_fontMan->getFont(Graphics::MacFont(kMacFontChicago, 12)); int width = g->w; int titleColor = wm->_colorBlack; @@ -164,7 +164,7 @@ void MacWindowBorder::drawTitle(ManagedSurface *g, MacWindowManager *wm) { if (titleWidth > maxWidth) titleWidth = maxWidth; - font->drawString(g, _title, (width - titleWidth) / 2 + 5, titleY + yOff, titleWidth, titleColor); + font->drawString(g, _title, titleOffset + 5, titleY + yOff, titleWidth, titleColor); } void MacWindowBorder::blitBorderInto(ManagedSurface &destination, uint32 flags, MacWindowManager *wm) { @@ -198,7 +198,7 @@ void MacWindowBorder::blitBorderInto(ManagedSurface &destination, uint32 flags, srf.free(); if (flags & kWindowBorderTitle) - drawTitle(&destination, wm); + drawTitle(&destination, wm, src->getTitleOffset()); if (flags & kWindowBorderScrollbar) drawScrollBar(&destination, wm); diff --git a/graphics/macgui/macwindowborder.h b/graphics/macgui/macwindowborder.h index cd056c62751..8407cd6918b 100644 --- a/graphics/macgui/macwindowborder.h +++ b/graphics/macgui/macwindowborder.h @@ -123,7 +123,7 @@ public: void setScroll(int scrollPos, int scrollSize) { _scrollPos = scrollPos, _scrollSize = scrollSize; } - void drawTitle(ManagedSurface *g, MacWindowManager *wm); + void drawTitle(ManagedSurface *g, MacWindowManager *wm, int titleOffset); void drawScrollBar(ManagedSurface *g, MacWindowManager *wm); diff --git a/graphics/nine_patch.cpp b/graphics/nine_patch.cpp index 19a2cbd4665..d8792f47e73 100644 --- a/graphics/nine_patch.cpp +++ b/graphics/nine_patch.cpp @@ -154,6 +154,12 @@ void NinePatchSide::calcOffsets(int len, int titleIndex, int titleWidth) { } } +int NinePatchBitmap::getTitleOffset() { + if (_titleIndex == 0) + return 0; + return _h._m[_titleIndex]->dest_offset; +} + NinePatchBitmap::NinePatchBitmap(Graphics::TransparentSurface *bmp, bool owns_bitmap, int titlePos, int titleWidth) { int i; uint8 r, g, b, a; diff --git a/graphics/nine_patch.h b/graphics/nine_patch.h index 4949cee3c4e..1b6f64feac7 100644 --- a/graphics/nine_patch.h +++ b/graphics/nine_patch.h @@ -100,6 +100,8 @@ public: int getMinWidth() { return _h._fix; } int getMinHeight() { return _v._fix; } int getTitleWidth() { return _titleWidth; } + // always call it after you calc the offset, such as after you call blit, then you will get the right offset + int getTitleOffset(); Graphics::TransparentSurface *getSource() { return _bmp; } Common::Rect &getPadding() { return _padding; }