NGI: Fix memory leaks when flipping bitmaps

Coverity CID 1433114
Coverity CID 1433128
This commit is contained in:
sluicebox committed 2023-11-02 09:27:33 -07:00
1 parent 3809934d21
commit 4fcb00a835
2 files changed
+6 -2

No files matched your search

+3 -1
View File
@@ -577,7 +577,9 @@ void Picture::draw(int x, int y, int style, int angle) {
case 1: {
//flip
const Dims dims = getDimensions();
_bitmap->flipVertical()->drawShaded(1, x1, y1 + 30 + dims.y, *pal, _alpha);
Bitmap *flipped = _bitmap->flipVertical();
flipped->drawShaded(1, x1, y1 + 30 + dims.y, *pal, _alpha);
delete flipped;
break;
}
case 2:
+3 -1
View File
@@ -496,7 +496,9 @@ void Movement::draw(bool flipFlag, int angle) {
}
if (flipFlag) {
bmp->flipVertical()->drawShaded(1, x, y + 30 + _currDynamicPhase->_rect.bottom, _currDynamicPhase->getPaletteData(), _currDynamicPhase->getAlpha());
Bitmap *flipped = bmp->flipVertical();
flipped->drawShaded(1, x, y + 30 + _currDynamicPhase->_rect.bottom, _currDynamicPhase->getPaletteData(), _currDynamicPhase->getAlpha());
delete flipped;
} else if (angle) {
bmp->drawRotated(x, y, angle, _currDynamicPhase->getPaletteData(), _currDynamicPhase->getAlpha());
} else {