Speed up grid painting with many unique effects/actors a bit

This commit is contained in:
Thomas Goyne 2015-01-31 20:09:35 -08:00
parent 79fb5cb3fe
commit 8c1b20e651
2 changed files with 4 additions and 0 deletions

View file

@ -599,12 +599,14 @@ void BaseGrid::SetColumnWidths() {
int x = 0;
WidthHelper helper{dc, std::unordered_map<boost::flyweight<std::string>, int>{}};
helper.widths.reserve(prev_unique_string_widths);
for (auto const& column : columns) {
column->UpdateWidth(context, helper);
if (column->Width() && column->RefreshOnTextChange())
text_refresh_rects.emplace_back(x, 0, column->Width(), h);
x += column->Width();
}
prev_unique_string_widths = helper.widths.size();
}
AssDialogue *BaseGrid::GetDialogue(int n) const {

View file

@ -57,6 +57,8 @@ class BaseGrid final : public wxWindow {
int active_row = -1;
size_t prev_unique_string_widths = 0;
/// Rows which are visible on the current video frame
std::vector<int> visible_rows;