From 4e5c1ce49e320dd5e1e8b979adce654d5cc49185 Mon Sep 17 00:00:00 2001 From: pjft Date: Wed, 17 May 2017 13:01:15 +0100 Subject: [PATCH] Changes to mitigate white flashes ES navigation - Set default GL clear color to black, rather than white - Revert changes to ImageComponent intialization that cause white flashes - Increased ALSA buffer to prevent buffer underruns which stall CPU momentarily - Improved carousel texture buffering based on navigation direction and speed --- es-app/src/views/SystemView.cpp | 21 ++++++++++++++++----- es-core/src/AudioManager.cpp | 2 +- es-core/src/Renderer_init_sdlgl.cpp | 2 +- es-core/src/components/IList.h | 7 ++++++- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/es-app/src/views/SystemView.cpp b/es-app/src/views/SystemView.cpp index 9794ea91a..06668796a 100644 --- a/es-app/src/views/SystemView.cpp +++ b/es-app/src/views/SystemView.cpp @@ -9,6 +9,10 @@ #include "Settings.h" #include "Util.h" +// buffer values for scrolling velocity (left, stopped, right) +const int logoBuffersLeft[] = { -5, -2, -1 }; +const int logoBuffersRight[] = { 1, 2, 5 }; + SystemView::SystemView(Window* window) : IList(window, LIST_SCROLL_STYLE_SLOW, LIST_ALWAYS_LOOP), mViewNeedsReload(true), mSystemInfo(window, "SYSTEM INFO", Font::get(FONT_SIZE_SMALL), 0x33333300, ALIGN_CENTER) @@ -39,14 +43,14 @@ void SystemView::populate() // make logo if(theme->getElement("system", "logo", "image")) { - ImageComponent* logo = new ImageComponent(mWindow); + ImageComponent* logo = new ImageComponent(mWindow, false, false); logo->setMaxSize(Eigen::Vector2f(mCarousel.logoSize.x(), mCarousel.logoSize.y())); logo->applyTheme((*it)->getTheme(), "system", "logo", ThemeFlags::PATH); logo->setPosition((mCarousel.logoSize.x() - logo->getSize().x()) / 2, (mCarousel.logoSize.y() - logo->getSize().y()) / 2); // center e.data.logo = std::shared_ptr(logo); - ImageComponent* logoSelected = new ImageComponent(mWindow); + ImageComponent* logoSelected = new ImageComponent(mWindow, false, false); logoSelected->setMaxSize(Eigen::Vector2f(mCarousel.logoSize.x() * mCarousel.logoScale, mCarousel.logoSize.y() * mCarousel.logoScale)); logoSelected->applyTheme((*it)->getTheme(), "system", "logo", ThemeFlags::PATH | ThemeFlags::COLOR); logoSelected->setPosition((mCarousel.logoSize.x() - logoSelected->getSize().x()) / 2, @@ -364,9 +368,12 @@ void SystemView::renderCarousel(const Eigen::Affine3f& trans) Eigen::Affine3f logoTrans = trans; int center = (int)(mCamOffset); - int logoCount = std::min(mCarousel.maxLogoCount, (int)mEntries.size()) + 2; + int logoCount = std::min(mCarousel.maxLogoCount, (int)mEntries.size()); - for (int i = center - logoCount / 2; i < center + logoCount / 2 + 1; i++) + // Adding texture loading buffers depending on scrolling speed and status + int bufferIndex = getScrollingVelocity() + 1; + + for (int i = center - logoCount / 2 + logoBuffersLeft[bufferIndex]; i <= center + logoCount / 2 + logoBuffersRight[bufferIndex]; i++) { int index = i; while (index < 0) @@ -402,7 +409,11 @@ void SystemView::renderExtras(const Eigen::Affine3f& trans) { Eigen::Affine3f extrasTrans = trans; int extrasCenter = (int)mExtrasCamOffset; - for (int i = extrasCenter - 1; i < extrasCenter + 2; i++) + + // Adding texture loading buffers depending on scrolling speed and status + int bufferIndex = getScrollingVelocity() + 1; + + for (int i = extrasCenter + logoBuffersLeft[bufferIndex]; i <= extrasCenter + logoBuffersRight[bufferIndex]; i++) { int index = i; while (index < 0) diff --git a/es-core/src/AudioManager.cpp b/es-core/src/AudioManager.cpp index c75d3c4ca..cbc0821ed 100644 --- a/es-core/src/AudioManager.cpp +++ b/es-core/src/AudioManager.cpp @@ -89,7 +89,7 @@ void AudioManager::init() sAudioFormat.freq = 44100; sAudioFormat.format = AUDIO_S16; sAudioFormat.channels = 2; - sAudioFormat.samples = 1024; + sAudioFormat.samples = 4096; sAudioFormat.callback = mixAudio; sAudioFormat.userdata = NULL; diff --git a/es-core/src/Renderer_init_sdlgl.cpp b/es-core/src/Renderer_init_sdlgl.cpp index ab0bfb56a..b34e06664 100644 --- a/es-core/src/Renderer_init_sdlgl.cpp +++ b/es-core/src/Renderer_init_sdlgl.cpp @@ -151,7 +151,7 @@ namespace Renderer glMatrixMode(GL_PROJECTION); glOrtho(0, display_width, display_height, 0, -1.0, 1.0); glMatrixMode(GL_MODELVIEW); - glClearColor(1.0f, 1.0f, 1.0f, 1.0f); + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); return true; } diff --git a/es-core/src/components/IList.h b/es-core/src/components/IList.h index ede3360a9..5543fae06 100644 --- a/es-core/src/components/IList.h +++ b/es-core/src/components/IList.h @@ -44,7 +44,7 @@ const ScrollTierList LIST_SCROLL_STYLE_QUICK = { 4, QUICK_SCROLL_TIERS }; const ScrollTier SLOW_SCROLL_TIERS[] = { {500, 500}, - {0, 150} + {0, 200} }; const ScrollTierList LIST_SCROLL_STYLE_SLOW = { 2, SLOW_SCROLL_TIERS }; @@ -100,6 +100,11 @@ public: return (mScrollVelocity != 0 && mScrollTier > 0); } + int getScrollingVelocity() + { + return mScrollVelocity; + } + void stopScrolling() { listInput(0);