aboutsummaryrefslogtreecommitdiff
path: root/graphics/macgui/macwindowborder.cpp
diff options
context:
space:
mode:
authorBorja Lorente2016-06-02 19:02:32 +0200
committerBorja Lorente2016-07-31 14:45:36 +0200
commit4ab02530ae8e6d32bf970973669b306a859b2805 (patch)
tree3f934efdc14fd7a8a9492d770873a5ba56c0211c /graphics/macgui/macwindowborder.cpp
parent26238ee6f987a1ffe5836145f3b937cfd38d28cf (diff)
downloadscummvm-rg350-4ab02530ae8e6d32bf970973669b306a859b2805.tar.gz
scummvm-rg350-4ab02530ae8e6d32bf970973669b306a859b2805.tar.bz2
scummvm-rg350-4ab02530ae8e6d32bf970973669b306a859b2805.zip
GRAPHICS: Add MacWindowBorder to abstract borders
Diffstat (limited to 'graphics/macgui/macwindowborder.cpp')
-rw-r--r--graphics/macgui/macwindowborder.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/graphics/macgui/macwindowborder.cpp b/graphics/macgui/macwindowborder.cpp
new file mode 100644
index 0000000000..7e64f1d87c
--- /dev/null
+++ b/graphics/macgui/macwindowborder.cpp
@@ -0,0 +1,38 @@
+#include "macwindowborder.h"
+
+namespace Graphics {
+
+MacWindowBorder::MacWindowBorder() {
+ _activeBorder = nullptr;
+ _inactiveBorder = nullptr;
+}
+
+
+MacWindowBorder::~MacWindowBorder() {
+ if (_activeBorder)
+ delete _activeBorder;
+ if (_inactiveBorder)
+ delete _inactiveBorder;
+}
+
+void MacWindowBorder::addActiveBorder(TransparentSurface *source) {
+ // Assumes NinePatchBitmap invariants hold
+ _activeBorder = new NinePatchBitmap(source, false);
+}
+
+void MacWindowBorder::addInactiveBorder(TransparentSurface *source) {
+ _inactiveBorder = new NinePatchBitmap(source, false);
+}
+
+void MacWindowBorder::blitBorderInto(ManagedSurface &destination, bool active) {
+
+ TransparentSurface srf;
+ NinePatchBitmap *src = active ? _activeBorder : _inactiveBorder;
+
+ srf.create(destination.w, destination.h, src->getSource()->format);
+
+ src->blit(srf, 0, 0, srf.w, srf.h);
+ destination.transBlitFrom(srf, destination.format.ARGBToColor(0, 255, 255, 255));
+}
+
+} // End of namespace Graphics