Significantly speed up AssLimitToVisibleFilter::ProcessSubs

Originally committed to SVN as r4673.
This commit is contained in:
Thomas Goyne 2010-07-11 03:31:33 +00:00
parent ab27440853
commit 81b75d9f55
1 changed files with 10 additions and 14 deletions

View File

@ -61,23 +61,19 @@ void AssLimitToVisibleFilter::Init() {
/// @brief Process /// @brief Process
/// @param subs /// @param subs
/// @param export_dialog /// @param export_dialog
void AssLimitToVisibleFilter::ProcessSubs(AssFile *subs, wxWindow *export_dialog) { void AssLimitToVisibleFilter::ProcessSubs(AssFile *subs, wxWindow *) {
if (frame == -1) return; if (frame == -1) return;
AssDialogue *diag; int time = VideoContext::Get()->TimeAtFrame(frame);
entryIter cur, next = subs->Line.begin();
while (next != subs->Line.end()) {
cur = next++;
diag = dynamic_cast<AssDialogue*>(*cur); for (entryIter cur = subs->Line.begin(); cur != subs->Line.end(); ) {
if (diag) { AssDialogue *diag = dynamic_cast<AssDialogue*>(*cur);
// Invisible, remove frame if (diag && (diag->Start.GetMS() > time || diag->End.GetMS() <= time)) {
if (VideoContext::Get()->FrameAtTime(diag->Start.GetMS(),agi::vfr::START) > frame || delete *cur;
VideoContext::Get()->FrameAtTime(diag->End.GetMS(),agi::vfr::END) < frame) { cur = subs->Line.erase(cur);
}
delete *cur; else {
subs->Line.erase(cur); ++cur;
}
} }
} }
} }