1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-22 01:34:21 +00:00

DemoRunner: Disable OpenGL renderer when showing heavyweight demos and some misc code cleanup

This commit is contained in:
ed 2018-04-05 12:11:27 +01:00
parent ba130cdd8c
commit d553cf62a6
4 changed files with 17 additions and 7 deletions

View file

@ -105,7 +105,7 @@ void registerDemos_One() noexcept
REGISTER_DEMO (OscillatorDemo, DSP, false)
REGISTER_DEMO (OverdriveDemo, DSP, false)
#if JUCE_USE_SIMD
REGISTER_DEMO (SIMDRegisterDemo, DSP, false)
REGISTER_DEMO (SIMDRegisterDemo, DSP, false)
#endif
REGISTER_DEMO (StateVariableFilterDemo, DSP, false)
REGISTER_DEMO (WaveShaperTanhDemo, DSP, false)

View file

@ -111,7 +111,7 @@ DemoContentComponent::DemoContentComponent (Component& mainComponent, std::funct
addTab ("Code", Colours::transparentBlack, codeContent = new CodeContent(), false);
#endif
addTab ("Settings", Colours::transparentBlack, new SettingsContent (dynamic_cast<MainComponent&> (mainComponent)), true);
addTab ("Settings", Colours::transparentBlack, new SettingsContent (dynamic_cast<MainComponent&> (mainComponent)), true);
setTabBarDepth (40);
lookAndFeelChanged();

View file

@ -249,6 +249,15 @@ MainComponent::MainComponent()
demosPanel.showOrHide (false);
#endif
if (isHeavyweight)
{
#if JUCE_MAC && USE_COREGRAPHICS_RENDERING
setRenderingEngine (1);
#else
setRenderingEngine (0);
#endif
}
isShowingHeavyweightDemo = isHeavyweight;
resized();
});
@ -393,13 +402,18 @@ void MainComponent::updateRenderingEngine (int renderingEngineIndex)
{
if (renderingEngineIndex == (renderingEngines.size() - 1))
{
if (isShowingHeavyweightDemo)
return;
openGLContext.attachTo (*getTopLevelComponent());
}
else
{
openGLContext.detach();
peer->setCurrentRenderingEngine (renderingEngineIndex);
}
if (peer != nullptr)
peer->setCurrentRenderingEngine (renderingEngineIndex);
currentRenderingEngineIdx = renderingEngineIndex;
}

View file

@ -30,10 +30,6 @@
#include "DemoContentComponent.h"
//==============================================================================
/*
This component lives inside our window, and this is where you should put all
your controls and content.
*/
class MainComponent : public Component
{
public: