[apps/shared/sum_graph_controller] In LegendView::setSumLayout, simplify equal sign

This commit is contained in:
Ruben Dashyan
2020-02-28 14:51:27 +01:00
committed by LeaNumworks
parent 0a92579571
commit 55bb3f677a

View File

@@ -202,8 +202,7 @@ void SumGraphController::LegendView::setSumLayout(Step step, double start, doubl
EmptyLayout::Builder(EmptyLayoutNode::Color::Yellow, false, k_font, false));
} else {
constexpr int precision = Preferences::MediumNumberOfSignificantDigits;
constexpr int sizeForPrecision = PrintFloat::charSizeForFloatsWithPrecision(precision);
constexpr int bufferSize = 2 + sizeForPrecision;
constexpr int bufferSize = PrintFloat::charSizeForFloatsWithPrecision(precision);
char buffer[bufferSize];
PoincareHelpers::ConvertFloatToTextWithDisplayMode<double>(start, buffer, bufferSize, precision, Preferences::PrintFloatMode::Decimal);
Layout start = LayoutHelper::String(buffer, strlen(buffer), k_font);
@@ -213,11 +212,11 @@ void SumGraphController::LegendView::setSumLayout(Step step, double start, doubl
sumLayout,
start,
end);
strlcpy(buffer, "= ", 3);
PoincareHelpers::ConvertFloatToText<double>(result, buffer+2, bufferSize-2, precision);
PoincareHelpers::ConvertFloatToText<double>(result, buffer, bufferSize, precision);
sumLayout = HorizontalLayout::Builder(
sumLayout,
functionLayout,
LayoutHelper::String("= ", 2, k_font),
LayoutHelper::String(buffer, strlen(buffer), k_font));
}
m_sum.setLayout(sumLayout);