diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index 37e627e746..2312683ba4 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -1637,14 +1637,17 @@ private: /* Convert from the component's coordinate system to the hosted VST3's coordinate system. */ ViewRect componentToVST3Rect (Rectangle r) const { - const auto physical = localAreaToGlobal (r) * nativeScaleFactor * getDesktopScaleFactor(); + const auto combinedScale = nativeScaleFactor * getDesktopScaleFactor(); + const auto physical = (localAreaToGlobal (r.toFloat()) * combinedScale).toNearestInt(); return { 0, 0, physical.getWidth(), physical.getHeight() }; } /* Convert from the hosted VST3's coordinate system to the component's coordinate system. */ Rectangle vst3ToComponentRect (const ViewRect& vr) const { - return getLocalArea (nullptr, Rectangle { vr.right, vr.bottom } / (nativeScaleFactor * getDesktopScaleFactor())); + const auto combinedScale = nativeScaleFactor * getDesktopScaleFactor(); + const auto floatRect = Rectangle { (float) vr.right, (float) vr.bottom } / combinedScale; + return getLocalArea (nullptr, floatRect).toNearestInt(); } void componentMovedOrResized (bool, bool wasResized) override