Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve cluster construction performance #5584

Merged
3 commits merged into from
Apr 28, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/renderer/base/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ void Renderer::_PaintBufferOutputHelper(_In_ IRenderEngine* const pEngine,
}

// Walk through the text data and turn it into rendering clusters.
size_t columnCount = 0;
miniksa marked this conversation as resolved.
Show resolved Hide resolved

zadjii-msft marked this conversation as resolved.
Show resolved Hide resolved
// If we're on the first cluster to be added and it's marked as "trailing"
// (a.k.a. the right half of a two column character), then we need some special handling.
Expand All @@ -743,7 +744,8 @@ void Renderer::_PaintBufferOutputHelper(_In_ IRenderEngine* const pEngine,
// And tell the next function to trim off the left half of it.
trimLeft = true;
// And add one to the number of columns we expect it to take as we insert it.
clusters.emplace_back(it->Chars(), it->Columns() + 1);
columnCount = it->Columns() + 1;
clusters.emplace_back(it->Chars(), columnCount);
}
else
{
Expand All @@ -755,11 +757,11 @@ void Renderer::_PaintBufferOutputHelper(_In_ IRenderEngine* const pEngine,
// Otherwise if it's not a special case, just insert it as is.
else
{
clusters.emplace_back(it->Chars(), it->Columns());
columnCount = it->Columns();
clusters.emplace_back(it->Chars(), columnCount);
}

// Advance the cluster and column counts.
const auto columnCount = clusters.back().GetColumns();
it += columnCount > 0 ? columnCount : 1; // prevent infinite loop for no visible columns
cols += columnCount;

Expand Down