Some small improvements to RAM usage

Originally committed to SVN as r99.
This commit is contained in:
Rodrigo Braz Monteiro 2006-02-21 21:52:32 +00:00
parent fb579fa948
commit d759aae2b3
3 changed files with 24 additions and 1 deletions

View file

@ -924,6 +924,23 @@ void AssFile::AddToRecent(wxString file) {
} }
////////////////////////////////////////////
// Compress/decompress for storage on stack
void AssFile::CompressForStack(bool compress) {
AssDialogue *diag;
for (entryIter cur=Line.begin();cur!=Line.end();cur++) {
diag = AssEntry::GetAsDialogue(*cur);
if (diag) {
if (compress) {
diag->data.Clear();
diag->ClearBlocks();
}
else diag->UpdateData();
}
}
}
////////////////////////////// //////////////////////////////
// Checks if file is modified // Checks if file is modified
bool AssFile::IsModified() { bool AssFile::IsModified() {
@ -954,6 +971,7 @@ void AssFile::FlagAsModified() {
void AssFile::StackPush() { void AssFile::StackPush() {
// Places copy on stack // Places copy on stack
AssFile *curcopy = new AssFile(*top); AssFile *curcopy = new AssFile(*top);
curcopy->CompressForStack(true);
UndoStack.push_back(curcopy); UndoStack.push_back(curcopy);
StackModified = true; StackModified = true;
@ -983,8 +1001,10 @@ void AssFile::StackPop() {
if (!UndoStack.empty()) { if (!UndoStack.empty()) {
//delete top; //delete top;
top->CompressForStack(true);
RedoStack.push_back(top); RedoStack.push_back(top);
top = UndoStack.back(); top = UndoStack.back();
top->CompressForStack(false);
UndoStack.pop_back(); UndoStack.pop_back();
Popping = true; Popping = true;
} }
@ -1007,8 +1027,10 @@ void AssFile::StackRedo() {
} }
if (!RedoStack.empty()) { if (!RedoStack.empty()) {
top->CompressForStack(true);
UndoStack.push_back(top); UndoStack.push_back(top);
top = RedoStack.back(); top = RedoStack.back();
top->CompressForStack(false);
RedoStack.pop_back(); RedoStack.pop_back();
Popping = true; Popping = true;
//StackModified = false; //StackModified = false;

View file

@ -97,6 +97,7 @@ public:
bool IsModified(); // Returns if file has unmodified changes bool IsModified(); // Returns if file has unmodified changes
void FlagAsModified(); // Flag file as being modified, will automatically put a copy on stack void FlagAsModified(); // Flag file as being modified, will automatically put a copy on stack
void Clear(); // Wipes file void Clear(); // Wipes file
void CompressForStack(bool compress); // Compress/decompress for storage on stack
void LoadDefault(bool noline=true); // Loads default file. Pass true to prevent it from adding a default line too void LoadDefault(bool noline=true); // Loads default file. Pass true to prevent it from adding a default line too
void InsertStyle(AssStyle *style); // Inserts a style to file void InsertStyle(AssStyle *style); // Inserts a style to file
wxArrayString GetStyles(); // Gets a list of all styles available wxArrayString GetStyles(); // Gets a list of all styles available

View file

@ -39,7 +39,7 @@ Please visit http://aegisub.net to download latest version
- Added a simple audio resync method afor video playback. (AMZ) - Added a simple audio resync method afor video playback. (AMZ)
- Audio timing will now apply to all selected lines, as well as active line. (AMZ) - Audio timing will now apply to all selected lines, as well as active line. (AMZ)
- Added a volume slider bar to audio mode. (AMZ) - Added a volume slider bar to audio mode. (AMZ)
- Fixed some internal workings, which should make Aegisub use considerably less RAM (especially for large Karaoke files, 3x less RAM usage measured). (AMZ) - Fixed some internal workings, which should make Aegisub use considerably less RAM (especially for large Karaoke files, 3-4x less RAM usage was measured with a 9 MB file). (AMZ)
- Aegisub will now dump the stack to stack.txt when it crashes with a fatal exception, which might or might not work. (AMZ) - Aegisub will now dump the stack to stack.txt when it crashes with a fatal exception, which might or might not work. (AMZ)
- Audio display in SSA mode will no longer ignore clicks if it wasn't focused (AMZ) - Audio display in SSA mode will no longer ignore clicks if it wasn't focused (AMZ)