Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions src/dmt/gui/widget/Shadow.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class Shadow
TRACER("Shadow::drawOuterForPath");
juce::Graphics::ScopedSaveState saveState(_g);
juce::Path shadowPath(_target);
shadowPath.addRectangle(_target.getBounds().expanded(10 * scale));
shadowPath.addRectangle(_target.getBounds().expanded(10.0f));
shadowPath.setUsingNonZeroWinding(false);
_g.reduceClipRegion(shadowPath);
updateShadowParameters();
Expand All @@ -259,19 +259,22 @@ class Shadow
private:
inline void updateShadowParameters()
{
const auto scaledRadius = static_cast<double>(radius * size * scale);
const auto scaledOffset = juce::Point<float>(
static_cast<float>(offset.x) * static_cast<float>(scale),
static_cast<float>(offset.y) * static_cast<float>(scale));
// Rendering uses a graphics transform for HiDPI, so keep shadow parameters
// in logical units to avoid applying scale twice.
const auto scaledRadius = static_cast<double>(radius * size);
const auto scaledOffset = juce::Point<float>(static_cast<float>(offset.x),
static_cast<float>(offset.y));

if (inner) {
innerShadowRenderer.setColor(*colour).setRadius(scaledRadius).setOffset(
scaledOffset);
innerShadowRenderer.setColor(*colour)
.setRadius(scaledRadius)
.setOffset(scaledOffset);
return;
}

outerShadowRenderer.setColor(*colour).setRadius(scaledRadius).setOffset(
scaledOffset);
outerShadowRenderer.setColor(*colour)
.setRadius(scaledRadius)
.setOffset(scaledOffset);
}

inline void refreshCachedImageIfNeeded(bool forceRepaint = false)
Expand Down
11 changes: 8 additions & 3 deletions src/dmt/gui/window/Compositor.h
Original file line number Diff line number Diff line change
Expand Up @@ -570,16 +570,21 @@ class Compositor
* components that implement the IScaleable interface receive the updated
* size factor.
*
* @param force If true, propagation runs even when the size factor itself
* did not change. This is required for dynamically added
* scaleable children.
*
* @note This is typically triggered by the Compositor in response to
* hierarchy changes or user scaling actions.
*/
void propagateSizeFactor() noexcept
void propagateSizeFactor(const bool force = false) noexcept
{
TRACER("Compositor::propagateSizeFactor");
if (isPropagatingSizeFactor)
return;

if (juce::approximatelyEqual(lastPropagatedSizeFactor, sizeFactor))
if (!force &&
juce::approximatelyEqual(lastPropagatedSizeFactor, sizeFactor))
return;

const juce::ScopedValueSetter<bool> isPropagatingGuard(
Expand Down Expand Up @@ -755,7 +760,7 @@ class Compositor
return;

addListenerToChildren(&component);
propagateSizeFactor();
propagateSizeFactor(true);
}

private:
Expand Down
Loading