diff options
author | Borja Lorente | 2016-07-29 11:04:56 +0200 |
---|---|---|
committer | Borja Lorente | 2016-07-31 14:05:15 +0200 |
commit | 1f00d2a09995436551ac42df49df5ab0f710357e (patch) | |
tree | 265e973d96d4e78095a9d989d361f242525004f0 /graphics | |
parent | 5bb5bb64f0bd3acdd8235a8c3c294053db27fb4c (diff) | |
download | scummvm-rg350-1f00d2a09995436551ac42df49df5ab0f710357e.tar.gz scummvm-rg350-1f00d2a09995436551ac42df49df5ab0f710357e.tar.bz2 scummvm-rg350-1f00d2a09995436551ac42df49df5ab0f710357e.zip |
GRAPHICS: Introduce NinePatchBitmap to MacWindow
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/macgui/macwindow.cpp | 21 | ||||
-rw-r--r-- | graphics/macgui/macwindow.h | 9 |
2 files changed, 28 insertions, 2 deletions
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp index 0d43b6daaf..55319569e9 100644 --- a/graphics/macgui/macwindow.cpp +++ b/graphics/macgui/macwindow.cpp @@ -142,9 +142,12 @@ 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(_borderSurface, kColorGreen); + _composeSurface.transBlitFrom(tr, kColorGreen); g->transBlitFrom(_composeSurface, _composeSurface.getBounds(), Common::Point(_dims.left - 2, _dims.top - 2), kColorGreen2); @@ -202,6 +205,8 @@ void MacWindow::drawBorder() { drawBox(g, x + 2, y + size, size - 4, height - 2 * size - 1); drawBox(g, x + width - size + 1, y + size, size - 4, height - 2 * size - 1); + + if (active) { fillRect(g, x + size, y + 5, width - 2 * size - 1, 8, kColorBlack); fillRect(g, x + size, y + height - 13, width - 2 * size - 1, 8, kColorBlack); @@ -255,6 +260,20 @@ void MacWindow::drawBorder() { 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) { diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h index d4d2c073c2..908eab84b4 100644 --- a/graphics/macgui/macwindow.h +++ b/graphics/macgui/macwindow.h @@ -49,6 +49,8 @@ #define GRAPHICS_MACWINDOW_H #include "graphics/managed_surface.h" +#include "graphics/transparent_surface.h" +#include "graphics/nine_patch.h" namespace Graphics { @@ -110,7 +112,7 @@ protected: bool (*_callback)(WindowClick, Common::Event &, void *); void *_dataPtr; - + MacWindowManager *_wm; }; @@ -140,9 +142,14 @@ private: void updateInnerDims(); WindowClick isInBorder(int x, int y); + void initBorders(ManagedSurface *tr); + private: ManagedSurface _borderSurface; ManagedSurface _composeSurface; + + NinePatchBitmap *_bmp; + bool _scrollable; bool _resizable; bool _active; |