[apps/shared] Factorize CurveView::label

There was a lot of code duplication.
I removed the initialization of xLabel{} and yLabels{} because those are
scratch buffers that shouldn't be accessed before being written to
anyway.
This commit is contained in:
Romain Goyet
2020-03-10 18:29:01 -04:00
committed by LeaNumworks
parent ef249b0bdb
commit 2bf83c43a8
16 changed files with 86 additions and 60 deletions

View File

@@ -9,10 +9,8 @@ using namespace Shared;
namespace Regression {
GraphView::GraphView(Store * store, CurveViewCursor * cursor, BannerView * bannerView, Shared::CursorView * cursorView) :
CurveView(store, cursor, bannerView, cursorView),
m_store(store),
m_xLabels{},
m_yLabels{}
LabeledCurveView(store, cursor, bannerView, cursorView),
m_store(store)
{
}
@@ -41,13 +39,4 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
}
}
char * GraphView::label(Axis axis, int index) const {
if (axis == Axis::Vertical) {
assert(index < k_maxNumberOfXLabels);
return (char *)m_yLabels[index];
}
assert(index < k_maxNumberOfYLabels);
return (char *)m_xLabels[index];
}
}