diff options
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/macgui/macwindow.cpp | 1 | ||||
-rw-r--r-- | graphics/macgui/macwindowborder.cpp | 1 | ||||
-rw-r--r-- | graphics/nine_patch.cpp | 15 |
3 files changed, 10 insertions, 7 deletions
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp index 6405d37591..abb91f180d 100644 --- a/graphics/macgui/macwindow.cpp +++ b/graphics/macgui/macwindow.cpp @@ -336,7 +336,6 @@ void MacWindow::loadBorder(Common::SeekableReadStream &file, bool active, int lo _macBorder.setOffsets(lo, ro, to, bo); updateInnerDims(); - source.free(); } void MacWindow::setCloseable(bool closeable) { diff --git a/graphics/macgui/macwindowborder.cpp b/graphics/macgui/macwindowborder.cpp index 25832440cf..f47f8a3b2a 100644 --- a/graphics/macgui/macwindowborder.cpp +++ b/graphics/macgui/macwindowborder.cpp @@ -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/nine_patch.cpp b/graphics/nine_patch.cpp index fa2ef20a6e..9cee90864a 100644 --- a/graphics/nine_patch.cpp +++ b/graphics/nine_patch.cpp @@ -230,25 +230,28 @@ void NinePatchBitmap::blit(Graphics::Surface &target, int dx, int dy, int dw, in if (!palette) warning("Trying to blit into a surface with 1bpp, you need the palette."); - Surface srf; - srf.create(target.w, target.h, _bmp->format); + Surface *srf = new Surface(); + srf->create(target.w, target.h, _bmp->format); - drawRegions(srf, dx, dy, dw, dh); + drawRegions(*srf, dx, dy, dw, dh); //TODO: This can be further optimized by keeping the data between draws, // and using a unique identifier for each palette, so that it only gets // recalculated when the palette changes. _cached_colors.clear(); - for (uint i = 0; i < srf.w; ++i) { - for (uint j = 0; j < srf.h; ++j) { - uint32 color = *(uint32*)srf.getBasePtr(i, j); + for (uint i = 0; i < srf->w; ++i) { + for (uint j = 0; j < srf->h; ++j) { + uint32 color = *(uint32*)srf->getBasePtr(i, j); if (color > 0) { *((byte *)target.getBasePtr(i, j)) = closestGrayscale(color, palette, numColors); } } } + srf->free(); + delete srf; + return; } |