Merge pull request #129 from pjft/ES-WhiteFlash

Changes to mitigate white flashes in heavier themes
This commit is contained in:
Jools Wills 2017-05-17 23:26:10 +01:00 committed by GitHub
commit d13dd4010a
4 changed files with 24 additions and 8 deletions

View file

@ -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<SystemViewData, SystemData*>(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<GuiComponent>(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)

View file

@ -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;

View file

@ -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;
}

View file

@ -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);