Browse Source

Fix incorrect non-scaled UIs for hosts requesting size early

Signed-off-by: falkTX <falktx@falktx.com>
pull/452/head
falkTX 1 year ago
parent
commit
ce3f6c1147
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 11 additions and 10 deletions
  1. +4
    -4
      distrho/src/DistrhoPluginCLAP.cpp
  2. +2
    -2
      distrho/src/DistrhoPluginVST2.cpp
  3. +5
    -4
      distrho/src/DistrhoUIVST3.cpp

+ 4
- 4
distrho/src/DistrhoPluginCLAP.cpp View File

@@ -280,10 +280,10 @@ public:

double scaleFactor = fScaleFactor;
#if defined(DISTRHO_UI_DEFAULT_WIDTH) && defined(DISTRHO_UI_DEFAULT_HEIGHT)
*width = DISTRHO_UI_DEFAULT_WIDTH;
*height = DISTRHO_UI_DEFAULT_HEIGHT;
if (d_isZero(scaleFactor))
scaleFactor = 1.0;
*width = DISTRHO_UI_DEFAULT_WIDTH * scaleFactor;
*height = DISTRHO_UI_DEFAULT_HEIGHT * scaleFactor;
#else
UIExporter tmpUI(nullptr, 0, fPlugin.getSampleRate(),
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, d_nextBundlePath,
@@ -371,10 +371,10 @@ public:
{
// fix width
if (reqRatio > ratio)
*width = static_cast<int32_t>(*height * ratio + 0.5);
*width = d_roundToIntPositive(*height * ratio);
// fix height
else
*height = static_cast<int32_t>(static_cast<double>(*width) / ratio + 0.5);
*height = d_roundToIntPositive(static_cast<double>(*width) / ratio);
}
}



+ 2
- 2
distrho/src/DistrhoPluginVST2.cpp View File

@@ -602,10 +602,10 @@ public:
{
double scaleFactor = fLastScaleFactor;
#if defined(DISTRHO_UI_DEFAULT_WIDTH) && defined(DISTRHO_UI_DEFAULT_HEIGHT)
fVstRect.right = DISTRHO_UI_DEFAULT_WIDTH;
fVstRect.bottom = DISTRHO_UI_DEFAULT_HEIGHT;
if (d_isZero(scaleFactor))
scaleFactor = 1.0;
fVstRect.right = DISTRHO_UI_DEFAULT_WIDTH * scaleFactor;
fVstRect.bottom = DISTRHO_UI_DEFAULT_HEIGHT * scaleFactor;
#else
UIExporter tmpUI(nullptr, 0, fPlugin.getSampleRate(),
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, d_nextBundlePath,


+ 5
- 4
distrho/src/DistrhoUIVST3.cpp View File

@@ -92,10 +92,10 @@ static void applyGeometryConstraints(const uint minimumWidth,
{
// fix width
if (reqRatio > ratio)
rect->right = static_cast<int32_t>(rect->bottom * ratio + 0.5);
rect->right = d_roundToIntPositive(rect->bottom * ratio);
// fix height
else
rect->bottom = static_cast<int32_t>(static_cast<double>(rect->right) / ratio + 0.5);
rect->bottom = d_roundToIntPositive(static_cast<double>(rect->right) / ratio);
}
}

@@ -1527,10 +1527,10 @@ struct dpf_plugin_view : v3_plugin_view_cpp {

double scaleFactor = view->scale != nullptr ? view->scale->scaleFactor : 0.0;
#if defined(DISTRHO_UI_DEFAULT_WIDTH) && defined(DISTRHO_UI_DEFAULT_HEIGHT)
rect->right = DISTRHO_UI_DEFAULT_WIDTH;
rect->bottom = DISTRHO_UI_DEFAULT_HEIGHT;
if (d_isZero(scaleFactor))
scaleFactor = 1.0;
rect->right = DISTRHO_UI_DEFAULT_WIDTH * scaleFactor;
rect->bottom = DISTRHO_UI_DEFAULT_HEIGHT * scaleFactor;
#else
UIExporter tmpUI(nullptr, 0, view->sampleRate,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, d_nextBundlePath,
@@ -1540,6 +1540,7 @@ struct dpf_plugin_view : v3_plugin_view_cpp {
scaleFactor = tmpUI.getScaleFactor();
tmpUI.quit();
#endif

rect->left = rect->top = 0;
#ifdef DISTRHO_OS_MAC
rect->right /= scaleFactor;


Loading…
Cancel
Save