From 366daa9c88971ff2cee5d799d447a436e6a0bb42 Mon Sep 17 00:00:00 2001 From: Ruben Dashyan Date: Fri, 3 May 2019 10:59:15 +0200 Subject: [PATCH] [apps] Remove dummy checks in graph/graph_controller and shared/function_graph_controller --- apps/graph/graph/graph_controller.cpp | 2 +- apps/shared/function_graph_controller.cpp | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/apps/graph/graph/graph_controller.cpp b/apps/graph/graph/graph_controller.cpp index 1f95d2d9b..d340d53c6 100644 --- a/apps/graph/graph/graph_controller.cpp +++ b/apps/graph/graph/graph_controller.cpp @@ -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()); diff --git a/apps/shared/function_graph_controller.cpp b/apps/shared/function_graph_controller.cpp index 90f3e9bb5..b125899dd 100644 --- a/apps/shared/function_graph_controller.cpp +++ b/apps/shared/function_graph_controller.cpp @@ -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 f = functionStore()->modelForRecord(functionStore()->activeRecordAtIndex(i)); /* Scan x-range from the middle to the extrema in order to get balanced