diff options
author | Borja Lorente | 2016-07-29 12:14:19 +0200 |
---|---|---|
committer | Borja Lorente | 2016-07-31 14:45:36 +0200 |
commit | a2955b102547ab37a7cf9b42ca0addeed82bb942 (patch) | |
tree | f7cf192087b3cf74c770494ab7d921b7be3e6735 | |
parent | 4ab02530ae8e6d32bf970973669b306a859b2805 (diff) | |
download | scummvm-rg350-a2955b102547ab37a7cf9b42ca0addeed82bb942.tar.gz scummvm-rg350-a2955b102547ab37a7cf9b42ca0addeed82bb942.tar.bz2 scummvm-rg350-a2955b102547ab37a7cf9b42ca0addeed82bb942.zip |
GRAPHICS: Add active/inactive borders to MacWindowBorders
-rw-r--r-- | graphics/macgui/macwindow.cpp | 13 | ||||
-rw-r--r-- | graphics/macgui/macwindow.h | 3 | ||||
-rw-r--r-- | graphics/macgui/macwindowborder.cpp | 2 | ||||
-rw-r--r-- | graphics/macgui/macwindowborder.h | 1 |
4 files changed, 11 insertions, 8 deletions
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp index 7ad5666866..3c9372a745 100644 --- a/graphics/macgui/macwindow.cpp +++ b/graphics/macgui/macwindow.cpp @@ -186,7 +186,7 @@ void MacWindow::drawBorder() { ManagedSurface *g = &_borderSurface; prepareBorderSurface(g); - if (_borders) + if (!_macBorder.empty()) drawBorderFromSurface(g); else drawSimpleBorder(g); @@ -203,12 +203,11 @@ void MacWindow::prepareBorderSurface(ManagedSurface *g) { } void MacWindow::drawBorderFromSurface(ManagedSurface *g) { - assert(_borders); TransparentSurface srf; srf.create(_borderSurface.w, _borderSurface.h, _borders->format); - _macBorder.blitBorderInto(_borderSurface, false); + _macBorder.blitBorderInto(_borderSurface, _active); _borderSurface.transBlitFrom(srf, _borderSurface.format.ARGBToColor(0, 255, 255, 255)); } @@ -302,10 +301,12 @@ void MacWindow::setHighlight(WindowClick highlightedPart) { _borderIsDirty = true; } - void MacWindow::setBorders(TransparentSurface *source) { + void MacWindow::setBorder(TransparentSurface *source, bool active) { _borders = new TransparentSurface(*source); - if (_borders) - _macBorder.addInactiveBorder(_borders); + if (active) + _macBorder.addActiveBorder(_borders); + else + _macBorder.addInactiveBorder(_borders); } diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h index 1181190300..bffeaf7104 100644 --- a/graphics/macgui/macwindow.h +++ b/graphics/macgui/macwindow.h @@ -138,7 +138,7 @@ public: bool processEvent(Common::Event &event); bool hasAllFocus() { return _beingDragged || _beingResized; } - void setBorders(TransparentSurface *source); + void setBorder(TransparentSurface *source, bool active); private: void drawBorder(); @@ -155,7 +155,6 @@ private: ManagedSurface _borderSurface; ManagedSurface _composeSurface; - NinePatchBitmap *_bmp; TransparentSurface *_borders; MacWindowBorder _macBorder; diff --git a/graphics/macgui/macwindowborder.cpp b/graphics/macgui/macwindowborder.cpp index 7e64f1d87c..cbb2ef0571 100644 --- a/graphics/macgui/macwindowborder.cpp +++ b/graphics/macgui/macwindowborder.cpp @@ -15,6 +15,8 @@ MacWindowBorder::~MacWindowBorder() { delete _inactiveBorder; } +bool MacWindowBorder::empty() { return !(_activeBorder || _inactiveBorder); } + void MacWindowBorder::addActiveBorder(TransparentSurface *source) { // Assumes NinePatchBitmap invariants hold _activeBorder = new NinePatchBitmap(source, false); diff --git a/graphics/macgui/macwindowborder.h b/graphics/macgui/macwindowborder.h index c956add76d..0c98e23156 100644 --- a/graphics/macgui/macwindowborder.h +++ b/graphics/macgui/macwindowborder.h @@ -62,6 +62,7 @@ public: MacWindowBorder(); ~MacWindowBorder(); + bool empty(); void addActiveBorder(TransparentSurface *source); void addInactiveBorder(TransparentSurface *source); void blitBorderInto(ManagedSurface &destination, bool active); |