1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Component: Revert improvements to opaque component checks

Reverts commits cea19a9d, 961ff32b, and partially reverts 5ec4d85d
Some issues have appeared on the forums so these commits have been
reverted while the issue is investigated.
This commit is contained in:
Anthony Nicholls 2025-11-18 14:32:56 +00:00 committed by Anthony Nicholls
parent fc29df83b5
commit 10ec977d05
3 changed files with 92 additions and 280 deletions

View file

@ -193,6 +193,42 @@ struct ComponentHelpers
return convertFromDistantParentSpace (topLevelComp, *target, p);
}
static bool clipChildComponent (const Component& child,
Graphics& g,
const Rectangle<int> clipRect,
Point<int> delta)
{
if (! child.isVisible() || child.isTransformed())
return false;
const auto newClip = clipRect.getIntersection (child.boundsRelativeToParent);
if (newClip.isEmpty())
return false;
if (child.isOpaque() && child.componentTransparency == 0)
{
g.excludeClipRegion (newClip + delta);
return true;
}
const auto childPos = child.getPosition();
return clipObscuredRegions (child, g, newClip - childPos, childPos + delta);
}
static bool clipObscuredRegions (const Component& comp,
Graphics& g,
const Rectangle<int> clipRect,
Point<int> delta)
{
auto wasClipped = false;
for (int i = comp.childComponentList.size(); --i >= 0;)
wasClipped |= clipChildComponent (*comp.childComponentList.getUnchecked (i), g, clipRect, delta);
return wasClipped;
}
static Rectangle<int> getParentOrMainMonitorBounds (const Component& comp)
{
if (auto* p = comp.getParentComponent())
@ -227,14 +263,6 @@ struct ComponentHelpers
function (c, ms, SH::screenPosToLocalPos (*c, ms.getScreenPosition()), Time::getCurrentTime());
}
static bool isVisible (const Component& component, bool allowTransparency = true)
{
return component.isVisible()
&& component.getWidth() > 0
&& component.getHeight() > 0
&& component.componentTransparency < (allowTransparency ? 255 : 1);
}
class ModalComponentManagerChangeNotifier
{
public: