diff options
author | Borja Lorente | 2016-07-29 12:08:41 +0200 |
---|---|---|
committer | Borja Lorente | 2016-07-31 14:05:15 +0200 |
commit | 6c89eaa1b8b3c674e5f507bd3bf5d29db959e244 (patch) | |
tree | 0a972dce82b59c6a703b3c9582d8999064a7b5a3 /graphics/macgui/macwindow.cpp | |
parent | 98d0838df3ee3697268b846d9d114e2a9788cb40 (diff) | |
download | scummvm-rg350-6c89eaa1b8b3c674e5f507bd3bf5d29db959e244.tar.gz scummvm-rg350-6c89eaa1b8b3c674e5f507bd3bf5d29db959e244.tar.bz2 scummvm-rg350-6c89eaa1b8b3c674e5f507bd3bf5d29db959e244.zip |
GRAPHICS: Include border loading code
Diffstat (limited to 'graphics/macgui/macwindow.cpp')
-rw-r--r-- | graphics/macgui/macwindow.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp index 55319569e9..4dacf23e11 100644 --- a/graphics/macgui/macwindow.cpp +++ b/graphics/macgui/macwindow.cpp @@ -64,7 +64,7 @@ BaseMacWindow::BaseMacWindow(int id, bool editable, MacWindowManager *wm) : } MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, MacWindowManager *wm) : - BaseMacWindow(id, editable, wm), _scrollable(scrollable), _resizable(resizable) { + BaseMacWindow(id, editable, wm), _scrollable(scrollable), _resizable(resizable), _bmp(new TransparentSurface(), false) { _active = false; _borderIsDirty = true; @@ -78,6 +78,9 @@ MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, Mac _draggedX = _draggedY = 0; _type = kWindowWindow; + + TransparentSurface *srf = new TransparentSurface; + _bmp = NinePatchBitmap(srf, false); } MacWindow::~MacWindow() { @@ -142,18 +145,23 @@ bool MacWindow::draw(ManagedSurface *g, bool forceRedraw) { _contentIsDirty = false; - TransparentSurface tr; - _bmp->blit(tr, 0, 0, _borderSurface.w, _borderSurface.h); - + // Compose _composeSurface.blitFrom(_surface, Common::Rect(0, 0, _surface.w - 2, _surface.h - 2), Common::Point(2, 2)); - _composeSurface.transBlitFrom(tr, kColorGreen); + _composeSurface.transBlitFrom(_borderSurface, kColorGreen); g->transBlitFrom(_composeSurface, _composeSurface.getBounds(), Common::Point(_dims.left - 2, _dims.top - 2), kColorGreen2); return true; } +bool MacWindow::drawTR(Surface &g, int x, int y, int w, int h, bool forceRedraw) { + + _bmp.blit(g, x, y, w, h); + + return false; +} + #define ARROW_W 12 #define ARROW_H 6 const int arrowPixels[ARROW_H][ARROW_W] = { @@ -259,21 +267,7 @@ void MacWindow::drawBorder() { w = maxWidth; drawBox(g, x + (width - w) / 2, y, w, size); font->drawString(g, _title, x + (width - w) / 2 + 5, y + yOff, w, kColorBlack); - } - - initBorders(g); -} - -void MacWindow::initBorders(ManagedSurface *source) { - TransparentSurface *tr = new TransparentSurface(); - tr->create(source->w, source->h, PixelFormat::createFormatCLUT8()); - - // Fill with alpha so that _check_pixel will go through - tr->drawThickLine(0, tr->h / 2, tr->w, tr->h/2, 1, tr->h/2, Graphics::ALPHA_FULL); - // Show that something can be drawn - tr->drawLine(1, 1, tr->w - 2, tr->h - 2, kColorBlack); - - _bmp = new NinePatchBitmap(tr, false); + } } void MacWindow::setHighlight(WindowClick highlightedPart) { @@ -293,6 +287,10 @@ void MacWindow::setHighlight(WindowClick highlightedPart) { _borderIsDirty = true; } + void MacWindow::setBorders(TransparentSurface *source) { + _bmp = NinePatchBitmap(source, true); + } + void MacWindow::drawBox(ManagedSurface *g, int x, int y, int w, int h) { Common::Rect r(x, y, x + w + 1, y + h + 1); |