aboutsummaryrefslogtreecommitdiff
path: root/graphics/macgui
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/macgui')
-rw-r--r--graphics/macgui/macwindow.cpp15
-rw-r--r--graphics/macgui/macwindowborder.cpp9
-rw-r--r--graphics/macgui/macwindowborder.h4
-rw-r--r--graphics/macgui/macwindowmanager.cpp1
4 files changed, 16 insertions, 13 deletions
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index dbb600ba82..975d52639e 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -317,26 +317,27 @@ void MacWindow::setScroll(float scrollPos, float scrollSize) {
void MacWindow::loadBorder(Common::SeekableReadStream &file, bool active, int lo, int ro, int to, int bo) {
Image::BitmapDecoder bmpDecoder;
- Graphics::Surface source;
+ Graphics::Surface *source;
Graphics::TransparentSurface *surface = new Graphics::TransparentSurface();
bmpDecoder.loadStream(file);
- source = *(bmpDecoder.getSurface());
+ source = bmpDecoder.getSurface()->convertTo(surface->getSupportedPixelFormat(), bmpDecoder.getPalette());
- source.convertToInPlace(surface->getSupportedPixelFormat(), bmpDecoder.getPalette());
- surface->create(source.w, source.h, source.format);
- surface->copyFrom(source);
+ surface->create(source->w, source->h, surface->getSupportedPixelFormat());
+ surface->copyFrom(*source);
surface->applyColorKey(255, 0, 255, false);
if (active)
- _macBorder.addActiveBorder(*surface);
+ _macBorder.addActiveBorder(surface);
else
- _macBorder.addInactiveBorder(*surface);
+ _macBorder.addInactiveBorder(surface);
if (!_macBorder.hasOffsets())
_macBorder.setOffsets(lo, ro, to, bo);
updateInnerDims();
+ source->free();
+ delete source;
}
void MacWindow::setCloseable(bool closeable) {
diff --git a/graphics/macgui/macwindowborder.cpp b/graphics/macgui/macwindowborder.cpp
index b77fa35603..f47f8a3b2a 100644
--- a/graphics/macgui/macwindowborder.cpp
+++ b/graphics/macgui/macwindowborder.cpp
@@ -71,15 +71,15 @@ bool MacWindowBorder::hasBorder(bool active) {
return active ? _activeInitialized : _inactiveInitialized;
}
-void MacWindowBorder::addActiveBorder(TransparentSurface &source) {
+void MacWindowBorder::addActiveBorder(TransparentSurface *source) {
assert(!_activeBorder);
- _activeBorder = new NinePatchBitmap(&source, false);
+ _activeBorder = new NinePatchBitmap(source, true);
_activeInitialized = true;
}
-void MacWindowBorder::addInactiveBorder(TransparentSurface &source) {
+void MacWindowBorder::addInactiveBorder(TransparentSurface *source) {
assert(!_inactiveBorder);
- _inactiveBorder = new NinePatchBitmap(&source, false);
+ _inactiveBorder = new NinePatchBitmap(source, true);
_inactiveInitialized = true;
}
@@ -112,6 +112,7 @@ void MacWindowBorder::blitBorderInto(ManagedSurface &destination, bool active) {
src->blit(srf, 0, 0, srf.w, srf.h, palette, kColorCount);
destination.transBlitFrom(srf, kColorGreen2);
+ srf.free();
}
} // End of namespace Graphics
diff --git a/graphics/macgui/macwindowborder.h b/graphics/macgui/macwindowborder.h
index 54938e5143..6a1b55c5e3 100644
--- a/graphics/macgui/macwindowborder.h
+++ b/graphics/macgui/macwindowborder.h
@@ -86,14 +86,14 @@ public:
* Will fail if there is already an active border.
* @param The surface that will be displayed.
*/
- void addActiveBorder(TransparentSurface &source);
+ void addActiveBorder(TransparentSurface *source);
/**
* Add the given surface as the display of the border in the inactive state.
* Will fail if there is already an inactive border.
* @param The surface that will be displayed.
*/
- void addInactiveBorder(TransparentSurface &source);
+ void addInactiveBorder(TransparentSurface *source);
/**
* Accessor function for the custom offsets.
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index d19e40781f..413d9b2b97 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -322,6 +322,7 @@ void MacWindowManager::removeMarked() {
}
_windowsToRemove.clear();
_needsRemoval = false;
+ _lastId = _windows.size();
}
void MacWindowManager::removeFromStack(BaseMacWindow *target) {