mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
DropShadow: Revert recent shadow-scale change
Reverts 95d416ab77
The previous change caused the shadow to draw at higher resolution on
high-res displays, which then made the blur more expensive to compute.
This commit is contained in:
parent
6ff5e57b62
commit
5aa76a7d7e
1 changed files with 2 additions and 6 deletions
|
|
@ -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<float> area,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue