From b02de858a27a05459354f9fbc06e5af52f873e87 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sat, 8 Jul 2006 22:33:21 +0000 Subject: [PATCH] Improved the speed of grid drawing with tags hidden. Originally committed to SVN as r478. --- core/base_grid.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/core/base_grid.cpp b/core/base_grid.cpp index 879a371e5..44998e020 100644 --- a/core/base_grid.cpp +++ b/core/base_grid.cpp @@ -440,21 +440,19 @@ void BaseGrid::DrawImage(wxDC &dc) { // Hidden overrides if (mode == 1 || mode == 2) { wxString replaceWith = Options.AsText(_T("Grid hide overrides char")); - curDiag->ParseASSTags(); - size_t n = curDiag->Blocks.size(); - for (size_t i=0;iBlocks.at(i); - AssDialogueBlockPlain *plain = AssDialogueBlock::GetAsPlain(block); - if (plain) { - value += plain->GetText(); - } - else { - if (mode == 1) { - value += replaceWith; - } + int textlen = curDiag->Text.Length(); + int depth = 0; + wxChar curChar; + for (int i=0;iText[i]; + if (curChar == _T('{')) depth = 1; + else if (curChar == _T('}')) { + depth--; + if (depth == 0 && mode == 1) value += replaceWith; + if (depth < 0) depth = 0; } + else if (depth != 1) value += curChar; } - curDiag->ClearBlocks(); } // Show overrides