Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions modules/juce_audio_plugin_client/juce_audio_plugin_client_AAX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,8 @@ namespace AAXClasses
if (component != nullptr)
{
*viewSize = convertToHostBounds ({ (float) component->getHeight(),
(float) component->getWidth() });
(float) component->getWidth() },
component.get());

return AAX_SUCCESS;
}
Expand Down Expand Up @@ -626,15 +627,23 @@ namespace AAXClasses
AAX_CParamID getAAXParamIDFromJuceIndex (int index) const noexcept;

//==============================================================================
static AAX_Point convertToHostBounds (AAX_Point pluginSize)
static AAX_Point convertToHostBounds (AAX_Point pluginSize, const Component* comp)
{
auto desktopScale = Desktop::getInstance().getGlobalScaleFactor();
// The host works in physical pixels. The logical-to-physical scale is
// the global scale times the window's platform scale; depending on the
// platform's DPI awareness either term may carry the factor, so apply
// both.
auto scale = (float) Desktop::getInstance().getGlobalScaleFactor();

if (approximatelyEqual (desktopScale, 1.0f))
if (comp != nullptr)
if (auto* peer = comp->getPeer())
scale *= (float) peer->getPlatformScaleFactor();

if (approximatelyEqual (scale, 1.0f))
return pluginSize;

return { pluginSize.vert * desktopScale,
pluginSize.horz * desktopScale };
return { pluginSize.vert * scale,
pluginSize.horz * scale };
}

//==============================================================================
Expand Down Expand Up @@ -720,7 +729,8 @@ namespace AAXClasses
if (pluginEditor != nullptr)
{
auto newSize = convertToHostBounds ({ (float) pluginEditor->getHeight(),
(float) pluginEditor->getWidth() });
(float) pluginEditor->getWidth() },
this);

return owner.GetViewContainer()->SetViewSize (newSize) == AAX_SUCCESS;
}
Expand Down