Improved the speed of grid drawing with tags hidden.

Originally committed to SVN as r478.
This commit is contained in:
Rodrigo Braz Monteiro 2006-07-08 22:33:21 +00:00
parent 3e9d9b79d6
commit b02de858a2
1 changed files with 11 additions and 13 deletions

View File

@ -440,21 +440,19 @@ void BaseGrid::DrawImage(wxDC &dc) {
// Hidden overrides // Hidden overrides
if (mode == 1 || mode == 2) { if (mode == 1 || mode == 2) {
wxString replaceWith = Options.AsText(_T("Grid hide overrides char")); wxString replaceWith = Options.AsText(_T("Grid hide overrides char"));
curDiag->ParseASSTags(); int textlen = curDiag->Text.Length();
size_t n = curDiag->Blocks.size(); int depth = 0;
for (size_t i=0;i<n;i++) { wxChar curChar;
AssDialogueBlock *block = curDiag->Blocks.at(i); for (int i=0;i<textlen;i++) {
AssDialogueBlockPlain *plain = AssDialogueBlock::GetAsPlain(block); curChar = curDiag->Text[i];
if (plain) { if (curChar == _T('{')) depth = 1;
value += plain->GetText(); else if (curChar == _T('}')) {
} depth--;
else { if (depth == 0 && mode == 1) value += replaceWith;
if (mode == 1) { if (depth < 0) depth = 0;
value += replaceWith;
}
} }
else if (depth != 1) value += curChar;
} }
curDiag->ClearBlocks();
} }
// Show overrides // Show overrides