From 68d71f5cc63727d6c30c451ba173a2f1f97c75c5 Mon Sep 17 00:00:00 2001 From: Armin Date: Tue, 14 Jul 2026 19:17:31 +0200 Subject: [PATCH] fix: stretch background image to fill 100% of horizontal width --- Source/PluginEditor.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index e3a1564..fd980d6 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -745,20 +745,11 @@ void MainContentComponent::paint(juce::Graphics& g) { bgImageLoaded = true; } if (bgImage.isValid()) { - int imgW = bgImage.getWidth(); - int imgH = bgImage.getHeight(); - int compW = getWidth(); - int compH = getHeight(); - g.setOpacity(0.35f); - const float bgZoom = 1.8f; - int tileW = static_cast(imgW * bgZoom); - int tileH = static_cast(imgH * bgZoom); - for (int x = 0; x < compW; x += tileW) - for (int y = 0; y < compH; y += tileH) - g.drawImage(bgImage, static_cast(x), static_cast(y), - static_cast(tileW), static_cast(tileH), - 0, 0, imgW, imgH, false); + g.drawImage(bgImage, + juce::Rectangle(0.0f, 0.0f, static_cast(getWidth()), + static_cast(getHeight())), + juce::RectanglePlacement::stretchToFit); g.setOpacity(1.0f); }