Significantly speed up AssLimitToVisibleFilter::ProcessSubs
Originally committed to SVN as r4673.
This commit is contained in:
parent
ab27440853
commit
81b75d9f55
1 changed files with 10 additions and 14 deletions
|
@ -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);
|
|
||||||
if (diag) {
|
|
||||||
// Invisible, remove frame
|
|
||||||
if (VideoContext::Get()->FrameAtTime(diag->Start.GetMS(),agi::vfr::START) > frame ||
|
|
||||||
VideoContext::Get()->FrameAtTime(diag->End.GetMS(),agi::vfr::END) < frame) {
|
|
||||||
|
|
||||||
|
for (entryIter cur = subs->Line.begin(); cur != subs->Line.end(); ) {
|
||||||
|
AssDialogue *diag = dynamic_cast<AssDialogue*>(*cur);
|
||||||
|
if (diag && (diag->Start.GetMS() > time || diag->End.GetMS() <= time)) {
|
||||||
delete *cur;
|
delete *cur;
|
||||||
subs->Line.erase(cur);
|
cur = subs->Line.erase(cur);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
++cur;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue