From 5aa76a7d7ea72699145fc363fdeebd4d7d606b3b Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 6 Feb 2025 22:21:50 +0000 Subject: [PATCH] DropShadow: Revert recent shadow-scale change Reverts 95d416ab77cc132a7d663ca438574b2d9a820e75 The previous change caused the shadow to draw at higher resolution on high-res displays, which then made the blur more expensive to compute. --- modules/juce_graphics/effects/juce_DropShadowEffect.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/juce_graphics/effects/juce_DropShadowEffect.cpp b/modules/juce_graphics/effects/juce_DropShadowEffect.cpp index 5ee1f17c6e..6ee421f4e1 100644 --- a/modules/juce_graphics/effects/juce_DropShadowEffect.cpp +++ b/modules/juce_graphics/effects/juce_DropShadowEffect.cpp @@ -61,7 +61,6 @@ void DropShadow::drawForPath (Graphics& g, const Path& path) const { jassert (radius > 0); - const auto scale = g.getInternalContext().getPhysicalPixelScaleFactor(); auto area = (path.getBounds().getSmallestIntegerContainer() + offset) .expanded (radius + 1) .getIntersection (g.getClipBounds().expanded (radius + 1)); @@ -69,14 +68,11 @@ void DropShadow::drawForPath (Graphics& g, const Path& path) const if (area.getWidth() <= 2 || area.getHeight() <= 2) return; - const auto scaledArea = (area * scale).getSmallestIntegerContainer(); - - Image pathImage { Image::SingleChannel, scaledArea.getWidth(), scaledArea.getHeight(), true }; + Image pathImage { Image::SingleChannel, area.getWidth(), area.getHeight(), true }; pathImage.setBackupEnabled (false); { Graphics g2 (pathImage); - g2.addTransform (AffineTransform::scale (scale)); g2.setColour (Colours::white); g2.fillPath (path, AffineTransform::translation ((float) (offset.x - area.getX()), (float) (offset.y - area.getY()))); @@ -85,7 +81,7 @@ void DropShadow::drawForPath (Graphics& g, const Path& path) const pathImage.getPixelData()->applySingleChannelBoxBlurEffect (radius); g.setColour (colour); - g.drawImage (pathImage, area.toFloat(), RectanglePlacement::stretchToFit, true); + g.drawImageAt (pathImage, area.getX(), area.getY(), true); } static void drawShadowSection (Graphics& g, ColourGradient& cg, Rectangle area,