[apps] Remove dummy checks in graph/graph_controller and shared/function_graph_controller

This commit is contained in:
Ruben Dashyan
2019-05-03 10:59:15 +02:00
parent 2bb1e9416e
commit 366daa9c88
2 changed files with 3 additions and 10 deletions

View File

@@ -70,7 +70,7 @@ BannerView * GraphController::bannerView() {
void GraphController::reloadBannerView() {
FunctionGraphController::reloadBannerView();
if (functionStore()->numberOfActiveFunctions() == 0 || !m_displayDerivativeInBanner) {
if (!m_displayDerivativeInBanner) {
return;
}
Ion::Storage::Record record = functionStore()->activeRecordAtIndex(indexFunctionSelectedByCursor());

View File

@@ -69,9 +69,7 @@ void FunctionGraphController::selectFunctionWithCursor(int functionIndex) {
}
void FunctionGraphController::reloadBannerView() {
if (functionStore()->numberOfActiveFunctions() == 0) {
return;
}
assert(functionStore()->numberOfActiveFunctions() > 0);
Ion::Storage::Record record = functionStore()->activeRecordAtIndex(indexFunctionSelectedByCursor());
reloadBannerViewForCursorOnFunction(m_cursor, record, functionStore());
}
@@ -82,16 +80,11 @@ InteractiveCurveViewRangeDelegate::Range FunctionGraphController::computeYRange(
float max = -FLT_MAX;
float xMin = interactiveCurveViewRange->xMin();
float xMax = interactiveCurveViewRange->xMax();
if (functionStore()->numberOfActiveFunctions() <= 0) {
InteractiveCurveViewRangeDelegate::Range range;
range.min = xMin;
range.max = xMax;
return range;
}
/* In practice, a step smaller than a pixel's width is needed for sampling
* the values of a function. Otherwise some relevant extremal values may be
* missed. */
const float step = curveView()->pixelWidth() / 2;
assert(functionStore()->numberOfActiveFunctions() > 0);
for (int i = 0; i < functionStore()->numberOfActiveFunctions(); i++) {
ExpiringPointer<Function> f = functionStore()->modelForRecord(functionStore()->activeRecordAtIndex(i));
/* Scan x-range from the middle to the extrema in order to get balanced