[apps, poincare] Optimize the preferences singletons' usage by removing superfluous checks in the setters, and performing manual CSE in the callers.

Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
This commit is contained in:
Lionel Debroux
2018-10-19 23:01:16 +02:00
committed by EmilieNumworks
parent ddebc06fa5
commit 70a8d06cfe
10 changed files with 50 additions and 49 deletions

View File

@@ -114,8 +114,9 @@ VariableBoxController * AppsContainer::variableBoxController() {
void AppsContainer::suspend(bool checkIfPowerKeyReleased) {
resetShiftAlphaStatus();
GlobalPreferences * globalPreferences = GlobalPreferences::sharedGlobalPreferences();
#ifdef EPSILON_BOOT_PROMPT
if (activeApp()->snapshot()!= onBoardingAppSnapshot() && activeApp()->snapshot() != hardwareTestAppSnapshot() && GlobalPreferences::sharedGlobalPreferences()->showPopUp()) {
if (activeApp()->snapshot()!= onBoardingAppSnapshot() && activeApp()->snapshot() != hardwareTestAppSnapshot() && globalPreferences->showPopUp()) {
activeApp()->displayModalViewController(&m_promptController, 0.f, 0.f);
}
#endif
@@ -123,7 +124,7 @@ void AppsContainer::suspend(bool checkIfPowerKeyReleased) {
/* Ion::Power::suspend() completely shuts down the LCD controller. Therefore
* the frame memory is lost. That's why we need to force a window redraw
* upon wakeup, otherwise the screen is filled with noise. */
Ion::Backlight::setBrightness(GlobalPreferences::sharedGlobalPreferences()->brightnessLevel());
Ion::Backlight::setBrightness(globalPreferences->brightnessLevel());
m_backlightDimmingTimer.reset();
window()->redraw(true);
}