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

VST: Add juce_shouldDoubleScaleNativeGLWindow() method to ensure that OpenGL plug-ins running in hiDPI Cubase 10 on Windows are correctly scaled

This commit is contained in:
ed 2019-01-23 10:43:28 +00:00
parent 87cf4d2553
commit 7134bd0f1b
2 changed files with 25 additions and 0 deletions

View file

@ -43,6 +43,18 @@ AudioProcessor::WrapperType PluginHostType::jucePlugInClientCurrentWrapperType =
bool juce_isRunningInUnity() { return PluginHostType::getPluginLoadedAs() == AudioProcessor::wrapperType_Unity; }
#endif
#if JUCE_MODULE_AVAILABLE_juce_opengl
bool juce_shouldDoubleScaleNativeGLWindow()
{
auto wrapperType = PluginHostType::getPluginLoadedAs();
if (wrapperType == AudioProcessor::wrapperType_VST || wrapperType == AudioProcessor::wrapperType_VST3)
return getHostType().type == PluginHostType::SteinbergCubase10;
return false;
}
#endif
#ifndef JUCE_VST3_CAN_REPLACE_VST2
#define JUCE_VST3_CAN_REPLACE_VST2 1
#endif

View file

@ -30,6 +30,12 @@ namespace juce
extern ComponentPeer* createNonRepaintingEmbeddedWindowsPeer (Component&, void* parent);
extern bool shouldScaleGLWindow (void* hwnd);
#if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client && (JucePlugin_Build_VST || JucePlugin_Build_VST3)
bool juce_shouldDoubleScaleNativeGLWindow();
#else
bool juce_shouldDoubleScaleNativeGLWindow() { return false; }
#endif
//==============================================================================
class OpenGLContext::NativeContext
#if JUCE_WIN_PER_MONITOR_DPI_AWARE
@ -191,6 +197,9 @@ private:
{
auto newScale = peer->getPlatformScaleFactor();
if (juce_shouldDoubleScaleNativeGLWindow())
newScale *= newScale;
if (! approximatelyEqual (newScale, nativeScaleFactor))
{
nativeScaleFactor = newScale;
@ -220,6 +229,10 @@ private:
#if JUCE_WIN_PER_MONITOR_DPI_AWARE
safeComponent = Component::SafePointer<Component> (&component);
nativeScaleFactor = peer->getPlatformScaleFactor();
if (juce_shouldDoubleScaleNativeGLWindow())
nativeScaleFactor *= nativeScaleFactor;
startTimer (50);
#endif