GRAPHICS: Fix leak in ninepatch destructor
This commit is contained in:
parent
5bba089724
commit
ec6bb1431e
2 changed files with 9 additions and 5 deletions
|
@ -317,14 +317,14 @@ void MacWindow::setScroll(float scrollPos, float scrollSize) {
|
||||||
|
|
||||||
void MacWindow::loadBorder(Common::SeekableReadStream &file, bool active, int lo, int ro, int to, int bo) {
|
void MacWindow::loadBorder(Common::SeekableReadStream &file, bool active, int lo, int ro, int to, int bo) {
|
||||||
Image::BitmapDecoder bmpDecoder;
|
Image::BitmapDecoder bmpDecoder;
|
||||||
Graphics::Surface source;
|
Graphics::Surface *source;
|
||||||
Graphics::TransparentSurface *surface = new Graphics::TransparentSurface();
|
Graphics::TransparentSurface *surface = new Graphics::TransparentSurface();
|
||||||
|
|
||||||
bmpDecoder.loadStream(file);
|
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, surface->getSupportedPixelFormat());
|
||||||
surface->copyFrom(source);
|
surface->copyFrom(*source);
|
||||||
surface->applyColorKey(255, 0, 255, false);
|
surface->applyColorKey(255, 0, 255, false);
|
||||||
|
|
||||||
if (active)
|
if (active)
|
||||||
|
@ -336,6 +336,8 @@ void MacWindow::loadBorder(Common::SeekableReadStream &file, bool active, int lo
|
||||||
_macBorder.setOffsets(lo, ro, to, bo);
|
_macBorder.setOffsets(lo, ro, to, bo);
|
||||||
|
|
||||||
updateInnerDims();
|
updateInnerDims();
|
||||||
|
source->free();
|
||||||
|
delete source;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacWindow::setCloseable(bool closeable) {
|
void MacWindow::setCloseable(bool closeable) {
|
||||||
|
|
|
@ -260,8 +260,10 @@ void NinePatchBitmap::blit(Graphics::Surface &target, int dx, int dy, int dw, in
|
||||||
}
|
}
|
||||||
|
|
||||||
NinePatchBitmap::~NinePatchBitmap() {
|
NinePatchBitmap::~NinePatchBitmap() {
|
||||||
if (_destroy_bmp)
|
if (_destroy_bmp) {
|
||||||
|
_bmp->free();
|
||||||
delete _bmp;
|
delete _bmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NinePatchBitmap::drawRegions(Graphics::Surface &target, int dx, int dy, int dw, int dh) {
|
void NinePatchBitmap::drawRegions(Graphics::Surface &target, int dx, int dy, int dw, int dh) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue