[Scummvm-cvs-logs] SF.net SVN: scummvm:[47246] scummvm/trunk/engines/sci/graphics
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Mon Jan 11 11:37:32 CET 2010
Revision: 47246
http://scummvm.svn.sourceforge.net/scummvm/?rev=47246&view=rev
Author: thebluegr
Date: 2010-01-11 10:37:32 +0000 (Mon, 11 Jan 2010)
Log Message:
-----------
The portrait file data is now freed after the portrait animation is done
Modified Paths:
--------------
scummvm/trunk/engines/sci/graphics/portrait.cpp
scummvm/trunk/engines/sci/graphics/portrait.h
Modified: scummvm/trunk/engines/sci/graphics/portrait.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/portrait.cpp 2010-01-11 10:31:40 UTC (rev 47245)
+++ scummvm/trunk/engines/sci/graphics/portrait.cpp 2010-01-11 10:37:32 UTC (rev 47246)
@@ -45,6 +45,7 @@
Portrait::~Portrait() {
delete[] _bitmaps;
+ delete _fileData;
}
void Portrait::init(Common::String resourceName, SciPalette *palette) {
@@ -66,7 +67,6 @@
// -> 6 bytes unknown
// height * width bitmap data
// another animation count times bitmap header and data
- byte *fileData = 0;
int32 fileSize = 0;
Common::SeekableReadStream *file =
SearchMan.createReadStreamForMember("actors/" + resourceName + ".bin");
@@ -76,20 +76,20 @@
error("portrait %s.bin not found", resourceName.c_str());
}
fileSize = file->size();
- fileData = new byte[fileSize];
- file->read(fileData, fileSize);
+ _fileData = new byte[fileSize];
+ file->read(_fileData, fileSize);
delete file;
- if (strncmp((char *)fileData, "WIN", 3)) {
+ if (strncmp((char *)_fileData, "WIN", 3)) {
error("portrait %s doesn't have valid header", resourceName.c_str());
}
- _width = READ_LE_UINT16(fileData + 3);
- _height = READ_LE_UINT16(fileData + 5);
- _bitmapCount = READ_LE_UINT16(fileData + 7);
+ _width = READ_LE_UINT16(_fileData + 3);
+ _height = READ_LE_UINT16(_fileData + 5);
+ _bitmapCount = READ_LE_UINT16(_fileData + 7);
_bitmaps = new PortraitBitmap[_bitmapCount];
- uint16 portraitPaletteSize = READ_LE_UINT16(fileData + 13);
- byte *data = fileData + 17;
+ uint16 portraitPaletteSize = READ_LE_UINT16(_fileData + 13);
+ byte *data = _fileData + 17;
// Read palette
memset(&_portraitPalette, 0, sizeof(Palette));
uint16 palSize = 0, palNr = 0;
@@ -131,7 +131,6 @@
// Set the portrait palette
palette->set(&_portraitPalette, 1);
- delete fileData;
}
void Portrait::doit(Common::Point position, uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq) {
Modified: scummvm/trunk/engines/sci/graphics/portrait.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/portrait.h 2010-01-11 10:31:40 UTC (rev 47245)
+++ scummvm/trunk/engines/sci/graphics/portrait.h 2010-01-11 10:37:32 UTC (rev 47246)
@@ -61,6 +61,8 @@
uint16 _bitmapCount;
PortraitBitmap *_bitmaps;
+ byte *_fileData;
+
Common::Point _position;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list