mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 04:12:21 +00:00
Fixes ProfilerViewer when drawing empty cells
Currently CalculateStringSize can't handle empty string (see #8630).
As a simple fix for RC just avoid drawing empty texts.
Refs: #8630
(cherry picked from commit df9c6f510c)
Signed-off-by: phosit <phosit@autistici.org>
This commit is contained in:
@@ -240,15 +240,17 @@ void CProfileViewer::RenderProfile(CCanvas2D& canvas)
|
||||
float rowColX = 0.0f;
|
||||
for (size_t col = 0; col < columns.size(); ++col)
|
||||
{
|
||||
CStrW text = table->GetCellText(row, col).FromUTF8();
|
||||
float w, h;
|
||||
font.CalculateStringSize(text.c_str(), w, h);
|
||||
|
||||
float x = rowColX;
|
||||
if (col > 0) // right-align all but the first column
|
||||
x += columns[col].width - w;
|
||||
textRenderer.Put(x, 0.0f, text.c_str());
|
||||
const CStrW text{table->GetCellText(row, col).FromUTF8()};
|
||||
if (!text.empty())
|
||||
{
|
||||
float w, h;
|
||||
font.CalculateStringSize(text.c_str(), w, h);
|
||||
|
||||
float x = rowColX;
|
||||
if (col > 0) // right-align all but the first column
|
||||
x += columns[col].width - w;
|
||||
textRenderer.Put(x, 0.0f, text.c_str());
|
||||
}
|
||||
rowColX += columns[col].width;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user