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

View file

@ -440,22 +440,20 @@ 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--;
if (depth == 0 && mode == 1) value += replaceWith;
if (depth < 0) depth = 0;
} }
else { else if (depth != 1) value += curChar;
if (mode == 1) {
value += replaceWith;
} }
} }
}
curDiag->ClearBlocks();
}
// Show overrides // Show overrides
else value = curDiag->Text; else value = curDiag->Text;