fix: stretch background image to fill 100% of horizontal width

This commit is contained in:
Armin 2026-07-14 19:17:31 +02:00
commit 68d71f5cc6

View file

@ -745,20 +745,11 @@ void MainContentComponent::paint(juce::Graphics& g) {
bgImageLoaded = true; bgImageLoaded = true;
} }
if (bgImage.isValid()) { if (bgImage.isValid()) {
int imgW = bgImage.getWidth();
int imgH = bgImage.getHeight();
int compW = getWidth();
int compH = getHeight();
g.setOpacity(0.35f); g.setOpacity(0.35f);
const float bgZoom = 1.8f; g.drawImage(bgImage,
int tileW = static_cast<int>(imgW * bgZoom); juce::Rectangle<float>(0.0f, 0.0f, static_cast<float>(getWidth()),
int tileH = static_cast<int>(imgH * bgZoom); static_cast<float>(getHeight())),
for (int x = 0; x < compW; x += tileW) juce::RectanglePlacement::stretchToFit);
for (int y = 0; y < compH; y += tileH)
g.drawImage(bgImage, static_cast<float>(x), static_cast<float>(y),
static_cast<float>(tileW), static_cast<float>(tileH),
0, 0, imgW, imgH, false);
g.setOpacity(1.0f); g.setOpacity(1.0f);
} }